source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SelectAction.java

Last change on this file was 18177, checked in by Don-vip, 5 years ago

fix #20403 - Relation editor: Enable select relation button of new relation once it is saved

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.relation.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7
8import org.openstreetmap.josm.data.osm.Relation;
9import org.openstreetmap.josm.tools.ImageProvider;
10
11/**
12 * Select the currently edited relation.
13 * @since 12933
14 */
15public class SelectAction extends AbstractRelationEditorAction {
16 private static final long serialVersionUID = 1L;
17
18 /**
19 * Constructs a new {@code SelectAction}.
20 * @param editorAccess An interface to access the relation editor contents.
21 */
22 public SelectAction(IRelationEditorActionAccess editorAccess) {
23 super(editorAccess, IRelationEditorUpdateOn.TAG_CHANGE);
24 putValue(NAME, tr("Select"));
25 putValue(SHORT_DESCRIPTION, tr("Select the currently edited relation"));
26 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true);
27 updateEnabledState();
28 }
29
30 @Override
31 public void actionPerformed(ActionEvent e) {
32 Relation toSelect = editorAccess.getEditor().getRelation();
33 if (toSelect == null)
34 return;
35 getLayer().data.setSelected(toSelect);
36 }
37
38 @Override
39 protected void updateEnabledState() {
40 setEnabled(editorAccess.getEditor().getRelationSnapshot() != null);
41 }
42}
Note: See TracBrowser for help on using the repository browser.