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

Last change on this file since 14027 was 14027, checked in by michael2402, 5 weeks ago

See #16388: New mechanism for plugins to register relation editor actions.

File size: 1.3 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 memberTable member table
20     * @param memberTableModel member table model
21     * @param layer OSM data layer
22     * @param editor relation editor
23     * @param tagModel tag editor model
24     */
25    public ApplyAction(IRelationEditorActionAccess editorAccess) {
26        super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.TAG_CHANGE);
27        putValue(SHORT_DESCRIPTION, tr("Apply the current updates"));
28        new ImageProvider("save").getResource().attachImageIcon(this, true);
29        putValue(NAME, tr("Apply"));
30        updateEnabledState();       
31    }
32
33    @Override
34    public void actionPerformed(ActionEvent e) {
35        if (applyChanges()) {
36                editorAccess.getEditor().reloadDataFromRelation();
37        }
38    }
39
40    @Override
41    protected void updateEnabledState() {
42        setEnabled(isEditorDirty());
43    }
44}
Note: See TracBrowser for help on using the repository browser.