source: osm/applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SelectRelationAction.java

Last change on this file was 36102, checked in by taylor.smock, 15 months ago

reltoolbox: Clean up a bunch of lint warnings

File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package relcontext.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7
8import javax.swing.AbstractAction;
9
10import org.openstreetmap.josm.data.osm.Relation;
11import org.openstreetmap.josm.gui.MainApplication;
12import org.openstreetmap.josm.tools.ImageProvider;
13
14import relcontext.ChosenRelation;
15import relcontext.ChosenRelationListener;
16
17public class SelectRelationAction extends AbstractAction implements ChosenRelationListener {
18 private final ChosenRelation rel;
19
20 public SelectRelationAction(ChosenRelation rel) {
21 super(tr("Select relation"));
22 putValue(SHORT_DESCRIPTION, tr("Select relation in main selection."));
23 putValue(SMALL_ICON, ImageProvider.get("dialogs", "select"));
24 this.rel = rel;
25 rel.addChosenRelationListener(this);
26 setEnabled(rel.get() != null);
27 }
28
29 @Override
30 public void actionPerformed(ActionEvent e) {
31 MainApplication.getLayerManager().getEditLayer().data.setSelected(rel.get() == null ? null : rel.get());
32 }
33
34 @Override
35 public void chosenRelationChanged(Relation oldRelation, Relation newRelation) {
36 setEnabled(newRelation != null);
37 }
38}
Note: See TracBrowser for help on using the repository browser.