source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/OKAction.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.spi.preferences.Config;
9import org.openstreetmap.josm.tools.ImageProvider;
10
11/**
12 * Apply the updates and close the dialog.
13 */
14public class OKAction extends SavingAction {
15        private static final long serialVersionUID = 1L;
16
17    /**
18     * Constructs a new {@code OKAction}.
19     * @param memberTable member table
20     * @param memberTableModel member table model
21     * @param tagModel tag editor model
22     * @param layer OSM data layer
23     * @param editor relation editor
24     * @param tfRole role text field
25     */
26    public OKAction(IRelationEditorActionAccess editorAccess) {
27        super(editorAccess);
28        putValue(SHORT_DESCRIPTION, tr("Apply the updates and close the dialog"));
29        new ImageProvider("ok").getResource().attachImageIcon(this);
30        putValue(NAME, tr("OK"));
31        setEnabled(true);
32    }
33
34    @Override
35    public void actionPerformed(ActionEvent e) {
36        Config.getPref().put("relation.editor.generic.lastrole", tfRole.getText());
37        editorAccess.getMemberTable().stopHighlighting();
38        if (!applyChanges())
39            return;
40        hideEditor();
41    }
42}
Note: See TracBrowser for help on using the repository browser.