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

Last change on this file since 17172 was 17172, checked in by GerdP, 4 years ago

see #19913: IOOBE: Index 254 out of bounds for length 0: Saving a relation, after splitting a child member with open relation editor
see #19915: Crash in relation editor when saving after undo

  • enable Refresh button when snapshot is different to data in layer
  • enable Apply button also when relation was removed by undoing the creation of it
  • move some dispose() code from RelationEditor to GenericRelationEditor
File size: 1.2 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 editorAccess An interface to access the relation editor contents.
20 */
21 public ApplyAction(IRelationEditorActionAccess editorAccess) {
22 super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE, IRelationEditorUpdateOn.TAG_CHANGE);
23 putValue(SHORT_DESCRIPTION, tr("Apply the current updates"));
24 new ImageProvider("save").getResource().attachImageIcon(this, true);
25 putValue(NAME, tr("Apply"));
26 updateEnabledState();
27 }
28
29 @Override
30 public void actionPerformed(ActionEvent e) {
31 if (applyChanges()) {
32 editorAccess.getEditor().reloadDataFromRelation();
33 }
34 }
35
36 @Override
37 public void updateEnabledState() {
38 setEnabled(isEditorDirty());
39 }
40}
Note: See TracBrowser for help on using the repository browser.