Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years 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 8 years ago.

Download all attachments as: .zip

Change History (6)

by floscher, 8 years ago

comment:1 by simon04, 8 years ago

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 by floscher, 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 floscher, 8 years ago

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 by simon04, 8 years ago

Resolution: fixed
Status: newclosed

In 11116/josm:

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

comment:5 by simon04, 8 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.