#13766 closed defect (fixed)
[PATCH] Disable the JosmAction Orthogonalize.Undo when nothing is selected
Reported by: | floscher | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 16.10 |
Component: | Core | Version: | latest |
Keywords: | Cc: |
Description
Currently (version 11088) a NullPointerException
occurs, when you have no OsmDataLayer
open and press Shift+Q
.
The reason for that is, that the JosmAction
Orthogonalize.Undo
is always active, but its actionPerformed(e)
method assumes, there is always an edit layer. If there is none, it throws a NullPointerException.
This patch fixes this behaviour by letting this action implement the methods updateEnabledState()
and updateEnabledState(Collection<? extends OsmPrimitive> selection)
. So now the action is only active, when an edit layer exists and at minimum one OsmPrimitive
is selected.
Attachments (1)
Change History (6)
by , 8 years ago
Attachment: | disableOrthogonalizeUndo.patch added |
---|
comment:1 by , 8 years ago
comment:2 by , 8 years ago
I tried to align the action with the behaviour of other actions. E.g. the OrthogonalizeAction
, AlignInCircleAction
, AlignInLineAction
, DistributeAction
and many more also don't show a notification when nothing is selected.
I think for these actions it is clear to the user that nothing happens, if nothing is selected.
comment:3 by , 8 years ago
To clarify: The above-mentioned notification would still be shown in cases where OsmPrimitive
s are selected, which have not been orthogonalized before.
The only case where it was shown previously, but won't be shown after this patch, would be when an OsmDataLayer
exists, but contains no selected OsmPrimitive
s.
The disadvantage of disabling the Undo action on an empty selection is that the usage notification
"Please select nodes that were moved by the previous Orthogonalize Shape action!"
is not being shown.