Changeset 504 in josm
- Timestamp:
- 2007-12-31T17:49:15+01:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
r474 r504 23 23 import java.util.TreeMap; 24 24 import java.util.Map.Entry; 25 import java.net.URL; 25 26 26 27 import javax.swing.AbstractAction; … … 56 57 public String name; 57 58 public String description; 58 public Stringresource;59 public URL resource; 59 60 public String version; 60 public PluginDescription(String name, String description, Stringresource, String version) {61 public PluginDescription(String name, String description, URL resource, String version) { 61 62 this.name = name; 62 63 this.description = description; … … 212 213 pluginPanel.add(pluginCheck); 213 214 214 pluginCheck.setToolTipText(plugin.resource != null ? plugin.resource : tr("Plugin bundled with JOSM"));215 pluginCheck.setToolTipText(plugin.resource != null ? ""+plugin.resource : tr("Plugin bundled with JOSM")); 215 216 JLabel label = new JLabel("<html><i>"+(plugin.description==null?tr("no description available"):plugin.description)+"</i></html>"); 216 217 label.setBorder(BorderFactory.createEmptyBorder(0,20,0,0)); … … 246 247 PluginInformation info = new PluginInformation(f); 247 248 if (!availablePlugins.containsKey(info.name)) 248 availablePlugins.put(info.name, new PluginDescription(info.name, info.description, PluginInformation.getURLString(f.getPath()), info.version)); 249 availablePlugins.put(info.name, new PluginDescription( 250 info.name, 251 info.description, 252 PluginInformation.fileToURL(f), 253 info.version)); 249 254 } catch (PluginException x) { 250 255 } … … 268 273 proxy.info.name, 269 274 proxy.info.description, 270 proxy.info.file == null ? null : PluginInformation. getURLString(proxy.info.file.getPath()),271 275 proxy.info.file == null ? null : PluginInformation.fileToURL(proxy.info.file), 276 proxy.info.version)); 272 277 return availablePlugins.values(); 273 278 } -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r298 r504 9 9 import java.io.InputStream; 10 10 import java.net.URL; 11 import java.net.MalformedURLException; 11 12 import java.util.ArrayList; 12 13 import java.util.Collection; … … 84 85 String classPath = attr.getValue(Attributes.Name.CLASS_PATH); 85 86 if (classPath != null) { 86 String[] cp = classPath.split(" "); 87 StringBuilder entry = new StringBuilder(); 88 for (String s : cp) { 89 entry.append(s); 90 if (s.endsWith("\\")) { 91 entry.setLength(entry.length()-1); 92 entry.append("%20"); // append the split character " " as html-encode 93 continue; 87 for (String entry : classPath.split(" ")) { 88 File entryFile; 89 if (new File(entry).isAbsolute()) { 90 entryFile = new File(entry); 91 } else { 92 entryFile = new File(file.getParent(), entry); 94 93 } 95 s = entry.toString(); 96 entry = new StringBuilder(); 97 if (!s.startsWith("/") && !s.startsWith("\\") && !s.matches("^.\\:") && file != null) 98 s = file.getParent() + File.separator + s; 99 libraries.add(new URL(getURLString(s))); 94 95 libraries.add(fileToURL(entryFile)); 100 96 } 101 97 } … … 112 108 } 113 109 if (file != null) 114 libraries.add(0, new URL(getURLString(file.getAbsolutePath())));110 libraries.add(0, fileToURL(file)); 115 111 116 112 if (jar != null) … … 147 143 } 148 144 149 public static String getURLString(String fileName) { 150 if (System.getProperty("os.name").startsWith("Windows")) 151 return "file:/"+fileName; 152 return "file://"+fileName; 145 public static URL fileToURL(File f) { 146 try { 147 return f.toURI().toURL(); 148 } catch (MalformedURLException ex) { 149 return null; 150 } 153 151 } 154 152
Note:
See TracChangeset
for help on using the changeset viewer.