(Experimental PATCH) Allow plugins to be reloaded without restart
|Reported by:||olejorgenb||Owned by:||olejorgenb|
Description (last modified by stoecker)
I have a tendency to test my code very (or maybe too ;) often so I'm starting to get pretty sick of watching the JOSM load screen by now.
Decided to scratch my itch, and here is the result.
The patch introduces a new method in Plugin called preReloadCleanup. All loaded/active plugins implementing this will be reloaded when ReloadPluginsAction is performed. (They don't have to use Plugin as a baseclass)
It's not really tested beyond checking that the new classes actually are loaded and used. Would be beneficial if a java guru could take a look and see if my classloader magic is mostly correct.
- If p1 requires p2 and only p2 is re-loadable, two versions of p2 will be in use. That can't be good. (Not checked, but I'm quite sure this applies)
- checkLoadPreconditions is not run on the plugins before reload. Fair to assuming the conditions are fulfilled as the plugins are already loaded, but it isn't 100% correct.
- Doesn't respect the early/late flags. Is that important?
- Probably need more functions in MapFrame supporting preReloadCleanup. (only removeMapMode is implemented now)
This feature is mostly for the plugin-developer's benefit, so it doesn't have to be perfect before inclusion, IMHO.