[9665] | 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 | */
|
---|
[14027] | 14 | public class ApplyAction extends SavingAction {
|
---|
[14029] | 15 | private static final long serialVersionUID = 1L;
|
---|
[9665] | 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 | */
|
---|
[14027] | 25 | public ApplyAction(IRelationEditorActionAccess editorAccess) {
|
---|
| 26 | super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.TAG_CHANGE);
|
---|
[9665] | 27 | putValue(SHORT_DESCRIPTION, tr("Apply the current updates"));
|
---|
[13130] | 28 | new ImageProvider("save").getResource().attachImageIcon(this, true);
|
---|
[9665] | 29 | putValue(NAME, tr("Apply"));
|
---|
[14027] | 30 | updateEnabledState();
|
---|
[9665] | 31 | }
|
---|
| 32 |
|
---|
| 33 | @Override
|
---|
| 34 | public void actionPerformed(ActionEvent e) {
|
---|
| 35 | if (applyChanges()) {
|
---|
[14029] | 36 | editorAccess.getEditor().reloadDataFromRelation();
|
---|
[9665] | 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | @Override
|
---|
| 41 | protected void updateEnabledState() {
|
---|
| 42 | setEnabled(isEditorDirty());
|
---|
| 43 | }
|
---|
| 44 | }
|
---|