Modify

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

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

disableOrthogonalizeUndo.patch (1.1 KB) - added by floscher 14 months ago.

Download all attachments as: .zip

Change History (6)

Changed 14 months ago by floscher

comment:1 Changed 14 months ago by simon04

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.

comment:2 Changed 14 months ago by floscher

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 Changed 14 months ago by floscher

To clarify: The above-mentioned notification would still be shown in cases where OsmPrimitives 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 OsmPrimitives.

comment:4 Changed 14 months ago by simon04

Resolution: fixed
Status: newclosed

In 11116/josm:

fix #13766 - Disable the JosmAction Orthogonalize.Undo when nothing is selected (patch by floscher)

comment:5 Changed 14 months ago by simon04

Milestone: 16.10

Thank you!

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.