Opened 16 years ago
Closed 16 years ago
#3018 closed defect (fixed)
[PATCH] Make sure tools menu entries (and actions) are deactivated when no layer
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Core | Version: | latest |
Keywords: | Cc: | Gubaer |
Description
- Start JOSM
- Press "c" (combine way)
java.lang.NullPointerException at org.openstreetmap.josm.actions.CombineWayAction.actionPerformed(CombineWayAction.java:59) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636) at javax.swing.JComponent.processKeyBinding(JComponent.java:2851) at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:267) at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:216) at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2928) at javax.swing.JComponent.processKeyBindings(JComponent.java:2920) at javax.swing.JComponent.processKeyEvent(JComponent.java:2814) at java.awt.Component.processEvent(Component.java:6040) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668) at java.awt.Component.dispatchEventImpl(Component.java:4502) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Window.dispatchEventImpl(Window.java:2475) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Attachments (1)
Change History (14)
comment:1 by , 16 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
comment:2 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Summary: | NullPointerException when starting JOSM & pressing "C" → NullPointerException when starting JOSM & using one of the tools |
I have to say that this problem affects perhaps all tools - UnGlueAction, MergeNodesAction etc. Just load JOSM and start an action from the Tools menu.
comment:3 by , 16 years ago
Summary: | NullPointerException when starting JOSM & using one of the tools → Make sure tools menu entries (and actions) are deactivated when no layer |
---|
comment:5 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I reopen the ticket once again, because the tools/actions are not immediately activated after a layer has been created or opened. Even after drawing selected objects have to be re-selected to enable the actions.
comment:7 by , 16 years ago
Summary: | Make sure tools menu entries (and actions) are deactivated when no layer → [PATCH] Make sure tools menu entries (and actions) are deactivated when no layer |
---|
I made a patch to update the updateEnabledState function of most actions.
comment:9 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | reopened → needinfo |
The patch mainly replaces
setEnabled(getCurrentDataSet() != null && ! getCurrentDataSet().getSelected().isEmpty());
by
setEnabled(getEditLayer() != null); if (this.enabled) { setEnabled(getCurrentDataSet() != null && !getCurrentDataSet().getSelected().isEmpty()); }
in actions.
The replacement is logically equivalent with the orignal, though, it looks only more elaborated.
Am I missing something?
comment:10 by , 16 years ago
I believe I mixed up the patches - the this.enabled part shouldn't be there as I replaced all that lines by just the getEditLayer line. Nonetheless both is wrong, and best example why I haven't asked for svn access :-D
But I have another patch for a possible solution. As I couldn't find out why getCurrentDataSet().getSelected() seems to be always empty, I simply extended the updateEnabledState.
by , 16 years ago
Attachment: | JOSM.patch added |
---|
comment:11 by , 16 years ago
Nonetheless both is wrong, and best example why I haven't asked for svn access :-D
I won't apply this patch either, at least not entirely.
Most of the stuff you added is redundant. It's already working exactly the way you try to fix it. I'm therefore wondering with what JOSM version you are working. Can you explain again what you try to fix?
The patch for ReverseWayAction.java is ok, though. This OK was forgotten in the last update so your cleanup is welcome.
comment:12 by , 16 years ago
In eclipse I currently have 1826, but you can also try today's josm-latest: draw a way, switch to select mode - though the way is selected the actions in the Tools menu are still disabled. That's because in updateEnableState the result of !getCurrentDataSet().getSelected().isEmpty() is incorrectly "false".
The patch for ReverseWayAction.java is ok
Parts in PasteAction.java should also work - currently Pasting is disabled when nothing is selected.
fixed in r1817