Changeset 267 in josm for src/org/openstreetmap/josm/plugins/Plugin.java
- Timestamp:
- 2007-06-30T22:01:02+02:00 (19 years ago)
- File:
-
- 1 edited
-
src/org/openstreetmap/josm/plugins/Plugin.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/plugins/Plugin.java
r237 r267 40 40 public abstract class Plugin { 41 41 42 privateString name;42 String name; 43 43 44 44 public Plugin() { 45 URL[] urls = ((URLClassLoader)getClass().getClassLoader()).getURLs(); 46 name = urls[urls.length-1].toString(); 47 if (name.toLowerCase().endsWith(".jar")) { 48 int lastSlash = name.lastIndexOf('/'); 49 name = name.substring(lastSlash+1, name.length()-4); 50 } 45 try { 46 URL[] urls = ((URLClassLoader)getClass().getClassLoader()).getURLs(); 47 name = urls[urls.length-1].toString(); 48 if (name.toLowerCase().endsWith(".jar")) { 49 int lastSlash = name.lastIndexOf('/'); 50 name = name.substring(lastSlash+1, name.length()-4); 51 } 52 } catch (RuntimeException e) { 53 name = "unknown"; 54 } 51 55 } 52 56 53 57 /** 54 58 * @return The name of this plugin. This is the name of the .jar file. 59 * @deprecated Plugins have to know their name by themself. 55 60 */ 56 public final String getName() { 61 @Deprecated public final String getName() { 57 62 return name; 58 63 } 59 64 /** 60 65 * @return The directory for the plugin to store all kind of stuff. 66 * @deprecated Use <code>Main.pref.getPreferencesDir()+"plugins/"+name+"/";</code> instead. 61 67 */ 62 public final String getPluginDir() { 68 @Deprecated public final String getPluginDir() { 63 69 return Main.pref.getPreferencesDir()+"plugins/"+name+"/"; 64 70 }
Note:
See TracChangeset
for help on using the changeset viewer.
