source: josm/trunk/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java@ 3092

Last change on this file since 3092 was 3092, checked in by Gubaer, 14 years ago

fixed #4681: Open Street Bug Plugin Crashed

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.KeyEvent;
8import java.util.Collection;
9
10import org.openstreetmap.josm.data.osm.OsmPrimitive;
11import org.openstreetmap.josm.tools.Shortcut;
12
13/**
14 * This action synchronizes a set of primitives with their state on the server.
15 *
16 */
17public class UpdateModifiedAction extends UpdateSelectionAction {
18
19 /**
20 * constructor
21 */
22 public UpdateModifiedAction() {
23 super(tr("Update modified"),
24 "updatemodified",
25 tr("Updates the currently modified objects from the server (re-downloads data)"),
26 Shortcut.registerShortcut("file:updatemodified",
27 tr("Update modified"),
28 KeyEvent.VK_M,
29 Shortcut.GROUP_HOTKEY + Shortcut.GROUPS_ALT2),
30 true);
31 putValue("help", ht("/Action/UpdateModified"));
32 }
33
34 // FIXME: overrides the behaviour of UpdateSelectionAction. Doesn't update
35 // the enabled state based on the current selection because
36 // it doesn't depend on it.
37 // The action should be enabled/disabled based on whether there is a least
38 // one modified object in the current dataset. Unfortunately, there is no
39 // efficient way to find out here. getDataSet().allModifiedPrimitives() is
40 // too heavy weight because it loops over the whole dataset.
41 // Perhaps this action should be a DataSetListener? Or it could listen to the
42 // REQUIRES_SAVE_TO_DISK_PROP and REQUIRES_UPLOAD_TO_SERVER_PROP properties
43 // in the OsmLayer?
44 //
45 @Override
46 protected void updateEnabledState() {
47 setEnabled(getCurrentDataSet() != null);
48 }
49
50 @Override
51 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
52 }
53}
Note: See TracBrowser for help on using the repository browser.