Ticket #23648: 23648-2.patch

File 23648-2.patch, 3.2 KB (added by GerdP, 8 months ago)
  • src/org/openstreetmap/josm/actions/SaveAction.java

     
    9191    @Override
    9292    protected void updateEnabledState() {
    9393        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));
    9896    }
    9997
    10098    @Override
  • src/org/openstreetmap/josm/actions/ToggleUploadDiscouragedLayerAction.java

     
    1111import javax.swing.AbstractAction;
    1212import javax.swing.JCheckBoxMenuItem;
    1313
     14import org.openstreetmap.josm.gui.Notification;
    1415import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    1516import org.openstreetmap.josm.gui.layer.Layer;
    1617import org.openstreetmap.josm.gui.layer.Layer.LayerAction;
     18import org.openstreetmap.josm.gui.util.GuiHelper;
    1719import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1820import org.openstreetmap.josm.tools.ImageProvider;
    1921
     
    3032     * @param layer the layer for which to toggle the {@linkplain OsmDataLayer#setUploadDiscouraged(boolean) discouraged upload flag}
    3133     */
    3234    public ToggleUploadDiscouragedLayerAction(OsmDataLayer layer) {
    33         super(tr("Discourage upload"));
     35        super(tr("Discourage/Encourage upload"));
    3436        new ImageProvider("no_upload").getResource().attachImageIcon(this, true);
    3537        this.layer = layer;
    3638        setEnabled(layer.isUploadable());
     
    4042    @Override
    4143    public void actionPerformed(ActionEvent e) {
    4244        layer.setUploadDiscouraged(!layer.isUploadDiscouraged());
     45                String msg = layer.isUploadDiscouraged() ? tr("Upload is discouraged") : tr("Upload is encouraged");
     46                GuiHelper.runInEDT(() -> new Notification(msg).show());
    4347        LayerListDialog.getInstance().repaint();
    4448    }
    4549
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

     
    11951195        if (data.getUploadPolicy() != UploadPolicy.BLOCKED &&
    11961196                (uploadDiscouraged ^ isUploadDiscouraged())) {
    11971197            data.setUploadPolicy(uploadDiscouraged ? UploadPolicy.DISCOURAGED : UploadPolicy.NORMAL);
     1198            setRequiresSaveToFile(true);
    11981199            for (LayerStateChangeListener l : layerStateChangeListeners) {
    11991200                l.uploadDiscouragedChanged(this, uploadDiscouraged);
    12001201            }