Last change
on this file since 26811 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 | |
---|
1 | package relcontext.actions;
|
---|
2 |
|
---|
3 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
4 | import java.awt.event.ActionEvent;
|
---|
5 | import javax.swing.AbstractAction;
|
---|
6 | import org.openstreetmap.josm.Main;
|
---|
7 | import org.openstreetmap.josm.command.DeleteCommand;
|
---|
8 | import org.openstreetmap.josm.data.osm.Relation;
|
---|
9 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
10 | import relcontext.ChosenRelation;
|
---|
11 | import relcontext.ChosenRelationListener;
|
---|
12 |
|
---|
13 | public class DeleteChosenRelationAction extends AbstractAction implements ChosenRelationListener {
|
---|
14 | private ChosenRelation rel;
|
---|
15 |
|
---|
16 | public DeleteChosenRelationAction( ChosenRelation rel ) {
|
---|
17 | super(tr("Delete relation"));
|
---|
18 | putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
|
---|
19 | this.rel = rel;
|
---|
20 | rel.addChosenRelationListener(this);
|
---|
21 | setEnabled(rel.get() != null);
|
---|
22 | }
|
---|
23 |
|
---|
24 | public void actionPerformed( ActionEvent e ) {
|
---|
25 | Relation r = rel.get();
|
---|
26 | rel.clear();
|
---|
27 | Main.main.undoRedo.add(new DeleteCommand(r));
|
---|
28 | }
|
---|
29 |
|
---|
30 | public void chosenRelationChanged( Relation oldRelation, Relation newRelation ) {
|
---|
31 | setEnabled(newRelation != null);
|
---|
32 | }
|
---|
33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.