1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.dialogs.relation.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.spi.preferences.Config;
|
---|
9 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Apply the updates and close the dialog.
|
---|
13 | */
|
---|
14 | public 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 | }
|
---|