Changeset 10413 in josm for trunk/src/org


Ignore:
Timestamp:
2016-06-18T00:06:41+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #12983 - replace calls to Main.main.get[Active|Edit]Layer() by Main.getLayerManager().get[Active|Edit]Layer() - gsoc-core

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

Legend:

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

    r10383 r10413  
    7676        if (Main.main == null || !Main.main.hasEditLayer())
    7777            return;
    78         Collection<OsmPrimitive> sel = Main.main.getEditLayer().data.getSelected();
     78        Collection<OsmPrimitive> sel = Main.getLayerManager().getEditLayer().data.getSelected();
    7979        if (sel.isEmpty()) {
    8080            JOptionPane.showMessageDialog(
     
    220220     */
    221221    protected Layer getFirstSelectedLayer() {
    222         if (Main.main.getActiveLayer() == null) {
     222        if (Main.getLayerManager().getActiveLayer() == null) {
    223223            return null;
    224224        }
  • trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

    r10382 r10413  
    119119                            if (Main.pref.getBoolean("multipoly.show-relation-editor", false)) {
    120120                                //Open relation edit window, if set up in preferences
    121                                 RelationEditor editor = RelationEditor.getEditor(Main.main.getEditLayer(), relation, null);
     121                                RelationEditor editor = RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), relation, null);
    122122
    123123                                editor.setModal(true);
    124124                                editor.setVisible(true);
    125125                            } else {
    126                                 Main.main.getEditLayer().setRecentRelation(relation);
     126                                Main.getLayerManager().getEditLayer().setRecentRelation(relation);
    127127                            }
    128128                        }
     
    165165        if (multipolygonRelation != null) {
    166166            if (!multipolygonRelation.isNew() && multipolygonRelation.isIncomplete()) {
    167                 Main.worker.submit(new DownloadRelationTask(Collections.singleton(multipolygonRelation), Main.main.getEditLayer()));
     167                Main.worker.submit(new DownloadRelationTask(Collections.singleton(multipolygonRelation), Main.getLayerManager().getEditLayer()));
    168168            } else if (multipolygonRelation.hasIncompleteMembers()) {
    169169                Main.worker.submit(new DownloadRelationMemberTask(multipolygonRelation,
    170170                        DownloadSelectedIncompleteMembersAction.buildSetOfIncompleteMembers(Collections.singleton(multipolygonRelation)),
    171                         Main.main.getEditLayer()));
     171                        Main.getLayerManager().getEditLayer()));
    172172            }
    173173        }
  • trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java

    r10318 r10413  
    3030    @Override
    3131    public void actionPerformed(ActionEvent e) {
    32         Layer activeLayer = Main.main.getActiveLayer();
     32        Layer activeLayer = Main.getLayerManager().getActiveLayer();
    3333        if (activeLayer == null) {
    3434            return;
  • trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java

    r10409 r10413  
    5252        if (!isEnabled())
    5353            return;
    54         OsmDataLayer layer = Main.main.getEditLayer();
     54        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    5555        if (layer == null)
    5656            return;
  • trunk/src/org/openstreetmap/josm/actions/FollowLineAction.java

    r10409 r10413  
    6060    @Override
    6161    public void actionPerformed(ActionEvent evt) {
    62         OsmDataLayer osmLayer = Main.main.getEditLayer();
     62        OsmDataLayer osmLayer = Main.getLayerManager().getEditLayer();
    6363        if (osmLayer == null)
    6464            return;
  • trunk/src/org/openstreetmap/josm/actions/InfoAction.java

    r10382 r10413  
    3737        DataSet set = getLayerManager().getEditDataSet();
    3838        if (set != null) {
    39             new InspectPrimitiveDialog(set.getAllSelected(), Main.main.getEditLayer()).showDialog();
     39            new InspectPrimitiveDialog(set.getAllSelected(), Main.getLayerManager().getEditLayer()).showDialog();
    4040        }
    4141    }
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r10409 r10413  
    636636        // Delete the discarded inner ways
    637637        if (!discardedWays.isEmpty()) {
    638             Command deleteCmd = DeleteCommand.delete(Main.main.getEditLayer(), discardedWays, true);
     638            Command deleteCmd = DeleteCommand.delete(Main.getLayerManager().getEditLayer(), discardedWays, true);
    639639            if (deleteCmd != null) {
    640640                cmds.add(deleteCmd);
  • trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java

    r10318 r10413  
    115115
    116116    protected Layer getSourceLayer() {
    117         return Main.map != null ? Main.main.getActiveLayer() : null;
     117        return Main.map != null ? Main.getLayerManager().getActiveLayer() : null;
    118118    }
    119119
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r10382 r10413  
    8787        Node targetNode = selectTargetNode(selectedNodes);
    8888        Node targetLocationNode = selectTargetLocationNode(selectedNodes);
    89         Command cmd = mergeNodes(Main.main.getEditLayer(), selectedNodes, targetNode, targetLocationNode);
     89        Command cmd = mergeNodes(Main.getLayerManager().getEditLayer(), selectedNodes, targetNode, targetLocationNode);
    9090        if (cmd != null) {
    9191            Main.main.undoRedo.add(cmd);
    92             Main.main.getEditLayer().data.setSelected(targetNode);
     92            Main.getLayerManager().getEditLayer().data.setSelected(targetNode);
    9393        }
    9494    }
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r10382 r10413  
    145145            if (data instanceof NodeData) {
    146146                NodeData nodeData = (NodeData) data;
    147                 if (Main.main.getEditLayer() == source) {
     147                if (Main.getLayerManager().getEditLayer() == source) {
    148148                    nodeData.setEastNorth(nodeData.getEastNorth().add(offsetEast, offsetNorth));
    149149                }
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r10382 r10413  
    9696
    9797        Collection<OsmPrimitive> sel = getLayerManager().getEditDataSet().getAllSelected();
    98         layer = Main.main.getEditLayer();
     98        layer = Main.getLayerManager().getEditLayer();
    9999
    100100        toPurge = new HashSet<>(sel);
     
    218218        }
    219219
    220         Main.main.undoRedo.add(new PurgeCommand(Main.main.getEditLayer(), toPurgeChecked, makeIncomplete));
     220        Main.main.undoRedo.add(new PurgeCommand(Main.getLayerManager().getEditLayer(), toPurgeChecked, makeIncomplete));
    221221
    222222        if (clearUndoRedo) {
  • trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java

    r10382 r10413  
    4444        try {
    4545            DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE);
    46             Main.main.getEditLayer().mergeFrom(ds);
     46            Main.getLayerManager().getEditLayer().mergeFrom(ds);
    4747        } catch (OsmTransferException e) {
    4848            ExceptionDialogUtil.explainException(e);
     
    5858     */
    5959    public static void updatePrimitives(final Collection<OsmPrimitive> selection) {
    60         UpdatePrimitivesTask task = new UpdatePrimitivesTask(Main.main.getEditLayer(), selection);
     60        UpdatePrimitivesTask task = new UpdatePrimitivesTask(Main.getLayerManager().getEditLayer(), selection);
    6161        Main.worker.submit(task);
    6262    }
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r10382 r10413  
    269269        }
    270270        APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet());
    271         uploadData(Main.main.getEditLayer(), apiData);
     271        uploadData(Main.getLayerManager().getEditLayer(), apiData);
    272272    }
    273273}
  • trunk/src/org/openstreetmap/josm/actions/ZoomToAction.java

    r10386 r10413  
    8282
    8383    protected final void updateEnabledState() {
    84         if (Main.main == null || Main.main.getEditLayer() != this.table.getLayer()) {
     84        if (Main.main == null || Main.getLayerManager().getEditLayer() != this.table.getLayer()) {
    8585            setEnabled(false);
    8686            putValue(SHORT_DESCRIPTION, descriptionInactiveLayer);
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r10409 r10413  
    214214        protected OsmDataLayer getEditLayer() {
    215215            if (!Main.isDisplayingMapView()) return null;
    216             return Main.main.getEditLayer();
     216            return Main.getLayerManager().getEditLayer();
    217217        }
    218218
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java

    r10318 r10413  
    297297                }
    298298            }
    299             final OsmDataLayer editLayer = Main.main.getEditLayer();
     299            final OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    300300            if (editLayer != null && osmData) {
    301301                final Set<OsmPrimitive> myPrimitives = getCompletePrimitives(editLayer.data);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r10382 r10413  
    708708        Node targetNode = MergeNodesAction.selectTargetNode(changedNodes);
    709709        Node locNode = MergeNodesAction.selectTargetLocationNode(changedNodes);
    710         Command mergeCmd = MergeNodesAction.mergeNodes(Main.main.getEditLayer(), changedNodes, targetNode, locNode);
     710        Command mergeCmd = MergeNodesAction.mergeNodes(Main.getLayerManager().getEditLayer(), changedNodes, targetNode, locNode);
    711711        if (mergeCmd != null) {
    712712            Main.main.undoRedo.add(mergeCmd);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r10383 r10413  
    920920        Collection<Node> nodesToMerge = new LinkedList<>(selNodes);
    921921        nodesToMerge.add(target);
    922         mergeNodes(Main.main.getEditLayer(), nodesToMerge, target);
     922        mergeNodes(Main.getLayerManager().getEditLayer(), nodesToMerge, target);
    923923    }
    924924
  • trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java

    r9472 r10413  
    3030        if (toDelete == null)
    3131            return;
    32         DeleteAction.deleteRelations(Main.main.getEditLayer(), toDelete);
     32        DeleteAction.deleteRelations(Main.getLayerManager().getEditLayer(), toDelete);
    3333        // clear selection after deletion
    3434        if (Main.map.relationListDialog != null)
  • trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java

    r9059 r10413  
    3636    public void actionPerformed(ActionEvent e) {
    3737        if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return;
    38         Main.worker.submit(new DownloadRelationTask(relations, Main.main.getEditLayer()));
     38        Main.worker.submit(new DownloadRelationTask(relations, Main.getLayerManager().getEditLayer()));
    3939    }
    4040
  • trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java

    r9059 r10413  
    5959                relations,
    6060                incompleteMembers,
    61                 Main.main.getEditLayer()));
     61                Main.getLayerManager().getEditLayer()));
    6262    }
    6363
  • trunk/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java

    r8510 r10413  
    3434        copy.setModified(true);
    3535        RelationEditor editor = RelationEditor.getEditor(
    36                 Main.main.getEditLayer(),
     36                Main.getLayerManager().getEditLayer(),
    3737                copy,
    3838                null /* no selected members */
  • trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java

    r10378 r10413  
    4343        Set<RelationMember> members = new HashSet<>();
    4444        if (Main.isDisplayingMapView()) {
    45             OsmDataLayer editLayer = Main.main.getEditLayer();
     45            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    4646            if (editLayer != null && editLayer.data != null) {
    4747                Collection<OsmPrimitive> selection = editLayer.data.getSelected();
     
    6262    public static void launchEditor(Relation toEdit) {
    6363        if (toEdit == null || toEdit.isDeleted() || !Main.isDisplayingMapView()) return;
    64         RelationEditor.getEditor(Main.main.getEditLayer(), toEdit,
     64        RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), toEdit,
    6565                getMembersForCurrentSelection(toEdit)).setVisible(true);
    6666    }
  • trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java

    r10345 r10413  
    140140        if (!Main.isDisplayingMapView())
    141141            return Collections.emptyList();
    142         Layer activeLayer = Main.main.getActiveLayer();
     142        Layer activeLayer = Main.getLayerManager().getActiveLayer();
    143143        if (!(activeLayer instanceof OsmDataLayer)) {
    144144            return Collections.emptyList();
  • trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java

    r8510 r10413  
    4343        }
    4444        if (add) {
    45             Main.main.getEditLayer().data.addSelected(members);
     45            Main.getLayerManager().getEditLayer().data.addSelected(members);
    4646        } else {
    47             Main.main.getEditLayer().data.setSelected(members);
     47            Main.getLayerManager().getEditLayer().data.setSelected(members);
    4848        }
    4949    }
  • trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java

    r8510 r10413  
    3434    public void actionPerformed(ActionEvent e) {
    3535        if (!isEnabled() || relations.isEmpty()) return;
    36         OsmDataLayer editLayer = Main.main.getEditLayer();
     36        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    3737        if (editLayer == null || editLayer.data == null) return;
    3838        if (add) {
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r10248 r10413  
    131131     */
    132132    public Command() {
    133         this.layer = Main.main == null ? null : Main.main.getEditLayer();
     133        this.layer = Main.getLayerManager().getEditLayer();
    134134    }
    135135
  • trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java

    r10364 r10413  
    8484
    8585        Main.getLayerManager().setActiveLayer(layer);
    86         OsmDataLayer editLayer = Main.main.getEditLayer();
     86        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    8787
    8888        // restore the former state
  • trunk/src/org/openstreetmap/josm/data/validation/Test.java

    r9989 r10413  
    333333        }
    334334        if (!primitivesToDelete.isEmpty()) {
    335             return DeleteCommand.delete(Main.main.getEditLayer(), primitivesToDelete);
     335            return DeleteCommand.delete(Main.getLayerManager().getEditLayer(), primitivesToDelete);
    336336        } else {
    337337            return null;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r9971 r10413  
    409409
    410410            if (DeleteCommand.checkAndConfirmOutlyingDelete(nodes, Collections.singleton(target)))
    411                 return MergeNodesAction.mergeNodes(Main.main.getEditLayer(), nodes, target);
     411                return MergeNodesAction.mergeNodes(Main.getLayerManager().getEditLayer(), nodes, target);
    412412        }
    413413
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolver.java

    r10369 r10413  
    196196    public void prepareForEditing() {
    197197        AutoCompletionList acList = new AutoCompletionList();
    198         Main.main.getEditLayer().data.getAutoCompletionManager().populateWithMemberRoles(acList);
     198        Main.getLayerManager().getEditLayer().data.getAutoCompletionManager().populateWithMemberRoles(acList);
    199199        tfRole.setAutoCompletionList(acList);
    200200        AutoCompletingTextField editor = (AutoCompletingTextField) tblResolver.getColumnModel().getColumn(2).getCellEditor();
     
    203203        }
    204204        AutoCompletionList acList2 = new AutoCompletionList();
    205         Main.main.getEditLayer().data.getAutoCompletionManager().populateWithKeys(acList2);
     205        Main.getLayerManager().getEditLayer().data.getAutoCompletionManager().populateWithKeys(acList2);
    206206        tfKey.setAutoCompletionList(acList2);
    207207    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java

    r10332 r10413  
    121121        ChangesetCache.getInstance().addChangesetCacheListener(inActiveDataLayerModel);
    122122        Main.getLayerManager().addActiveLayerChangeListener(inActiveDataLayerModel);
    123         OsmDataLayer editLayer = Main.main.getEditLayer();
     123        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    124124        if (editLayer != null) {
    125125            editLayer.data.addDataSetListener(inActiveDataLayerModel);
     
    134134        ChangesetCache.getInstance().removeChangesetCacheListener(inActiveDataLayerModel);
    135135        Main.getLayerManager().removeActiveLayerChangeListener(inActiveDataLayerModel);
    136         OsmDataLayer editLayer = Main.main.getEditLayer();
     136        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    137137        if (editLayer != null) {
    138138            editLayer.data.removeDataSetListener(inActiveDataLayerModel);
     
    237237
    238238    protected void initWithCurrentData() {
    239         OsmDataLayer editLayer = Main.main.getEditLayer();
     239        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    240240        if (editLayer != null) {
    241241            inSelectionModel.initFromPrimitives(editLayer.data.getAllSelected());
     
    323323                return;
    324324
    325             DataSet ds = Main.main.getEditLayer().data;
     325            DataSet ds = Main.getLayerManager().getEditLayer().data;
    326326            selectObjectsByChangesetIds(ds, sel);
    327327        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java

    r10369 r10413  
    345345    protected static FilteredCollection<? extends OsmPrimitive> getAffectedPrimitives(TreePath path) {
    346346        PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand();
    347         final OsmDataLayer currentLayer = Main.main.getEditLayer();
     347        final OsmDataLayer currentLayer = Main.getLayerManager().getEditLayer();
    348348        return new FilteredCollection<>(
    349349                c.getParticipatingPrimitives(),
     
    389389                throw new IllegalStateException();
    390390
    391             OsmDataLayer editLayer = Main.main.getEditLayer();
     391            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    392392            if (editLayer == null) return;
    393393            editLayer.data.setSelected(getAffectedPrimitives(path));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r10378 r10413  
    234234     */
    235235    public void refreshView() {
    236         OsmDataLayer editLayer = Main.main.getEditLayer();
     236        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    237237        conflicts = editLayer == null ? new ConflictCollection() : editLayer.getConflicts();
    238238        GuiHelper.runInEDT(new Runnable() {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r10386 r10413  
    362362
    363363        public void run() {
    364             RelationEditor.getEditor(Main.main.getEditLayer(), null, null).setVisible(true);
     364            RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), null, null).setVisible(true);
    365365        }
    366366
     
    694694    @Override
    695695    public void dataChanged(DataChangedEvent event) {
    696         initFromLayer(Main.main.getEditLayer());
     696        initFromLayer(Main.getLayerManager().getEditLayer());
    697697    }
    698698
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r10383 r10413  
    212212            if (idx < 0) return;
    213213            if (isDoubleClick(e)) {
    214                 OsmDataLayer layer = Main.main.getEditLayer();
     214                OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    215215                if (layer == null) return;
    216216                OsmPrimitive osm = model.getElementAt(idx);
     
    335335            Collection<OsmPrimitive> sel = model.getSelected();
    336336            if (sel.isEmpty()) return;
    337             OsmDataLayer editLayer = Main.main.getEditLayer();
     337            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    338338            if (editLayer == null) return;
    339339            editLayer.data.setSelected(sel);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java

    r10378 r10413  
    144144    public void showDialog() {
    145145        super.showDialog();
    146         Layer layer = Main.main.getActiveLayer();
     146        Layer layer = Main.getLayerManager().getActiveLayer();
    147147        if (layer instanceof OsmDataLayer) {
    148148            refresh(((OsmDataLayer) layer).data.getAllSelected());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java

    r10332 r10413  
    198198                        + "edit layer ''{0}''.</html>",
    199199                        primitives.size(),
    200                         Main.main.getEditLayer().getName()
     200                        Main.getLayerManager().getEditLayer().getName()
    201201                ),
    202202                title, JOptionPane.WARNING_MESSAGE, helpTopic
     
    336336                return null;
    337337            }
    338             OsmDataLayer layer = Main.main.getEditLayer();
     338            OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    339339            Set<OsmPrimitive> target = new HashSet<>();
    340340            for (HistoryOsmPrimitive p : model.getSelectedPrimitives()) {
     
    386386                return;
    387387            }
    388             Main.main.getEditLayer().data.setSelected(target);
     388            Main.getLayerManager().getEditLayer().data.setSelected(target);
    389389        }
    390390    }
     
    409409                return;
    410410            }
    411             Main.main.getEditLayer().data.setSelected(target);
     411            Main.getLayerManager().getEditLayer().data.setSelected(target);
    412412            AutoScaleAction.zoomToSelection();
    413413        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java

    r10378 r10413  
    335335                            + "edit layer ''{1}''.</html>",
    336336                            currentChangeset.getId(),
    337                             Main.main.getEditLayer().getName()
     337                            Main.getLayerManager().getEditLayer().getName()
    338338                    ),
    339339                    tr("Nothing to select"),
     
    348348                return;
    349349            if (Main.main == null || !Main.main.hasEditLayer()) return;
    350             OsmDataLayer layer = Main.main.getEditLayer();
     350            OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    351351            Set<OsmPrimitive> target = new HashSet<>();
    352352            for (OsmPrimitive p: layer.data.allPrimitives()) {
     
    396396                            + "edit layer ''{1}''.</html>",
    397397                            currentChangeset.getId(),
    398                             Main.main.getEditLayer().getName()
     398                            Main.getLayerManager().getEditLayer().getName()
    399399                    ),
    400400                    tr("Nothing to zoom to"),
     
    409409                return;
    410410            if (Main.main == null || !Main.main.hasEditLayer()) return;
    411             OsmDataLayer layer = Main.main.getEditLayer();
     411            OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    412412            Set<OsmPrimitive> target = new HashSet<>();
    413413            for (OsmPrimitive p: layer.data.allPrimitives()) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r10345 r10413  
    563563        Main.map.relationListDialog.selectRelation(relation);
    564564        RelationEditor.getEditor(
    565                 Main.main.getEditLayer(),
     565                Main.getLayerManager().getEditLayer(),
    566566                relation,
    567567                ((MemberInfo) membershipData.getValueAt(row, 1)).role
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r10378 r10413  
    419419            mainPanel.add(p, BorderLayout.CENTER);
    420420
    421             AutoCompletionManager autocomplete = Main.main.getEditLayer().data.getAutoCompletionManager();
     421            AutoCompletionManager autocomplete = Main.getLayerManager().getEditLayer().data.getAutoCompletionManager();
    422422            List<AutoCompletionListItem> keyList = autocomplete.getKeys();
    423423            Collections.sort(keyList, defaultACItemComparator);
     
    676676                +"<br><br>"+tr("Please select a key")), GBC.eol().fill(GBC.HORIZONTAL));
    677677
    678             AutoCompletionManager autocomplete = Main.main.getEditLayer().data.getAutoCompletionManager();
     678            AutoCompletionManager autocomplete = Main.getLayerManager().getEditLayer().data.getAutoCompletionManager();
    679679            List<AutoCompletionListItem> keyList = autocomplete.getKeys();
    680680
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java

    r10386 r10413  
    235235        private void updateEnabledState() {
    236236            setEnabled(Main.main != null
    237                     && Main.main.getEditLayer() == getLayer()
     237                    && Main.getLayerManager().getEditLayer() == getLayer()
    238238                    && getSelectedRowCount() == 1
    239239                    && hasGap());
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r10089 r10413  
    108108    @Override
    109109    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    110         if (Main.main.getEditLayer() != this.layer) return;
     110        if (Main.getLayerManager().getEditLayer() != this.layer) return;
    111111        // just trigger a repaint
    112112        Collection<RelationMember> sel = getSelectedMembers();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java

    r10212 r10413  
    3131 *  final ParentRelationLoadingTask task = new ParentRelationLoadingTask(
    3232 *                   child,   // the child relation
    33  *                   Main.main.getEditLayer(), // the edit layer
     33 *                   Main.getLayerManager().getEditLayer(), // the edit layer
    3434 *                   true,  // load fully
    3535 *                   new PleaseWaitProgressMonitor()  // a progress monitor
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java

    r10378 r10413  
    135135                return;
    136136            }
    137             DataSetMerger visitor = new DataSetMerger(Main.main.getEditLayer().data, ds);
     137            DataSetMerger visitor = new DataSetMerger(Main.getLayerManager().getEditLayer().data, ds);
    138138            visitor.merge();
    139139            if (!visitor.getConflicts().isEmpty()) {
    140                 Main.main.getEditLayer().getConflicts().add(visitor.getConflicts());
     140                Main.getLayerManager().getEditLayer().getConflicts().add(visitor.getConflicts());
    141141            }
    142142            final RelationTreeModel model = (RelationTreeModel) getModel();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java

    r10378 r10413  
    6262    @Override
    6363    public int getRowCount() {
    64         if (Main.main.getEditLayer() != layer)
     64        if (Main.getLayerManager().getEditLayer() != layer)
    6565            return 0;
    6666        return cache.size();
     
    104104    @Override
    105105    public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
    106         if (layer == Main.main.getEditLayer()) {
     106        if (layer == Main.getLayerManager().getEditLayer()) {
    107107            cache.clear();
    108108            cache.addAll(newSelection);
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r10378 r10413  
    106106
    107107        if (Main.main != null) {
    108             OsmDataLayer editLayer = Main.main.getEditLayer();
     108            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    109109            if (editLayer != null) {
    110110                editLayer.data.addDataSetListener(this);
     
    174174        if (history.getNumVersions() > 0) {
    175175            HistoryOsmPrimitive newLatest = null;
    176             OsmDataLayer editLayer = Main.main.getEditLayer();
     176            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    177177            if (editLayer != null) {
    178178                OsmPrimitive p = editLayer.data.getPrimitiveById(history.getId(), history.getType());
     
    532532            if (latest == null)
    533533                return null;
    534             OsmDataLayer editLayer = Main.main.getEditLayer();
     534            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    535535            if (editLayer == null)
    536536                return null;
     
    666666     */
    667667    public void unlinkAsListener() {
    668         OsmDataLayer editLayer = Main.main.getEditLayer();
     668        OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    669669        if (editLayer != null) {
    670670            editLayer.data.removeDataSetListener(this);
  • trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java

    r10210 r10413  
    243243            OsmPrimitive p = getPrimitiveToZoom();
    244244            if (p != null) {
    245                 OsmDataLayer editLayer = Main.main.getEditLayer();
     245                OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    246246                if (editLayer != null) {
    247247                    editLayer.data.setSelected(p.getPrimitiveId());
     
    259259            if (primitiveId == null)
    260260                return null;
    261             OsmDataLayer editLayer = Main.main.getEditLayer();
     261            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    262262            if (editLayer == null)
    263263                return null;
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r10378 r10413  
    149149        String text;
    150150        if (isLatest) {
    151             OsmDataLayer editLayer = Main.main.getEditLayer();
     151            OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
    152152            text = tr("<html>Version <strong>{0}</strong> currently edited in layer ''{1}''</html>",
    153153                    Long.toString(version),
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java

    r10378 r10413  
    7979        // FIXME: should now about the layer this task is running for. might
    8080        // be different from the current edit layer
    81         OsmDataLayer layer = Main.main.getEditLayer();
     81        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    8282        if (layer == null)
    8383            throw new IllegalStateException(tr("Failed to update primitive with id {0} because current edit layer is null", id));
     
    268268        );
    269269        if (ret == 0) {
    270             DownloadReferrersAction.downloadReferrers(Main.main.getEditLayer(), Arrays.asList(conflict.a));
     270            DownloadReferrersAction.downloadReferrers(Main.getLayerManager().getEditLayer(), Arrays.asList(conflict.a));
    271271        }
    272272    }
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java

    r8840 r10413  
    129129
    130130        // Append downloaded data to JOSM
    131         OsmDataLayer layer = Main.main.getEditLayer();
     131        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    132132        if (layer == null || this.newLayer)
    133133            Main.main.addLayer(tmpLayer);
  • trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java

    r10210 r10413  
    9797     */
    9898    public void startUserInput() {
    99         pnlTagEditor.initAutoCompletion(Main.main.getEditLayer());
     99        pnlTagEditor.initAutoCompletion(Main.getLayerManager().getEditLayer());
    100100    }
    101101
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r10369 r10413  
    389389                @Override
    390390                public void run() {
    391                     RelationEditor.getEditor(Main.main.getEditLayer(), r, members).setVisible(true);
     391                    RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), r, members).setVisible(true);
    392392                }
    393393            });
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java

    r10212 r10413  
    4141    protected void initAutoCompletionField(AutoCompletingTextField field, List<String> keys) {
    4242        if (Main.main == null) return;
    43         OsmDataLayer layer = Main.main.getEditLayer();
     43        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    4444        if (layer == null) {
    4545            return;
Note: See TracChangeset for help on using the changeset viewer.