#15451 closed enhancement (fixed)
Separate preferences.xml files for plugins
Reported by: | bastiK | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin | Version: | |
Keywords: | plugin | Cc: |
Description
Currently, all plugins store their settings in the main preferences file. This is fine, as long as proper prefixes are used for the key. But it could be considered better design when plugins can just do their thing and not interfere with JOSM core business.
Plugins need to be updated to replace Main.pref
with Config.getPref()
anyway, so it may as well be changed to Plugin.getPref()
instead.
Attachments (1)
Change History (10)
by , 7 years ago
Attachment: | plugin-prefs.patch added |
---|
follow-up: 3 comment:1 by , 7 years ago
comment:3 by , 7 years ago
Replying to stoecker:
I'm not convinced that the additional complexity brings any real benefit (e.g. I think you forgot to adapt Advanced Preferences).
Hm, the advanced preferences GUI is troublesome. I'll settle for the rework of Preferences
, as that was the main goal anyway.
comment:6 by , 7 years ago
JOSM does not start anymore from my Eclipse setup:
2017-10-18 20:51:58.504 GRAVE: Handled by bug report queue: java.lang.NullPointerException java.lang.NullPointerException at org.openstreetmap.josm.data.preferences.JosmBaseDirectories.getCacheDirectory(JosmBaseDirectories.java:115) at org.openstreetmap.josm.data.Preferences.getDefaultsCacheFile(Preferences.java:473) at org.openstreetmap.josm.data.Preferences.init(Preferences.java:895) at org.openstreetmap.josm.gui.MainApplication.mainJOSM(MainApplication.java:932) at org.openstreetmap.josm.gui.MainApplication$2.processArguments(MainApplication.java:283) at org.openstreetmap.josm.gui.MainApplication.main(MainApplication.java:867) 2017-10-18 20:51:58.675 GRAVE: java.util.concurrent.ExecutionException: java.lang.NullPointerException. Cause : java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitAndReturn(GuiHelper.java:267) at org.openstreetmap.josm.gui.bugreport.BugReportDialog.showFor(BugReportDialog.java:282) at org.openstreetmap.josm.tools.bugreport.BugReportQueue.displayFor(BugReportQueue.java:134) at org.openstreetmap.josm.tools.bugreport.BugReportQueue.access$1(BugReportQueue.java:129) at org.openstreetmap.josm.tools.bugreport.BugReportQueue$BugReportDisplayRunnable.run(BugReportQueue.java:100) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at org.openstreetmap.josm.gui.widgets.TextContextualPopupMenu.addMenuEntry(TextContextualPopupMenu.java:174) at org.openstreetmap.josm.gui.widgets.TextContextualPopupMenu.addMenuEntries(TextContextualPopupMenu.java:108) at org.openstreetmap.josm.gui.widgets.TextContextualPopupMenu.attach(TextContextualPopupMenu.java:93) at org.openstreetmap.josm.gui.widgets.TextContextualPopupMenu.enableMenuFor(TextContextualPopupMenu.java:143) at org.openstreetmap.josm.gui.widgets.JosmTextArea.<init>(JosmTextArea.java:90) at org.openstreetmap.josm.gui.widgets.JosmTextArea.<init>(JosmTextArea.java:25) at org.openstreetmap.josm.gui.bugreport.DebugTextDisplay.<init>(DebugTextDisplay.java:29) at org.openstreetmap.josm.gui.bugreport.DebugTextDisplay.<init>(DebugTextDisplay.java:51) at org.openstreetmap.josm.gui.bugreport.BugReportDialog.<init>(BugReportDialog.java:92) at org.openstreetmap.josm.gui.bugreport.BugReportDialog.lambda$3(BugReportDialog.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
comment:8 by , 7 years ago
It seems org.openstreetmap.josm.plugins.elevation.tests.HgtReaderTest.testGetElevationFromHgt
is now failing because of this, could you please have a look?
I'm not convinced that the additional complexity brings any real benefit (e.g. I think you forgot to adapt Advanced Preferences).