source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/ApplyAction.java@ 18413

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

fix #21825: delete non-useful relations

This offers to delete relations when users have either removed all
members or all tags.

File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.relation.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7
8import org.openstreetmap.josm.tools.ImageProvider;
9
10/**
11 * Apply the current updates.
12 * @since 9496
13 */
14public class ApplyAction extends SavingAction {
15 private static final long serialVersionUID = 1L;
16
17 /**
18 * Constructs a new {@code ApplyAction}.
19 * @param editorAccess An interface to access the relation editor contents.
20 */
21 public ApplyAction(IRelationEditorActionAccess editorAccess) {
22 super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.TAG_CHANGE);
23 putValue(SHORT_DESCRIPTION, tr("Apply the current updates"));
24 new ImageProvider("save").getResource().attachImageIcon(this, true);
25 putValue(NAME, tr("Apply"));
26 updateEnabledState();
27 }
28
29 @Override
30 public void actionPerformed(ActionEvent e) {
31 if (applyChanges()) {
32 editorAccess.getEditor().reloadDataFromRelation();
33 }
34 }
35
36 @Override
37 public void updateEnabledState() {
38 setEnabled(this.editorAccess.getChangedRelation().isUseful() && isEditorDirty());
39 }
40}
Note: See TracBrowser for help on using the repository browser.