Changeset 153 in josm for src/org/openstreetmap/josm/plugins
- Timestamp:
- 2006-10-07T18:14:07+02:00 (19 years ago)
- Location:
- src/org/openstreetmap/josm/plugins
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/plugins/Plugin.java
r149 r153 13 13 * (or else, the plugin jar will not be within the class path). 14 14 * 15 * All plugins should have at least one class subclassing this abstract base class. 16 * 15 * All plugins should have at least one class subclassing this abstract base class. 16 * 17 17 * The actual implementation of this interface is optional, as all functions will be called 18 18 * via reflection. This is to be able to change this interface without the need of recompiling … … 25 25 * 26 26 * 27 * The pluginname provided to the constructor is also the name of the directory to 27 * The pluginname provided to the constructor is also the name of the directory to 28 28 * store the plugin's own stuff (located under the josm preferences directory) 29 29 * … … 40 40 name = s.substring(lastSlash+1, s.length()-4); 41 41 } 42 42 43 43 /** 44 44 * @return The name of this plugin. This is the name of the .jar file. … … 54 54 } 55 55 56 56 57 57 58 58 /** … … 62 62 */ 63 63 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {} 64 65 /**66 * Called to retrieve a one-liner description of what this plugin does for tooltips.67 * @return <code>null</code>, which means: "no description available".68 */69 public String getDescription() {return null;}70 71 64 } -
src/org/openstreetmap/josm/plugins/PluginProxy.java
r149 r153 6 6 /** 7 7 * Helper class for the JOSM system to communicate with the plugin. 8 * 8 * 9 9 * This class should be of no interest for sole plugin writer. 10 * 10 * 11 11 * @author Immanuel.Scholz 12 12 */ … … 14 14 15 15 public final Object plugin; 16 public final String name;16 public final PluginInformation info; 17 17 public boolean misbehaving = false; 18 18 19 public PluginProxy(Object plugin, String name) {19 public PluginProxy(Object plugin, PluginInformation info) { 20 20 this.plugin = plugin; 21 this. name = name;21 this.info = info; 22 22 } 23 23 24 25 26 24 @Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 27 25 try { 28 26 plugin.getClass().getMethod("mapFrameInitialized", MapFrame.class, MapFrame.class).invoke(plugin, oldFrame, newFrame); 29 27 } catch (Exception e) { 30 throw new PluginException(this, name, e); 31 } 32 } 33 34 @Override public String getDescription() { 35 try { 36 return (String)plugin.getClass().getMethod("getDescription").invoke(plugin); 37 } catch (NoSuchMethodException e) { 38 return super.getDescription(); 39 } catch (Exception e) { 40 throw new PluginException(this, name, e); 28 throw new PluginException(this, info.name, e); 41 29 } 42 30 }
Note:
See TracChangeset
for help on using the changeset viewer.