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

Last change on this file was 36102, checked in by taylor.smock, 2 years ago

reltoolbox: Clean up a bunch of lint warnings

File size: 1.4 KB
RevLine 
[32395]1// License: GPL. For details, see LICENSE file.
[25649]2package relcontext.actions;
3
[25682]4import static org.openstreetmap.josm.tools.I18n.tr;
[32395]5
[25649]6import java.awt.event.ActionEvent;
[32395]7
[25649]8import javax.swing.AbstractAction;
[32395]9
[25649]10import org.openstreetmap.josm.data.osm.Relation;
[33530]11import org.openstreetmap.josm.gui.MainApplication;
[25649]12import org.openstreetmap.josm.gui.dialogs.relation.RelationEditor;
[25682]13import org.openstreetmap.josm.tools.ImageProvider;
[32395]14
[25649]15import relcontext.ChosenRelation;
16import relcontext.ChosenRelationListener;
17
18/**
19 * Opens an editor for chosen relation.
[32395]20 *
[25649]21 * @author Zverik
22 */
23public class EditChosenRelationAction extends AbstractAction implements ChosenRelationListener {
[36102]24 private final ChosenRelation rel;
[25649]25
[32395]26 public EditChosenRelationAction(ChosenRelation rel) {
[35529]27 putValue(SMALL_ICON, ImageProvider.get("dialogs", "edit", ImageProvider.ImageSizes.SMALLICON));
[25695]28 putValue(SHORT_DESCRIPTION, tr("Open relation editor for the chosen relation"));
[25667]29 this.rel = rel;
30 rel.addChosenRelationListener(this);
[25711]31 setEnabled(rel.get() != null);
[25667]32 }
[25649]33
[32395]34 @Override
35 public void actionPerformed(ActionEvent e) {
[25649]36 Relation relation = rel.get();
[32398]37 if (relation == null) return;
[33530]38 RelationEditor.getEditor(MainApplication.getLayerManager().getEditLayer(), relation, null).setVisible(true);
[25667]39 }
[25649]40
[32395]41 @Override
42 public void chosenRelationChanged(Relation oldRelation, Relation newRelation) {
[25667]43 setEnabled(newRelation != null);
44 }
[25649]45}
Note: See TracBrowser for help on using the repository browser.