Ticket #23648: 23648-2.patch
File 23648-2.patch, 3.2 KB (added by , 8 months ago) |
---|
-
src/org/openstreetmap/josm/actions/SaveAction.java
91 91 @Override 92 92 protected void updateEnabledState() { 93 93 Layer activeLayer = getLayerManager().getActiveLayer(); 94 boolean en = activeLayer != null 95 && activeLayer.isSavable() && !(activeLayer.getAssociatedFile() != null 96 && activeLayer instanceof SaveToFile && !((SaveToFile) activeLayer).requiresSaveToFile()); 97 GuiHelper.runInEDT(() -> setEnabled(en)); 94 boolean en = activeLayer != null && activeLayer.isSavable(); 95 GuiHelper.runInEDT(() -> setEnabled(en)); 98 96 } 99 97 100 98 @Override -
src/org/openstreetmap/josm/actions/ToggleUploadDiscouragedLayerAction.java
11 11 import javax.swing.AbstractAction; 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; 18 import org.openstreetmap.josm.gui.util.GuiHelper; 17 19 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 18 20 import org.openstreetmap.josm.tools.ImageProvider; 19 21 … … 30 32 * @param layer the layer for which to toggle the {@linkplain OsmDataLayer#setUploadDiscouraged(boolean) discouraged upload flag} 31 33 */ 32 34 public ToggleUploadDiscouragedLayerAction(OsmDataLayer layer) { 33 super(tr("Discourage upload"));35 super(tr("Discourage/Encourage upload")); 34 36 new ImageProvider("no_upload").getResource().attachImageIcon(this, true); 35 37 this.layer = layer; 36 38 setEnabled(layer.isUploadable()); … … 40 42 @Override 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 } 45 49 -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
1195 1195 if (data.getUploadPolicy() != UploadPolicy.BLOCKED && 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); 1200 1201 }