Ignore:
Timestamp:
2017-09-04T23:45:49+02:00 (4 years ago)
Author:
Don-vip
Message:

see #13036 - deprecate Command() default constructor, fix unit tests and java warnings

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12718 r12726  
    197197    public static UndoRedoHandler undoRedo;
    198198
     199    private static final LayerChangeListener undoRedoCleaner = new LayerChangeListener() {
     200        @Override
     201        public void layerRemoving(LayerRemoveEvent e) {
     202            Layer layer = e.getRemovedLayer();
     203            if (layer instanceof OsmDataLayer) {
     204                undoRedo.clean(((OsmDataLayer) layer).data);
     205            }
     206        }
     207
     208        @Override
     209        public void layerOrderChanged(LayerOrderChangeEvent e) {
     210            // Do nothing
     211        }
     212
     213        @Override
     214        public void layerAdded(LayerAddEvent e) {
     215            // Do nothing
     216        }
     217    };
     218
    199219    /**
    200220     * Listener that sets the enabled state of undo/redo menu entries.
     
    220240        this.mainFrame = mainFrame;
    221241        undoRedo = super.undoRedo;
    222         getLayerManager().addLayerChangeListener(new LayerChangeListener() {
    223             @Override
    224             public void layerRemoving(LayerRemoveEvent e) {
    225                 Layer layer = e.getRemovedLayer();
    226                 if (layer instanceof OsmDataLayer) {
    227                     undoRedo.clean(((OsmDataLayer) layer).data);
    228                 }
    229             }
    230 
    231             @Override
    232             public void layerOrderChanged(LayerOrderChangeEvent e) {
    233                 // Do nothing
    234             }
    235 
    236             @Override
    237             public void layerAdded(LayerAddEvent e) {
    238                 // Do nothing
    239             }
    240         });
     242        getLayerManager().addLayerChangeListener(undoRedoCleaner);
    241243    }
    242244
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r12663 r12726  
    7777import org.openstreetmap.josm.data.osm.event.DatasetEventManager;
    7878import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
     79import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    7980import org.openstreetmap.josm.data.osm.search.SearchCompiler;
    8081import org.openstreetmap.josm.data.osm.search.SearchSetting;
    81 import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
    8282import org.openstreetmap.josm.data.preferences.StringProperty;
    8383import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java

    r12718 r12726  
    103103     */
    104104    protected void applyExistingNonConflictingRelation(TagEditorModel tagEditorModel) {
    105         Relation editedRelation = new Relation(editor.getRelation());
     105        Relation originRelation = editor.getRelation();
     106        Relation editedRelation = new Relation(originRelation);
    106107        tagEditorModel.applyToPrimitive(editedRelation);
    107108        memberTableModel.applyToRelation(editedRelation);
    108         if (!editedRelation.hasEqualSemanticAttributes(editor.getRelation(), false)) {
    109             MainApplication.undoRedo.add(new ChangeCommand(editor.getRelation(), editedRelation));
     109        if (!editedRelation.hasEqualSemanticAttributes(originRelation, false)) {
     110            MainApplication.undoRedo.add(new ChangeCommand(originRelation, editedRelation));
    110111        }
    111112    }
  • trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java

    r12719 r12726  
    158158    class ChangesetReviewChangeListener implements ChangeListener {
    159159
    160         private final String key = "review_requested";
     160        private static final String KEY = "review_requested";
    161161
    162162        @Override
     
    164164            if (e.getSource() instanceof ChangesetReviewModel) {
    165165                boolean newState = ((ChangesetReviewModel) e.getSource()).isReviewRequested();
    166                 boolean oldState = "yes".equals(Optional.ofNullable(getTagEditorValue(key)).orElse(""));
     166                boolean oldState = "yes".equals(Optional.ofNullable(getTagEditorValue(KEY)).orElse(""));
    167167                if (oldState != newState) {
    168                     setProperty(key, newState ? "yes" : null);
     168                    setProperty(KEY, newState ? "yes" : null);
    169169                }
    170170            }
Note: See TracChangeset for help on using the changeset viewer.