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

Last change on this file was 36483, checked in by stoecker, 3 months ago

set eol-style, fix checkstyle issues, add ignores

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