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

Last change on this file since 28857 was 25711, checked in by zverik, 14 years ago

context menu for relations, selected relations in relation list (reltoolbox plugin)

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