Ignore:
Timestamp:
2016-06-18T00:06:41+02:00 (3 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/actions
Files:
26 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) {
Note: See TracChangeset for help on using the changeset viewer.