- Timestamp:
- 2024-06-19T05:42:07+02:00 (5 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SaveAction.java
r18287 r19116 23 23 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 24 24 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 25 import org.openstreetmap.josm.gui.layer.SaveToFile;26 import org.openstreetmap.josm.gui.util.GuiHelper;27 25 import org.openstreetmap.josm.spi.preferences.Config; 28 26 import org.openstreetmap.josm.tools.GBC; … … 90 88 91 89 @Override 92 protected void updateEnabledState() {93 Layer activeLayer = getLayerManager().getActiveLayer();94 boolean en = activeLayer != null95 && activeLayer.isSavable() && !(activeLayer.getAssociatedFile() != null96 && activeLayer instanceof SaveToFile && !((SaveToFile) activeLayer).requiresSaveToFile());97 GuiHelper.runInEDT(() -> setEnabled(en));98 }99 100 @Override101 90 public File getFile(Layer layer) { 102 91 File f = layer.getAssociatedFile(); -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r18135 r19116 23 23 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 24 24 import org.openstreetmap.josm.gui.layer.Layer; 25 import org.openstreetmap.josm.gui.layer.SaveToFile; 25 26 import org.openstreetmap.josm.gui.util.GuiHelper; 26 27 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; … … 183 184 184 185 @Override 185 protected void updateEnabledState() {186 protected final void updateEnabledState() { 186 187 Layer activeLayer = getLayerManager().getActiveLayer(); 187 setEnabled(activeLayer != null && activeLayer.isSavable()); 188 boolean en = activeLayer != null && activeLayer.isSavable(); 189 // see #12669 and #23648 190 if (en && this instanceof SaveAction && activeLayer instanceof SaveToFile) { 191 en = activeLayer.getAssociatedFile() == null || ((SaveToFile) activeLayer).requiresSaveToFile(); 192 } 193 setEnabled(en); 188 194 } 189 195 -
trunk/src/org/openstreetmap/josm/actions/ToggleUploadDiscouragedLayerAction.java
r13130 r19116 12 12 import javax.swing.JCheckBoxMenuItem; 13 13 14 import org.openstreetmap.josm.gui.Notification; 14 15 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 15 16 import org.openstreetmap.josm.gui.layer.Layer; 16 17 import org.openstreetmap.josm.gui.layer.Layer.LayerAction; 17 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 19 import org.openstreetmap.josm.gui.util.GuiHelper; 18 20 import org.openstreetmap.josm.tools.ImageProvider; 19 21 … … 41 43 public void actionPerformed(ActionEvent e) { 42 44 layer.setUploadDiscouraged(!layer.isUploadDiscouraged()); 45 String msg = layer.isUploadDiscouraged() ? tr("Upload is discouraged") : tr("Upload is encouraged"); 46 GuiHelper.runInEDT(() -> new Notification(msg).show()); 43 47 LayerListDialog.getInstance().repaint(); 44 48 } -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r18753 r19116 1196 1196 (uploadDiscouraged ^ isUploadDiscouraged())) { 1197 1197 data.setUploadPolicy(uploadDiscouraged ? UploadPolicy.DISCOURAGED : UploadPolicy.NORMAL); 1198 setRequiresSaveToFile(true); 1198 1199 for (LayerStateChangeListener l : layerStateChangeListeners) { 1199 1200 l.uploadDiscouragedChanged(this, uploadDiscouraged);
Note:
See TracChangeset
for help on using the changeset viewer.