Changeset 5360 in josm


Ignore:
Timestamp:
2012-07-25T00:33:41+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7776 - Selection of deleted objects

Location:
trunk/src/org/openstreetmap/josm
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java

    r4942 r5360  
    116116
    117117    protected void launchInfoBrowsersForSelectedPrimitives() {
    118         ArrayList<OsmPrimitive> primitivesToShow = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected());
     118        ArrayList<OsmPrimitive> primitivesToShow = new ArrayList<OsmPrimitive>(getCurrentDataSet().getAllSelected());
    119119
    120120        // filter out new primitives which are not yet uploaded to the server
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

    r4982 r5360  
    3131                DataSet set = getCurrentDataSet();
    3232                if (set != null) {
    33                         HistoryBrowserDialogManager.getInstance().showHistory(set.getSelected());
     33                        HistoryBrowserDialogManager.getInstance().showHistory(set.getAllSelected());
    3434                }
    3535        }
     
    4040                        setEnabled(false);
    4141                } else {
    42                         updateEnabledState(getCurrentDataSet().getSelected());
     42                        updateEnabledState(getCurrentDataSet().getAllSelected());
    4343                }
    4444        }
  • trunk/src/org/openstreetmap/josm/actions/InfoAction.java

    r4982 r5360  
    3030        DataSet set = getCurrentDataSet();
    3131                if (set != null) {
    32                         new InspectPrimitiveDialog(set.getSelected(), Main.map.mapView.getEditLayer()).showDialog();
     32                        new InspectPrimitiveDialog(set.getAllSelected(), Main.map.mapView.getEditLayer()).showDialog();
    3333                }
    3434    }
     
    3939            setEnabled(false);
    4040        } else {
    41             updateEnabledState(getCurrentDataSet().getSelected());
     41            updateEnabledState(getCurrentDataSet().getAllSelected());
    4242        }
    4343    }
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r5265 r5360  
    6161        if (!isEnabled())
    6262            return;
    63         Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
     63        Collection<OsmPrimitive> selection = getCurrentDataSet().getAllSelected();
    6464        List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class);
    6565
     
    330330            setEnabled(false);
    331331        } else {
    332             updateEnabledState(getCurrentDataSet().getSelected());
     332            updateEnabledState(getCurrentDataSet().getAllSelected());
    333333        }
    334334    }
  • trunk/src/org/openstreetmap/josm/actions/MergeSelectionAction.java

    r5233 r5360  
    4040            return;
    4141        if (getEditLayer().isUploadDiscouraged() && targetLayer instanceof OsmDataLayer && !((OsmDataLayer)targetLayer).isUploadDiscouraged()
    42                 && getEditLayer().data.getSelected().size() > 1) {
     42                && getEditLayer().data.getAllSelected().size() > 1) {
    4343            if (warnMergingUploadDiscouragedObjects(targetLayer)) {
    4444                return;
     
    5050
    5151    public void actionPerformed(ActionEvent e) {
    52         if (getEditLayer() == null || getEditLayer().data.getSelected().isEmpty())
     52        if (getEditLayer() == null || getEditLayer().data.getAllSelected().isEmpty())
    5353            return;
    5454        mergeSelected(getEditLayer().data);
     
    6060            setEnabled(false);
    6161        } else {
    62             updateEnabledState(getCurrentDataSet().getSelected());
     62            updateEnabledState(getCurrentDataSet().getAllSelected());
    6363        }
    6464    }
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r4982 r5360  
    8989            return;
    9090
    91         Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected();
     91        Collection<OsmPrimitive> sel = getCurrentDataSet().getAllSelected();
    9292        layer = Main.map.mapView.getEditLayer();
    9393
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r5266 r5360  
    102102            setEnabled(false);
    103103        } else {
    104             updateEnabledState(getCurrentDataSet().getSelected());
     104            updateEnabledState(getCurrentDataSet().getAllSelected());
    105105        }
    106106    }
     
    131131
    132132    public Collection<OsmPrimitive> getData() {
    133         return getCurrentDataSet().getSelected();
     133        return getCurrentDataSet().getAllSelected();
    134134    }
    135135}
  • trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java

    r5025 r5360  
    5454            setEnabled(false);
    5555        } else {
    56             updateEnabledState(getCurrentDataSet().getSelected());
     56            updateEnabledState(getCurrentDataSet().getAllSelected());
    5757        }
    5858    }
     
    9595        UploadHullBuilder builder = new UploadHullBuilder();
    9696        UploadSelectionDialog dialog = new UploadSelectionDialog();
    97         Collection<OsmPrimitive> modifiedCandidates = getModifiedPrimitives(getEditLayer().data.getSelected());
     97        Collection<OsmPrimitive> modifiedCandidates = getModifiedPrimitives(getEditLayer().data.getAllSelected());
    9898        Collection<OsmPrimitive> deletedCandidates = getDeletedPrimitives(getEditLayer().data);
    9999        if (modifiedCandidates.isEmpty() && deletedCandidates.isEmpty()) {
  • trunk/src/org/openstreetmap/josm/actions/ValidateAction.java

    r4982 r5360  
    7676        Collection<OsmPrimitive> selection;
    7777        if (getSelectedItems) {
    78             selection = Main.main.getCurrentDataSet().getSelected();
     78            selection = Main.main.getCurrentDataSet().getAllSelected();
    7979            if (selection.isEmpty()) {
    8080                selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r5198 r5360  
    584584
    585585        final DataSet ds = Main.main.getCurrentDataSet();
    586         Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>(ds.getSelected());
     586        Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>(ds.getAllSelected());
    587587        int foundMatches = getSelection(s, sel, new Function(){
    588588            public Boolean isSomething(OsmPrimitive o){
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r5266 r5360  
    438438     */
    439439    public void fireSelectionChanged(){
    440         Collection<? extends OsmPrimitive> currentSelection = getSelected();
     440        Collection<? extends OsmPrimitive> currentSelection = getAllSelected();
    441441        for (SelectionChangedListener l : selListeners) {
    442442            l.selectionChanged(currentSelection);
     
    479479    /**
    480480     * Replies an unmodifiable collection of primitives currently selected
    481      * in this dataset. May be empty, but not null.
     481     * in this dataset, except deleted ones. May be empty, but not null.
    482482     *
    483483     * @return unmodifiable collection of primitives
    484484     */
    485485    public Collection<OsmPrimitive> getSelected() {
     486        return new SubclassFilteredCollection<OsmPrimitive, OsmPrimitive>(getAllSelected(), OsmPrimitive.nonDeletedPredicate);
     487    }
     488   
     489    /**
     490     * Replies an unmodifiable collection of primitives currently selected
     491     * in this dataset, including deleted ones. May be empty, but not null.
     492     *
     493     * @return unmodifiable collection of primitives
     494     */
     495    public Collection<OsmPrimitive> getAllSelected() {
    486496        Collection<OsmPrimitive> currentList;
    487497        synchronized (selectionLock) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r5266 r5360  
    5252
    5353    protected boolean isInSelectionBase(OsmPrimitive primitive) {
    54         return selectionBase.getSelected().contains(primitive);
     54        return selectionBase.getAllSelected().contains(primitive);
    5555    }
    5656
     
    184184
    185185    public DataSet build() {
    186         for (OsmPrimitive primitive: selectionBase.getSelected()) {
     186        for (OsmPrimitive primitive: selectionBase.getAllSelected()) {
    187187            primitive.visit(this);
    188188        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r4459 r5360  
    127127            Main.main.getEditLayer().data.addDataSetListener(inActiveDataLayerModel);
    128128            inActiveDataLayerModel.initFromDataSet(Main.main.getEditLayer().data);
    129             inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getSelected());
     129            inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getAllSelected());
    130130        }
    131131    }
     
    234234    protected void initWithCurrentData() {
    235235        if (Main.main.getEditLayer() != null) {
    236             inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getSelected());
     236            inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getAllSelected());
    237237            inActiveDataLayerModel.initFromDataSet(Main.main.getEditLayer().data);
    238238        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r5200 r5360  
    121121            model.selectionChanged(null);
    122122        } else {
    123             model.selectionChanged(Main.main.getCurrentDataSet().getSelected());
     123            model.selectionChanged(Main.main.getCurrentDataSet().getAllSelected());
    124124        }
    125125    }
     
    197197            if (Main.main.getCurrentDataSet() == null)
    198198                return;
    199             for (OsmPrimitive primitive: Main.main.getCurrentDataSet().getSelected()) {
     199            for (OsmPrimitive primitive: Main.main.getCurrentDataSet().getAllSelected()) {
    200200                if (primitive.isNew()) {
    201201                    continue;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java

    r5328 r5360  
    319319
    320320    protected void createMapPaintText() {
    321         final Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected();
     321        final Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getAllSelected();
    322322        ElemStyles elemstyles = MapPaintStyles.getStyles();
    323323        NavigatableComponent nc = Main.map.mapView;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r5266 r5360  
    161161        model.editLayerChanged(null, Main.map.mapView.getEditLayer());
    162162        if (Main.map.mapView.getEditLayer() != null) {
    163             model.setJOSMSelection(Main.map.mapView.getEditLayer().data.getSelected());
     163            model.setJOSMSelection(Main.map.mapView.getEditLayer().data.getAllSelected());
    164164        }
    165165        actSearch.updateEnabledState();
     
    664664            } else {
    665665                history = newLayer.data.getSelectionHistory();
    666                 setJOSMSelection(newLayer.data.getSelected());
     666                setJOSMSelection(newLayer.data.getAllSelected());
    667667            }
    668668        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r4982 r5360  
    136136    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    137137        if (newLayer instanceof OsmDataLayer) {
    138             refresh(((OsmDataLayer) newLayer).data.getSelected());
     138            refresh(((OsmDataLayer) newLayer).data.getAllSelected());
    139139        } else {
    140140            refresh(null);
     
    165165        Layer layer = Main.main.getActiveLayer();
    166166        if (layer instanceof OsmDataLayer) {
    167             refresh(((OsmDataLayer)layer).data.getSelected());
     167            refresh(((OsmDataLayer)layer).data.getAllSelected());
    168168        }
    169169
     
    275275            Layer layer = Main.main.getActiveLayer();
    276276            if (layer instanceof OsmDataLayer) {
    277                 refresh(((OsmDataLayer)layer).data.getSelected());
     277                refresh(((OsmDataLayer)layer).data.getAllSelected());
    278278            }
    279279            setEnabled(false);
     
    390390                users.add(data.get(index).user);
    391391            }
    392             Collection<OsmPrimitive> selected = Main.main.getCurrentDataSet().getSelected();
     392            Collection<OsmPrimitive> selected = Main.main.getCurrentDataSet().getAllSelected();
    393393            Collection<OsmPrimitive> byUser = new LinkedList<OsmPrimitive>();
    394394            for (OsmPrimitive p : selected) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r5287 r5360  
    168168        DataSet ds = Main.main.getCurrentDataSet();
    169169        if (ds != null) {
    170             updateSelection(ds.getSelected());
     170            updateSelection(ds.getAllSelected());
    171171        }
    172172        MapView.addLayerChangeListener(this);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetInSelectionListModel.java

    r3083 r5360  
    3030            setChangesets(null);
    3131        } else {
    32             initFromPrimitives((newLayer).data.getSelected());
     32            initFromPrimitives((newLayer).data.getAllSelected());
    3333        }
    3434    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java

    r3416 r5360  
    6464        }
    6565        if (newLayer == layer) {
    66             cache.addAll(((OsmDataLayer)newLayer).data.getSelected());
     66            cache.addAll(((OsmDataLayer)newLayer).data.getAllSelected());
    6767        }
    6868        fireTableDataChanged();
     
    102102     */
    103103    protected void populateSelectedPrimitives(OsmDataLayer layer) {
    104         selectionChanged(layer.data.getSelected());
     104        selectionChanged(layer.data.getAllSelected());
    105105    }
    106106
Note: See TracChangeset for help on using the changeset viewer.