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