Changeset 10446 in josm for trunk


Ignore:
Timestamp:
2016-06-21T00:58:45+02:00 (8 years ago)
Author:
Don-vip
Message:

see #13001 - replace calls to Main.main.getCurrentDataSet() by Main.getLayerManager().getEditDataSet()

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

Legend:

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

    r10413 r10446  
    325325                } else {
    326326                    lastZoomArea = -1;
    327                     Area sourceArea = Main.main.getCurrentDataSet().getDataSourceArea();
     327                    Area sourceArea = Main.getLayerManager().getEditDataSet().getDataSourceArea();
    328328                    if (sourceArea != null) {
    329329                        v.visit(new Bounds(sourceArea.getBounds2D()));
  • trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

    r10413 r10446  
    144144        }
    145145
    146         final Collection<Way> selectedWays = Main.main.getCurrentDataSet().getSelectedWays();
     146        final Collection<Way> selectedWays = Main.getLayerManager().getEditDataSet().getSelectedWays();
    147147
    148148        if (selectedWays.isEmpty()) {
     
    157157        }
    158158
    159         final Collection<Relation> selectedRelations = Main.main.getCurrentDataSet().getSelectedRelations();
     159        final Collection<Relation> selectedRelations = Main.getLayerManager().getEditDataSet().getSelectedRelations();
    160160        final Relation multipolygonRelation = update
    161161                ? getSelectedMultipolygonRelation(selectedWays, selectedRelations)
  • trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java

    r8510 r10446  
    6161                        @Override
    6262                        public void run() {
    63                             Main.main.getCurrentDataSet().setSelected(downloaded);
     63                            Main.getLayerManager().getEditDataSet().setSelected(downloaded);
    6464                        }
    6565                    });
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r10413 r10446  
    413413    @Override
    414414    public void actionPerformed(ActionEvent e) {
    415         join(Main.main.getCurrentDataSet().getSelectedWays());
     415        join(Main.getLayerManager().getEditDataSet().getSelectedWays());
    416416    }
    417417
     
    14251425        List<RelationRole> result = new ArrayList<>();
    14261426
    1427         for (Relation r : Main.main.getCurrentDataSet().getRelations()) {
     1427        for (Relation r : Main.getLayerManager().getEditDataSet().getRelations()) {
    14281428            if (r.isDeleted()) {
    14291429                continue;
  • trunk/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequencesAction.java

    r7937 r10446  
    3232    @Override
    3333    public void actionPerformed(ActionEvent ev) {
    34         DataSet ds = Main.main.getCurrentDataSet();
     34        DataSet ds = Main.getLayerManager().getEditDataSet();
    3535        SelectNonBranchingWaySequences ws = new SelectNonBranchingWaySequences(ds.getSelectedWays());
    3636        ws.extend(ds);
     
    4444    @Override
    4545    protected void updateEnabledState() {
    46         setEnabled(Main.main.getCurrentDataSet() != null);
     46        setEnabled(Main.getLayerManager().getEditDataSet() != null);
    4747    }
    4848}
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r10242 r10446  
    145145        }
    146146        if (Main.main != null) {
    147             DataSet dataset = Main.main.getCurrentDataSet();
     147            DataSet dataset = Main.getLayerManager().getEditDataSet();
    148148            if (dataset != null) {
    149149                String result = DatasetConsistencyTest.runTests(dataset);
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r10413 r10446  
    268268            return;
    269269        }
    270         APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet());
     270        APIDataSet apiData = new APIDataSet(Main.getLayerManager().getEditDataSet());
    271271        uploadData(Main.getLayerManager().getEditLayer(), apiData);
    272272    }
  • trunk/src/org/openstreetmap/josm/actions/ValidateAction.java

    r10382 r10446  
    7373        Collection<OsmPrimitive> selection;
    7474        if (getSelectedItems) {
    75             selection = Main.main.getCurrentDataSet().getAllSelected();
     75            selection = Main.getLayerManager().getEditDataSet().getAllSelected();
    7676            if (selection.isEmpty()) {
    77                 selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
     77                selection = Main.getLayerManager().getEditDataSet().allNonDeletedPrimitives();
    7878                lastSelection = null;
    7979            } else {
     
    8484        } else {
    8585            if (lastSelection == null) {
    86                 selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
     86                selection = Main.getLayerManager().getEditDataSet().allNonDeletedPrimitives();
    8787            } else {
    8888                selection = lastSelection;
     
    147147                    Main.map.validatorDialog.tree.setErrors(errors);
    148148                    Main.map.validatorDialog.unfurlDialog();
    149                     Main.main.getCurrentDataSet().fireSelectionChanged();
     149                    Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    150150                }
    151151            });
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r10409 r10446  
    336336        // let everybody else know about the current selection
    337337        //
    338         Main.main.getCurrentDataSet().fireSelectionChanged();
     338        Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    339339        lastUsedNode = null;
    340340        wayIsFinished = true;
  • trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java

    r10039 r10446  
    3939        Collection<Command> cmds = new LinkedList<>();
    4040        for (Relation orig : relations) {
    41             Command c = GenericRelationEditor.addPrimitivesToRelation(orig, Main.main.getCurrentDataSet().getSelected());
     41            Command c = GenericRelationEditor.addPrimitivesToRelation(orig, Main.getLayerManager().getEditDataSet().getSelected());
    4242            if (c != null) {
    4343                cmds.add(c);
  • trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java

    r10413 r10446  
    100100        return relation != null &&
    101101            !relation.isDeleted() &&
    102             Main.main.getCurrentDataSet().containsRelation(relation);
     102            Main.getLayerManager().getEditDataSet().containsRelation(relation);
    103103    }
    104104
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r10382 r10446  
    550550
    551551        static SearchTask newSearchTask(SearchSetting setting) {
    552             final DataSet ds = Main.main.getCurrentDataSet();
     552            final DataSet ds = Main.getLayerManager().getEditDataSet();
    553553            final Collection<OsmPrimitive> selection = new HashSet<>(ds.getAllSelected());
    554554            return new SearchTask(ds, setting, selection, new Predicate<OsmPrimitive>() {
     
    579579                Collection<OsmPrimitive> all;
    580580                if (setting.allElements) {
    581                     all = Main.main.getCurrentDataSet().allPrimitives();
     581                    all = Main.getLayerManager().getEditDataSet().allPrimitives();
    582582                } else {
    583                     all = Main.main.getCurrentDataSet().allNonDeletedCompletePrimitives();
     583                    all = Main.getLayerManager().getEditDataSet().allNonDeletedCompletePrimitives();
    584584                }
    585585                final ProgressMonitor subMonitor = getProgressMonitor().createSubTaskMonitor(all.size(), false);
  • trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java

    r8870 r10446  
    7373                            JOptionPane.ERROR_MESSAGE
    7474                    );
    75                     Main.main.getCurrentDataSet().setSelected(Collections.singleton(osmPrimitive));
     75                    Main.getLayerManager().getEditDataSet().setSelected(Collections.singleton(osmPrimitive));
    7676                    return false;
    7777                }
     
    9090                        JOptionPane.ERROR_MESSAGE
    9191                );
    92                 Main.main.getCurrentDataSet().setSelected(Collections.singleton(osmPrimitive));
     92                Main.getLayerManager().getEditDataSet().setSelected(Collections.singleton(osmPrimitive));
    9393                return false;
    9494            }
  • trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java

    r10247 r10446  
    151151            OsmValidator.initializeErrorLayer();
    152152            Main.map.validatorDialog.unfurlDialog();
    153             Main.main.getCurrentDataSet().fireSelectionChanged();
     153            Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    154154            return false;
    155155        }
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r10345 r10446  
    5959
    6060        // the command may have changed the selection so tell the listeners about the current situation
    61         DataSet ds = Main.main.getCurrentDataSet();
     61        DataSet ds = Main.getLayerManager().getEditDataSet();
    6262        if (ds != null) {
    6363            ds.fireSelectionChanged();
     
    8888        if (commands.isEmpty())
    8989            return;
    90         Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
    91         Main.main.getCurrentDataSet().beginUpdate();
     90        Collection<? extends OsmPrimitive> oldSelection = Main.getLayerManager().getEditDataSet().getSelected();
     91        Main.getLayerManager().getEditDataSet().beginUpdate();
    9292        try {
    9393            for (int i = 1; i <= num; ++i) {
     
    100100            }
    101101        } finally {
    102             Main.main.getCurrentDataSet().endUpdate();
    103         }
    104         fireCommandsChanged();
    105         Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected();
     102            Main.getLayerManager().getEditDataSet().endUpdate();
     103        }
     104        fireCommandsChanged();
     105        Collection<? extends OsmPrimitive> newSelection = Main.getLayerManager().getEditDataSet().getSelected();
    106106        if (!oldSelection.equals(newSelection)) {
    107             Main.main.getCurrentDataSet().fireSelectionChanged();
     107            Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    108108        }
    109109    }
     
    123123        if (redoCommands.isEmpty())
    124124            return;
    125         Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
     125        Collection<? extends OsmPrimitive> oldSelection = Main.getLayerManager().getEditDataSet().getSelected();
    126126        for (int i = 0; i < num; ++i) {
    127127            final Command c = redoCommands.removeFirst();
     
    133133        }
    134134        fireCommandsChanged();
    135         Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected();
     135        Collection<? extends OsmPrimitive> newSelection = Main.getLayerManager().getEditDataSet().getSelected();
    136136        if (!oldSelection.equals(newSelection)) {
    137             Main.main.getCurrentDataSet().fireSelectionChanged();
     137            Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    138138        }
    139139    }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

    r10378 r10446  
    164164        mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0);
    165165        minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0);
    166         dsArea = Main.main == null || !Main.main.hasEditLayer() ? null : Main.main.getCurrentDataSet().getDataSourceArea();
     166        dsArea = Main.main == null || !Main.main.hasEditLayer() ? null : Main.getLayerManager().getEditDataSet().getDataSourceArea();
    167167    }
    168168
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r10378 r10446  
    462462         */
    463463        private void popupCycleSelection(Collection<OsmPrimitive> osms, int mods) {
    464             DataSet ds = Main.main.getCurrentDataSet();
     464            DataSet ds = Main.getLayerManager().getEditDataSet();
    465465            // Find some items that are required for cycling through
    466466            OsmPrimitive firstItem = null;
     
    566566         */
    567567        private void popupSetLabelColors(JLabel lbl, OsmPrimitive osm) {
    568             DataSet ds = Main.main.getCurrentDataSet();
     568            DataSet ds = Main.getLayerManager().getEditDataSet();
    569569            if (ds.isSelected(osm)) {
    570570                lbl.setBackground(SystemColor.textHighlight);
     
    638638                @Override
    639639                public void mouseClicked(MouseEvent e) {
    640                     DataSet ds = Main.main.getCurrentDataSet();
     640                    DataSet ds = Main.getLayerManager().getEditDataSet();
    641641                    // Let the user toggle the selection
    642642                    ds.toggleSelected(osm);
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r10409 r10446  
    311311    @Deprecated
    312312    protected DataSet getCurrentDataSet() {
    313         return Main.main.getCurrentDataSet();
     313        return Main.getLayerManager().getEditDataSet();
    314314    }
    315315
  • trunk/src/org/openstreetmap/josm/gui/SelectionManager.java

    r10395 r10446  
    199199    @Override
    200200    public void mousePressed(MouseEvent e) {
    201         if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1 && Main.main.getCurrentDataSet() != null) {
     201        if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1 && Main.getLayerManager().getEditDataSet() != null) {
    202202            SelectByInternalPointAction.performSelection(Main.map.mapView.getEastNorth(e.getX(), e.getY()),
    203203                    (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) != 0,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r10428 r10446  
    268268            if (sel.isEmpty())
    269269                return;
    270             if (Main.main.getCurrentDataSet() == null)
    271                 return;
    272             new SelectObjectsAction().selectObjectsByChangesetIds(Main.main.getCurrentDataSet(), sel);
     270            if (Main.getLayerManager().getEditDataSet() == null)
     271                return;
     272            new SelectObjectsAction().selectObjectsByChangesetIds(Main.getLayerManager().getEditDataSet(), sel);
    273273        }
    274274
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r10413 r10446  
    460460                sel.add(o);
    461461            }
    462             DataSet ds = Main.main.getCurrentDataSet();
     462            DataSet ds = Main.getLayerManager().getEditDataSet();
    463463            if (ds != null) { // Can't see how it is possible but it happened in #7942
    464464                ds.setSelected(sel);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java

    r10217 r10446  
    7777
    7878    public void executeFilters() {
    79         DataSet ds = Main.main.getCurrentDataSet();
     79        DataSet ds = Main.getLayerManager().getEditDataSet();
    8080        boolean changed = false;
    8181        if (ds == null) {
     
    124124
    125125    public void executeFilters(Collection<? extends OsmPrimitive> primitives) {
    126         DataSet ds = Main.main.getCurrentDataSet();
     126        DataSet ds = Main.getLayerManager().getEditDataSet();
    127127        if (ds == null)
    128128            return;
     
    177177
    178178    public void clearFilterFlags() {
    179         DataSet ds = Main.main.getCurrentDataSet();
     179        DataSet ds = Main.getLayerManager().getEditDataSet();
    180180        if (ds != null) {
    181181            FilterWorker.clearFilterFlags(ds.allPrimitives());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java

    r10305 r10446  
    125125
    126126    protected static String buildMapPaintText() {
    127         final Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getAllSelected();
     127        final Collection<OsmPrimitive> sel = Main.getLayerManager().getEditDataSet().getAllSelected();
    128128        ElemStyles elemstyles = MapPaintStyles.getStyles();
    129129        NavigatableComponent nc = Main.map.mapView;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r10428 r10446  
    330330
    331331        protected void setCurrentRelationAsSelection() {
    332             Main.main.getCurrentDataSet().setSelected(displaylist.getSelectedValue());
     332            Main.getLayerManager().getEditDataSet().setSelected(displaylist.getSelectedValue());
    333333        }
    334334
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r10413 r10446  
    847847        @Override
    848848        public void actionPerformed(ActionEvent e) {
    849             Main.main.getCurrentDataSet().setSelected(sel);
     849            Main.getLayerManager().getEditDataSet().setSelected(sel);
    850850        }
    851851    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r10413 r10446  
    356356                users.add(data.get(index).user);
    357357            }
    358             Collection<OsmPrimitive> selected = Main.main.getCurrentDataSet().getAllSelected();
     358            Collection<OsmPrimitive> selected = Main.getLayerManager().getEditDataSet().getAllSelected();
    359359            Collection<OsmPrimitive> byUser = new LinkedList<>();
    360360            for (OsmPrimitive p : selected) {
     
    363363                }
    364364            }
    365             Main.main.getCurrentDataSet().setSelected(byUser);
     365            Main.getLayerManager().getEditDataSet().setSelected(byUser);
    366366        }
    367367
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r10378 r10446  
    125125            @Override
    126126            public void actionPerformed(ActionEvent e) {
    127                 final DataSet ds = Main.main.getCurrentDataSet();
     127                final DataSet ds = Main.getLayerManager().getEditDataSet();
    128128                if (ds == null) {
    129129                    return;
     
    174174    public void showNotify() {
    175175        DataSet.addSelectionListener(this);
    176         DataSet ds = Main.main.getCurrentDataSet();
     176        DataSet ds = Main.getLayerManager().getEditDataSet();
    177177        if (ds != null) {
    178178            updateSelection(ds.getAllSelected());
     
    342342            }
    343343        }
    344         DataSet ds = Main.main.getCurrentDataSet();
     344        DataSet ds = Main.getLayerManager().getEditDataSet();
    345345        if (ds != null) {
    346346            ds.setSelected(sel);
     
    479479
    480480            if (isDblClick) {
    481                 Main.main.getCurrentDataSet().setSelected(sel);
     481                Main.getLayerManager().getEditDataSet().setSelected(sel);
    482482                if (Main.pref.getBoolean("validator.autozoom", false)) {
    483483                    AutoScaleAction.zoomTo(sel);
     
    617617                    @Override
    618618                    public void run() {
    619                         Main.main.getCurrentDataSet().beginUpdate();
     619                        Main.getLayerManager().getEditDataSet().beginUpdate();
    620620                    }
    621621                });
     
    633633                        @Override
    634634                        public void run() {
    635                             Main.main.getCurrentDataSet().endUpdate();
     635                            Main.getLayerManager().getEditDataSet().endUpdate();
    636636                        }
    637637                    });
     
    644644                        Main.map.repaint();
    645645                        tree.resetErrors();
    646                         Main.main.getCurrentDataSet().fireSelectionChanged();
     646                        Main.getLayerManager().getEditDataSet().fireSelectionChanged();
    647647                    }
    648648                });
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r10422 r10446  
    609609    public void setVisible(boolean b) {
    610610        super.setVisible(b);
    611         if (b && Main.main.getCurrentDataSet() != null) {
     611        if (b && Main.getLayerManager().getEditDataSet() != null) {
    612612            updateSelection();
    613613        }
     
    14131413    public void preferenceChanged(PreferenceChangeEvent e) {
    14141414        super.preferenceChanged(e);
    1415         if ("display.discardable-keys".equals(e.getKey()) && Main.main.getCurrentDataSet() != null) {
     1415        if ("display.discardable-keys".equals(e.getKey()) && Main.getLayerManager().getEditDataSet() != null) {
    14161416            // Re-load data when display preference change
    14171417            updateSelection();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java

    r9243 r10446  
    324324            return;
    325325        clearErrors();
    326         DataSet ds = Main.main.getCurrentDataSet();
     326        DataSet ds = Main.getLayerManager().getEditDataSet();
    327327        for (TestError error : newerrors) {
    328328            if (!error.isIgnored()) {
     
    443443    private void clearErrors() {
    444444        if (errors != null) {
    445             DataSet ds = Main.main.getCurrentDataSet();
     445            DataSet ds = Main.getLayerManager().getEditDataSet();
    446446            if (ds != null) {
    447447                for (TestError e : errors) {
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java

    r10436 r10446  
    157157        // Warm about deleted primitives
    158158        final Set<PrimitiveId> del = new HashSet<>();
    159         DataSet ds = Main.main.getCurrentDataSet();
     159        DataSet ds = Main.getLayerManager().getEditDataSet();
    160160        for (PrimitiveId id : ids) {
    161161            OsmPrimitive osm = ds.getPrimitiveById(id);
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r10413 r10446  
    355355            return;
    356356        }
    357         DataSet ds = Main.main.getCurrentDataSet();
     357        DataSet ds = Main.getLayerManager().getEditDataSet();
    358358        Collection<OsmPrimitive> participants = Collections.emptyList();
    359359        if (Main.main != null && ds != null) {
     
    520520
    521521    protected final void updateEnabledState() {
    522         setEnabled(Main.main != null && Main.main.getCurrentDataSet() != null);
     522        setEnabled(Main.main != null && Main.getLayerManager().getEditDataSet() != null);
    523523    }
    524524
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java

    r10382 r10446  
    9393            TaggingPreset preset = selector.getSelectedPresetAndUpdateClassification();
    9494            if (preset != null) {
    95                 final Set<OsmPrimitive> matching = new HashSet<>(Utils.filter(Main.main.getCurrentDataSet().allPrimitives(), preset));
    96                 Main.main.getCurrentDataSet().setSelected(matching);
     95                final Set<OsmPrimitive> matching = new HashSet<>(Utils.filter(Main.getLayerManager().getEditDataSet().allPrimitives(), preset));
     96                Main.getLayerManager().getEditDataSet().setSelected(matching);
    9797            }
    9898        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java

    r10378 r10446  
    241241        boolean inTags = ckSearchInTags != null && ckSearchInTags.isSelected();
    242242
    243         DataSet ds = Main.main.getCurrentDataSet();
     243        DataSet ds = Main.getLayerManager().getEditDataSet();
    244244        Collection<OsmPrimitive> selected = (ds == null) ? Collections.<OsmPrimitive>emptyList() : ds.getSelected();
    245245        final List<PresetClassification> result = classifications.getMatchingPresets(
     
    372372                typesInSelectionDirty = false;
    373373                typesInSelection.clear();
    374                 if (Main.main == null || Main.main.getCurrentDataSet() == null) return typesInSelection;
    375                 for (OsmPrimitive primitive : Main.main.getCurrentDataSet().getSelected()) {
     374                if (Main.main == null || Main.getLayerManager().getEditDataSet() == null) return typesInSelection;
     375                for (OsmPrimitive primitive : Main.getLayerManager().getEditDataSet().getSelected()) {
    376376                    typesInSelection.add(TaggingPresetType.forPrimitive(primitive));
    377377                }
  • trunk/src/org/openstreetmap/josm/gui/util/HighlightHelper.java

    r9419 r10446  
    122122     */
    123123    public void findAllHighlighted() {
    124         DataSet ds = Main.main.getCurrentDataSet();
     124        DataSet ds = Main.getLayerManager().getEditDataSet();
    125125        if (ds != null) {
    126126            highlightedPrimitives.addAll(ds.allNonDeletedPrimitives());
     
    132132     */
    133133    public static void clearAllHighlighted() {
    134         DataSet ds = Main.main.getCurrentDataSet();
     134        DataSet ds = Main.getLayerManager().getEditDataSet();
    135135        if (ds != null) {
    136136            for (OsmPrimitive p: ds.allNonDeletedPrimitives()) {
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r9461 r10446  
    172172            gpxData = ((GpxLayer) layer).data;
    173173        } else {
    174             gpxData = OsmDataLayer.toGpxData(Main.main.getCurrentDataSet(), file);
     174            gpxData = OsmDataLayer.toGpxData(Main.getLayerManager().getEditDataSet(), file);
    175175        }
    176176
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java

    r10378 r10446  
    242242    protected void buttonAction(int buttonIndex, ActionEvent evt) {
    243243        // if layer all layers were closed, ignore all actions
    244         if (Main.main.getCurrentDataSet() != null && buttonIndex != 2) {
     244        if (Main.getLayerManager().getEditDataSet() != null && buttonIndex != 2) {
    245245            TableModel tm = propertyTable.getModel();
    246246            for (int i = 0; i < tm.getRowCount(); i++) {
     
    304304    public static void addTags(String[][] keyValue, String sender, Collection<? extends OsmPrimitive> primitives) {
    305305        if (trustedSenders.contains(sender)) {
    306             if (Main.main.getCurrentDataSet() != null) {
     306            if (Main.getLayerManager().getEditDataSet() != null) {
    307307                for (String[] row : keyValue) {
    308308                    Main.main.undoRedo.add(new ChangePropertyCommand(primitives, row[0], row[1]));
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java

    r9732 r10446  
    102102        }
    103103
    104         Main.main.getCurrentDataSet().setSelected(node);
     104        Main.getLayerManager().getEditDataSet().setSelected(node);
    105105        if (PermissionPrefWithDefault.CHANGE_VIEWPORT.isAllowed()) {
    106106            AutoScaleAction.autoScale("selection");
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java

    r10116 r10446  
    171171        commands.add(new AddCommand(way));
    172172        Main.main.undoRedo.add(new SequenceCommand(tr("Add way"), commands));
    173         Main.main.getCurrentDataSet().setSelected(way);
     173        Main.getLayerManager().getEditDataSet().setSelected(way);
    174174        if (PermissionPrefWithDefault.CHANGE_VIEWPORT.isAllowed()) {
    175175            AutoScaleAction.autoScale("selection");
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r10212 r10446  
    119119                        // find out whether some data has already been downloaded
    120120                        Area present = null;
    121                         DataSet ds = Main.main.getCurrentDataSet();
     121                        DataSet ds = Main.getLayerManager().getEditDataSet();
    122122                        if (ds != null) {
    123123                            present = ds.getDataSourceArea();
     
    158158                @Override
    159159                public void run() {
    160                     DataSet ds = Main.main.getCurrentDataSet();
     160                    DataSet ds = Main.getLayerManager().getEditDataSet();
    161161                    if (ds == null) // e.g. download failed
    162162                        return;
     
    174174                public void run() {
    175175                    Set<OsmPrimitive> newSel = new HashSet<>();
    176                     DataSet ds = Main.main.getCurrentDataSet();
     176                    DataSet ds = Main.getLayerManager().getEditDataSet();
    177177                    if (ds == null) // e.g. download failed
    178178                        return;
     
    200200                    @Override
    201201                    public void run() {
    202                         final DataSet ds = Main.main.getCurrentDataSet();
     202                        final DataSet ds = Main.getLayerManager().getEditDataSet();
    203203                        final Collection<OsmPrimitive> filteredPrimitives = Utils.filter(ds.allPrimitives(), search);
    204204                        ds.setSelected(filteredPrimitives);
     
    221221                @Override
    222222                public void run() {
    223                     if (Main.main.getCurrentDataSet() != null) {
     223                    if (Main.getLayerManager().getEditDataSet() != null) {
    224224                        if (args.containsKey("changeset_comment")) {
    225                             Main.main.getCurrentDataSet().addChangeSetTag("comment", args.get("changeset_comment"));
     225                            Main.getLayerManager().getEditDataSet().addChangeSetTag("comment", args.get("changeset_comment"));
    226226                        }
    227227                        if (args.containsKey("changeset_source")) {
    228                             Main.main.getCurrentDataSet().addChangeSetTag("source", args.get("changeset_source"));
     228                            Main.getLayerManager().getEditDataSet().addChangeSetTag("source", args.get("changeset_source"));
    229229                        }
    230230                    }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java

    r10116 r10446  
    7272                public void run() {
    7373                    final List<PrimitiveId> downloaded = task.getDownloadedId();
    74                     final DataSet ds = Main.main.getCurrentDataSet();
     74                    final DataSet ds = Main.getLayerManager().getEditDataSet();
    7575                    if (downloaded != null) {
    7676                        GuiHelper.runInEDT(new Runnable() {
Note: See TracChangeset for help on using the changeset viewer.