- Timestamp:
- 2009-11-01T10:20:23+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r2369 r2370 35 35 */ 36 36 public class AboutAction extends JosmAction { 37 37 38 38 public AboutAction() { 39 39 super(tr("About"), "about", tr("Display the about screen."), Shortcut.registerShortcut("system:about", tr("About"), KeyEvent.VK_F1, Shortcut.GROUP_DIRECT, Shortcut.SHIFT_DEFAULT), true); … … 42 42 public void actionPerformed(ActionEvent e) { 43 43 JTabbedPane about = new JTabbedPane(); 44 44 45 45 JTextArea readme = new JTextArea(); 46 46 readme.setEditable(false); … … 54 54 license.setEditable(false); 55 55 license.setText(Version.loadResourceFile(Main.class.getResource("/LICENSE"))); 56 56 57 57 Version version = Version.getInstance(); 58 58 -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r2369 r2370 32 32 import org.openstreetmap.josm.gui.preferences.ProxyPreferences; 33 33 import org.openstreetmap.josm.tools.ColorHelper; 34 import org.openstreetmap.josm.tools.LanguageInfo;35 34 36 35 /** … … 62 61 private String name; 63 62 private Bounds area; 64 65 public Bookmark() { 63 64 public Bookmark() { 66 65 area = null; 67 66 name = null; 68 67 } 69 68 70 69 public Bookmark(Bounds area) { 71 this.area = area; 72 } 73 70 this.area = area; 71 } 72 74 73 @Override public String toString() { 75 74 return name; 76 75 } 77 76 78 77 public int compareTo(Bookmark b) { 79 78 return name.toLowerCase().compareTo(b.name.toLowerCase()); 80 79 } 81 82 public Bounds getArea() { 80 81 public Bounds getArea() { 83 82 return area; 84 83 } … … 504 503 } catch(NumberFormatException e) { 505 504 System.err.println(tr("Error: Illegal double value ''{0}'' on line ''{1}'' in bookmark file ''{2}''",m.group(i+2),line, bookmarkFile.toString())); 506 continue; 505 continue; 507 506 } 508 507 } … … 681 680 return put(key, s); 682 681 } 683 682 684 683 /** 685 684 * Updates system properties with the current values in the preferences. 686 * 685 * 687 686 */ 688 687 public void updateSystemProperties() { … … 696 695 sysProp.put("proxyPassword", get(ProxyPreferences.PROXY_PASS)); 697 696 } 698 699 } 700 int v = Version.getInstance().getVersion(); 701 String s = (v == Version.JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v); 702 if (! Version.getInstance().isLocalBuild() && v != Version.JOSM_UNKNOWN_VERSION) { 703 s += " SVN"; 704 } else if (Version.getInstance().isLocalBuild() && v != Version.JOSM_UNKNOWN_VERSION) { 705 s += " Local"; 706 } 707 sysProp.put("http.agent", "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+")"); 697 698 } 699 sysProp.put("http.agent", Version.getInstance().getAgentString()); 708 700 System.setProperties(sysProp); 709 701 } -
trunk/src/org/openstreetmap/josm/data/Version.java
r2369 r2370 14 14 15 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.tools.LanguageInfo; 16 17 17 18 /** 18 19 * Provides basic information about the currently used JOSM build. 19 * 20 * 20 21 */ 21 22 public class Version { … … 23 24 static public final int JOSM_UNKNOWN_VERSION = 0; 24 25 25 /** the unique instance */ 26 /** the unique instance */ 26 27 private static Version instance; 27 28 28 29 /** 29 30 * Load the specified resource as string. 30 * 31 * 31 32 * @param resource the resource url to load 32 * @return the content of the resource file; null, if an error occurred 33 * @return the content of the resource file; null, if an error occurred 33 34 */ 34 35 static public String loadResourceFile(URL resource) { … … 48 49 return s; 49 50 } 50 51 /** 52 * Replies the unique instance of the version information 53 * 51 52 /** 53 * Replies the unique instance of the version information 54 * 54 55 * @return the unique instance of the version information 55 56 */ 56 57 57 58 static public Version getInstance() { 58 59 if (instance == null) { … … 60 61 instance.init(); 61 62 } 62 return instance; 63 } 64 63 return instance; 64 } 65 65 66 private int version; 66 67 private String revision; 67 68 private String time; 68 69 private boolean isLocalBuild; 69 70 70 71 protected HashMap<String, String> parseManifestStyleFormattedString(String content) { 71 72 HashMap<String, String> properties = new HashMap<String, String>(); … … 82 83 return properties; 83 84 } 84 85 /** 86 * Initializes the version infos from the revision resource file 87 * 88 * @param revisionInfo the revision info loaded from a revision resource file 85 86 /** 87 * Initializes the version infos from the revision resource file 88 * 89 * @param revisionInfo the revision info loaded from a revision resource file 89 90 */ 90 91 protected void initFromRevisionInfo(String revisionInfo) { … … 93 94 this.version = JOSM_UNKNOWN_VERSION; 94 95 this.time = null; 95 return; 96 } 97 96 return; 97 } 98 98 99 HashMap<String, String> properties = parseManifestStyleFormattedString(revisionInfo); 99 100 String value = properties.get("Revision"); … … 109 110 version = JOSM_UNKNOWN_VERSION; 110 111 } 111 112 // the last changed data 112 113 // the last changed data 113 114 // 114 115 time = properties.get("Last Changed Date"); … … 116 117 time = properties.get("Build-Date"); 117 118 } 118 119 119 120 // is this a local build ? 120 121 // 121 isLocalBuild = false; 122 isLocalBuild = false; 122 123 value = properties.get("Is-Local-Build"); 123 124 if (value != null && value.trim().toLowerCase().equals("true")) { 124 125 isLocalBuild = true; 125 126 } 126 127 127 128 // the revision info 128 129 // … … 132 133 } 133 134 revision = sb.toString(); 134 } 135 136 public void init() { 135 } 136 137 public void init() { 137 138 URL u = Main.class.getResource("/REVISION"); 138 139 if (u == null) { … … 145 146 System.out.println(revision); 146 147 } 147 148 /** 149 * Replies the version string. Either the SVN revision "1234" (as string) or the 148 149 /** 150 * Replies the version string. Either the SVN revision "1234" (as string) or the 150 151 * the I18n equivalent of "UNKNOWN". 151 * 152 * @return the JOSM version 152 * 153 * @return the JOSM version 153 154 */ 154 155 public String getVersionString() { 155 156 return version == 0 ? tr("UNKNOWN") : Integer.toString(version); 156 157 } 157 158 158 159 /** 159 160 * Replies a text with the release attributes 160 * 161 * 161 162 * @return a text with the release attributes 162 163 */ … … 166 167 167 168 /** 168 * Replies the build date as string 169 * 170 * @return the build date as string 169 * Replies the build date as string 170 * 171 * @return the build date as string 171 172 */ 172 173 public String getTime() { 173 174 return time; 174 175 } 175 176 /** 177 * Replies the JOSM version. Replies {@see #JOSM_UNKNOWN_VERSION} if the version isn't known. 176 177 /** 178 * Replies the JOSM version. Replies {@see #JOSM_UNKNOWN_VERSION} if the version isn't known. 178 179 * @return the JOSM version 179 180 */ … … 184 185 /** 185 186 * Replies true if this is a local build, i.e. an inofficial development build. 186 * 187 * 187 188 * @return true if this is a local build, i.e. an inofficial development build. 188 189 */ … … 190 191 return isLocalBuild; 191 192 } 193 194 public String getAgentString() { 195 int v = getVersion(); 196 String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v); 197 if (isLocalBuild() && v != JOSM_UNKNOWN_VERSION) { 198 s += " SVN"; 199 } 200 return "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+")"; 201 } 192 202 }
Note:
See TracChangeset
for help on using the changeset viewer.