Changes between Version 17 and Version 18 of DevelopersGuide/DevelopingPlugins


Ignore:
Timestamp:
2007-07-19T14:54:09+02:00 (18 years ago)
Author:
imi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DevelopersGuide/DevelopingPlugins

    v17 v18  
    2323
    2424= Callbacks =
    25 Most of your plugin work will probably be tweaking the JOSM object tree at startup time, but there are a few callbacks that get automatically called on every plugin.
     25Most of your plugin work will probably be tweaking the JOSM object tree at startup time, but there are a few callbacks that get automatically called on every plugin (whether you subclass Plugin or not, just the signature matters).
    2626
    2727== mapFrameInitialized ==
     
    8484
    8585
     86= Versioning and Dependencies =
     87JOSM does not support declarative dependency checking - you have to do it by hand. But don't be scared, it's not that hard. You can request information about other installed plugins via {{{PluginInformation.getLoaded("pluginname")}}}. As example if your plugin is named "secondwaltz" and you depend on the plugin "schostakowitsch" to be loaded, do the following things:
     88
     89 - make sure you get loaded after "schostakowitsch" (by incrementing your Plugin-Stage. See above)
     90 - check for "schostakowitsch" to be loaded in your plugin's class constructor:
     91{{{
     92#!java
     93PluginInformation schostakowitsch = PluginInformation.getLoaded("schostakowitsch");
     94if (schostakowitsch == null || !"2".equals(schostakowitsch.version)) {
     95  JOptionPane.showMessageDialog(Main.parent, tr("Please install plugin 'schostakowitsch' version 2");
     96  return;
     97}
     98}}}
     99 - Of course, you may initialize the parts of your plugin that don't need "schostakowitsch" to be loaded or react in some other way to the missing plugin (e.g. by using a build-in version of "schostakowitsch").
     100
     101
    86102= Legal stuff (Imis opinion) =
    87103