Changeset 1138 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-12-15T17:14:52+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1120 r1138 249 249 if (info.early != early) 250 250 continue; 251 if (info.mainversion != null && info.mainversion.compareTo(AboutAction.version) > 0) { 252 JOptionPane.showMessageDialog(Main.parent, tr("Plugin requires JOSM update: {0}.", pluginName)); 253 continue; 251 if (info.mainversion != null) { 252 int requiredJOSMVersion = 0; 253 try { 254 requiredJOSMVersion = Integer.parseInt(info.mainversion); 255 } catch(NumberFormatException e) { 256 e.printStackTrace(); 257 } 258 if (requiredJOSMVersion > AboutAction.getVersionNumber()) { 259 JOptionPane.showMessageDialog(Main.parent, tr("Plugin requires JOSM update: {0}.", pluginName)); 260 continue; 261 } 254 262 } 255 263 if (!p.containsKey(info.stage)) -
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r1084 r1138 13 13 import java.io.InputStream; 14 14 import java.io.InputStreamReader; 15 import java.net.MalformedURLException; 15 16 import java.net.URL; 16 17 import java.util.Map.Entry; … … 44 45 * @author imi 45 46 */ 47 /** 48 * @author Stephan 49 * 50 */ 46 51 public class AboutAction extends JosmAction { 47 52 48 p ublicstatic final String version;53 private static final String version; 49 54 50 55 private final static JTextArea revision; 51 56 private static String time; 52 57 53 static { 54 URL u = Main.class.getResource("/REVISION"); 55 if(u == null) u = Main.class.getResource("/META-INF/MANIFEST.MF"); 58 static { 59 URL u = Main.class.getResource("/REVISION"); 60 if(u == null) { 61 try { 62 u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString() 63 + "!/META-INF/MANIFEST.MF"); 64 } catch (MalformedURLException e) { 65 e.printStackTrace(); 66 } 67 } 56 68 revision = loadFile(u); 57 69 58 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]* ).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL);70 Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); 59 71 Matcher match = versionPattern.matcher(revision.getText()); 60 72 version = match.matches() ? match.group(1) : tr("UNKNOWN"); … … 65 77 } 66 78 67 static public String getVersion() { 79 /** 80 * Return string describing version. 81 * Note that the strinc contains the version number plus an optional suffix of " SVN" to indicate an unofficial development build. 82 * @return version string 83 */ 84 static public String getVersionString() { 68 85 return version; 69 86 } 70 87 88 /** 89 * Return the number part of the version string. 90 * @return integer part of version number or Integer.MAX_VALUE if not available 91 */ 92 public static int getVersionNumber() { 93 int myVersion=Integer.MAX_VALUE; 94 try { 95 myVersion = Integer.parseInt(version.split(" ")[0]); 96 } catch (NumberFormatException e) { 97 e.printStackTrace(); 98 } 99 return myVersion; 100 } 101 102 /** 103 * check whether the version is a development build out of SVN. 104 * @return true if it is a SVN unofficial build 105 */ 106 public static boolean isDevelopmentVersion() { 107 return version.endsWith(" SVN"); 108 } 109 71 110 public AboutAction() { 72 111 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); -
trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
r1130 r1138 48 48 public AddNodeAction() { 49 49 super(tr("Add Node"), "addnode", tr("Add a node by entering latitude and longitude."), 50 Shortcut.registerShortcut("addnode", tr("Edit: {0}", tr("Add Node")), KeyEvent.VK_D, Shortcut.GROUP_MENU), true); 50 Shortcut.registerShortcut("addnode", tr("Edit: {0}", tr("Add Node")), KeyEvent.VK_D, Shortcut.GROUP_EDIT, 51 Shortcut.SHIFT_DEFAULT), true); 51 52 } 52 53 -
trunk/src/org/openstreetmap/josm/actions/ToggleGPXLinesAction.java
r1084 r1138 14 14 public ToggleGPXLinesAction() { 15 15 super(tr("Toggle GPX Lines"), "gps-lines", tr("Toggles the global setting ''{0}''.", tr("Draw lines between raw gps points.")), 16 Shortcut.registerShortcut("view:gpxlines", tr("View: {0}", tr("Toggle GPX Lines")), KeyEvent.VK_X, Shortcut.GROUP_MENU ), true);16 Shortcut.registerShortcut("view:gpxlines", tr("View: {0}", tr("Toggle GPX Lines")), KeyEvent.VK_X, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT), true); 17 17 } 18 18 -
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r1016 r1138 57 57 } 58 58 59 int myVersion; 60 try { 61 myVersion = Integer.parseInt(AboutAction.getVersion()); 62 } catch (NumberFormatException e) { 63 myVersion = 0; 64 } 59 int myVersion = AboutAction.getVersionNumber(); 65 60 66 61 Pattern commentPattern = Pattern.compile("\\<p\\>\\s*\\/\\*[^\\*]*\\*\\/\\s*\\<\\/p\\>", Pattern.CASE_INSENSITIVE|Pattern.DOTALL|Pattern.MULTILINE); -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r1093 r1138 73 73 74 74 // Add the version number 75 JLabel version = new JLabel(tr("Version {0}", AboutAction. version));75 JLabel version = new JLabel(tr("Version {0}", AboutAction.getVersionString())); 76 76 gbc.gridy = 1; 77 77 gbc.insets = new Insets(0, 0, 0, 0);
Note:
See TracChangeset
for help on using the changeset viewer.