Changeset 15513 in josm
- Timestamp:
- 2019-11-05T22:07:11+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r15404 r15513 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.KeyEvent; 9 import java.beans.PropertyChangeListener;10 9 import java.util.LinkedList; 11 10 import java.util.List; … … 31 30 import org.openstreetmap.josm.gui.io.UploadPrimitivesTask; 32 31 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 33 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent;34 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent;35 32 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 36 33 import org.openstreetmap.josm.gui.util.GuiHelper; … … 52 49 * @author imi 53 50 */ 54 public class UploadAction extends JosmAction {51 public class UploadAction extends AbstractUploadAction { 55 52 /** 56 53 * The list of upload hooks. These hooks will be called one after the other … … 94 91 LATE_UPLOAD_HOOKS.add(new DiscardTagsHook()); 95 92 } 96 97 private final PropertyChangeListener updateOnRequireUploadChange = evt -> {98 if (OsmDataLayer.REQUIRES_UPLOAD_TO_SERVER_PROP.equals(evt.getPropertyName())) {99 updateEnabledState();100 }101 };102 93 103 94 /** … … 153 144 Shortcut.registerShortcut("file:upload", tr("File: {0}", tr("Upload data")), KeyEvent.VK_UP, Shortcut.CTRL_SHIFT), true); 154 145 setHelpId(ht("/Action/Upload")); 155 }156 157 @Override158 protected LayerChangeAdapter buildLayerChangeAdapter() {159 return new LayerChangeAdapter() {160 @Override161 public void layerAdded(LayerAddEvent e) {162 if (e.getAddedLayer() instanceof OsmDataLayer) {163 e.getAddedLayer().addPropertyChangeListener(updateOnRequireUploadChange);164 }165 super.layerAdded(e);166 }167 168 @Override169 public void layerRemoving(LayerRemoveEvent e) {170 if (e.getRemovedLayer() instanceof OsmDataLayer) {171 e.getRemovedLayer().removePropertyChangeListener(updateOnRequireUploadChange);172 }173 super.layerRemoving(e);174 }175 };176 146 } 177 147 -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r15426 r15513 40 40 * @since 2250 41 41 */ 42 public class UploadSelectionAction extends JosmAction {42 public class UploadSelectionAction extends AbstractUploadAction { 43 43 /** 44 44 * Constructs a new {@code UploadSelectionAction}.
Note:
See TracChangeset
for help on using the changeset viewer.