Ticket #6250: undoSelection_v3.2.patch

File undoSelection_v3.2.patch, 3.1 KB (added by akks, 13 years ago)
  • org/openstreetmap/josm/actions/PurgeAction.java

     
    207207
    208208        if (cbClearUndoRedo.isSelected()) {
    209209            Main.main.undoRedo.clean();
    210             Main.map.selectionListDialog.clearSelectionHistory();
     210            getCurrentDataSet().clearSelectionHistory();
    211211        }
    212212    }
    213213
  • org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

     
    221221        return arrowButton;
    222222    }
    223223
    224     public void clearSelectionHistory() {
    225         model.clearSelectionHistory();
    226     }
    227224
    228225    /**
    229226     * Responds to double clicks on the list of selected objects
     
    481478
    482479        private static final int SELECTION_HISTORY_SIZE = 10;
    483480
    484         private final LinkedList<Collection<? extends OsmPrimitive>> history = new LinkedList<Collection<? extends OsmPrimitive>>();
     481        // Variable to store history from currentDataSet()
     482        private LinkedList<Collection<? extends OsmPrimitive>> history;
    485483        private final List<OsmPrimitive> selection = new ArrayList<OsmPrimitive>();
    486484        private DefaultListSelectionModel selectionModel;
    487485
     
    548546            return history;
    549547        }
    550548
    551         public void clearSelectionHistory() {
    552             history.clear();
    553         }
    554 
    555549        public Object getElementAt(int index) {
    556550            return selection.get(index);
    557551        }
     
    689683        public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
    690684            if (newLayer == null) {
    691685                setJOSMSelection(null);
     686                history = null;
    692687            } else {
     688                history = newLayer.data.getSelectionHistory();
    693689                setJOSMSelection(newLayer.data.getSelected());
    694690            }
    695691        }
  • org/openstreetmap/josm/data/osm/DataSet.java

     
    133133    }
    134134
    135135    /**
     136     * History of selections - shared by plugins and SelectionListDialog
     137     */
     138    private final LinkedList<Collection<? extends OsmPrimitive>> selectionHistory = new LinkedList<Collection<? extends OsmPrimitive>>();
     139
     140    /**
     141     * Replies the history of JOSM selections
     142     *
     143     * @return
     144     */
     145    public LinkedList<Collection<? extends OsmPrimitive>> getSelectionHistory() {
     146        return selectionHistory;
     147    }
     148
     149    /**
     150     * Clears selection history list
     151     */
     152    public void clearSelectionHistory() {
     153            selectionHistory.clear();
     154        }
     155
     156    /**
    136157     * Maintain a list of used tags for autocompletion
    137158     */
    138159    private AutoCompletionManager autocomplete;