Modify

Opened 4 weeks ago

Closed 4 weeks ago

Last modified 3 weeks ago

#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)

plugin-prefs.patch (22.1 KB) - added by bastiK 4 weeks ago.

Download all attachments as: .zip

Change History (10)

Changed 4 weeks ago by bastiK

Attachment: plugin-prefs.patch added

comment:1 Changed 4 weeks ago by stoecker

I'm not convinced that the additional complexity brings any real benefit (e.g. I think you forgot to adapt Advanced Preferences).

comment:2 Changed 4 weeks ago by bastiK

Resolution: fixed
Status: newclosed

In 13021/josm:

make Preferences more generic (see #15229, closes #15451)

  • extract base directories
  • move updateSystemProperties() as it is specific to JOSM-core as a "prefefences client"

comment:3 in reply to:  1 Changed 4 weeks ago by bastiK

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:4 Changed 4 weeks ago by bastiK

In 13022/josm:

see #15451 - fix taginfo script

comment:5 Changed 4 weeks ago by bastiK

In 13023/josm:

see #15451 - fix initialization

comment:6 Changed 4 weeks ago by Don-vip

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:7 Changed 4 weeks ago by bastiK

In 13025/josm:

see #15451 - fix wiring

comment:8 Changed 3 weeks ago by Don-vip

It seems org.openstreetmap.josm.plugins.elevation.tests.HgtReaderTest.testGetElevationFromHgt is now failing because of this, could you please have a look?

comment:9 Changed 3 weeks ago by bastiK

Should be fixed in [o33744].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.