source: josm/trunk/src/org/openstreetmap/josm/actions/DeleteAction.java@ 10247

Last change on this file since 10247 was 7434, checked in by Don-vip, 10 years ago

fix #8885 (see #4614) - add offline mode with new command line argument --offline which can take one of several of these values (comma separated):

  • josm_website: to disable all accesses to JOSM website (when not cached, disables Getting Started page, help, plugin list, styles, imagery, presets, rules)
  • osm_api: to disable all accesses to OSM API (disables download, upload, changeset queries, history, user message notification)
  • all: alias to disable all values. Currently equivalent to "josm_website,osm_api"

Plus improved javadoc, fixed EDT violations, and fixed a bug with HTTP redirection sent without "Location" header

  • Property svn:eol-style set to native
File size: 1.5 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.ActionEvent;
8import java.awt.event.KeyEvent;
9import java.util.Collection;
10
11import org.openstreetmap.josm.Main;
12import org.openstreetmap.josm.data.osm.OsmPrimitive;
13import org.openstreetmap.josm.tools.Shortcut;
14
15/**
16 * Action that deletes selected objects.
17 * @since 770
18 */
19public final class DeleteAction extends JosmAction {
20
21 /**
22 * Constructs a new {@code DeleteAction}.
23 */
24 public DeleteAction() {
25 super(tr("Delete"), "dialogs/delete", tr("Delete selected objects."),
26 Shortcut.registerShortcut("system:delete", tr("Edit: {0}", tr("Delete")), KeyEvent.VK_DELETE, Shortcut.DIRECT), true);
27 putValue("help", ht("/Action/Delete"));
28 }
29
30 @Override
31 public void actionPerformed(ActionEvent e) {
32 if (!isEnabled() || !Main.map.mapView.isActiveLayerVisible())
33 return;
34 org.openstreetmap.josm.actions.mapmode.DeleteAction.doActionPerformed(e);
35 }
36
37 @Override
38 protected void updateEnabledState() {
39 if (getCurrentDataSet() == null) {
40 setEnabled(false);
41 } else {
42 updateEnabledState(getCurrentDataSet().getSelected());
43 }
44 }
45
46 @Override
47 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
48 setEnabled(selection != null && !selection.isEmpty());
49 }
50}
Note: See TracBrowser for help on using the repository browser.