Changes between Version 51 and Version 52 of DevelopersGuide/DevelopingPlugins
- Timestamp:
- 2011-09-20T23:32:50+02:00 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DevelopersGuide/DevelopingPlugins
v51 v52 95 95 * {{{public void mapFrameInitialized(MapFrame old, MapFrame new)}}} 96 96 97 JOSM manages at most one [source:/trunk/src/org/openstreetmap/josm/gui/MapFrame.java MapFrame]. At startup, when JOSM displays the Message of the Day (MOTD) panel, the MapFrame is null. It is only created when the first [source:/trunk/src/org/openstreetmap/josm/ layer/MapFrame.java Layer] is added and it is removed and reset to null if the last layer is removed. Plugins implementing a method {{{mapFrameInitialized}}} are notified about the change of the current map frame.97 JOSM manages at most one [source:/trunk/src/org/openstreetmap/josm/gui/MapFrame.java MapFrame]. At startup, when JOSM displays the Message of the Day (MOTD) panel, the MapFrame is null. It is only created when the first [source:/trunk/src/org/openstreetmap/josm/gui/layer/Layer.java Layer] is added and it is removed and reset to null if the last layer is removed. Plugins implementing a method {{{mapFrameInitialized}}} are notified about the change of the current map frame. 98 98 99 99 * {{{public PreferenceSetting getPreferenceSetting()}}} 100 100 101 The [source:/trunk/src/org/openstreetmap/josm/gui/preference/PreferenceDialog.java JOSM preference dialog] asks a plugin to supply an editor for its preferences. The editor must be a subclass of [source:/trunk/src/org/openstreetmap/josm/gui/preference/PreferenceSetting.java PreferenceSetting]. Return null from {{{getPreferenceSetting}}} or don't implement it if your plugin has no need to manage preferences. 101 The [source:/trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java JOSM preference dialog] asks a plugin to supply an editor for its preferences. The editor must be a subclass of [source:/trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceSetting.java PreferenceSetting]. Return null from {{{getPreferenceSetting}}} or don't implement it if your plugin has no need to manage preferences. 102 102 103 103 * {{{public void addDownloadSelection(List<DownloadSelection> list)}}} … … 113 113 Most of the current JOSM authors don't follow this approach and in 2008 and 2009 large parts of the JOSM code base have been refactored in order to improve the maintainability and stability of the code. You're encouraged to follow the well-established principles of encapsulation and information hiding in plugins too. 114 114 115 There are still a couple of global objects accessible through [source:/trunk/src/org/openstreetmap/josm/Main Main], though. 115 There are still a couple of global objects accessible through [source:/trunk/src/org/openstreetmap/josm/Main.java Main], though. 116 116 117 117 ||Main.parent||This is the parent of all GUI elements. Use this as first parameter to JOptionPane.show* if you want to popup a message||