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.tools.ImageProvider;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Apply the current updates.
|
---|
12 | * @since 9496
|
---|
13 | */
|
---|
14 | public 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 | }
|
---|