Ignore:
Timestamp:
2017-08-24T00:15:51+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15182 - deprecate Main.map and Main.isDisplayingMapView(). Replacements: gui.MainApplication.getMap() / gui.MainApplication.isDisplayingMapView()

File:
1 edited

Legend:

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

    r12620 r12630  
    4040import org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer;
    4141import org.openstreetmap.josm.gui.ExtendedDialog;
     42import org.openstreetmap.josm.gui.MainApplication;
    4243import org.openstreetmap.josm.gui.MapFrame;
    4344import org.openstreetmap.josm.gui.MapView;
     
    209210        virtualManager.init();
    210211        // This is required to update the cursors when ctrl/shift/alt is pressed
    211         Main.map.keyDetector.addModifierExListener(this);
    212         Main.map.keyDetector.addKeyListener(this);
     212        MapFrame map = MainApplication.getMap();
     213        map.keyDetector.addModifierExListener(this);
     214        map.keyDetector.addKeyListener(this);
    213215    }
    214216
     
    220222        mv.removeMouseMotionListener(this);
    221223        mv.setVirtualNodesEnabled(false);
    222         Main.map.keyDetector.removeModifierExListener(this);
    223         Main.map.keyDetector.removeKeyListener(this);
     224        MapFrame map = MainApplication.getMap();
     225        map.keyDetector.removeModifierExListener(this);
     226        map.keyDetector.removeKeyListener(this);
    224227        removeHighlighting();
    225228    }
     
    227230    @Override
    228231    public void modifiersExChanged(int modifiers) {
    229         if (!Main.isDisplayingMapView() || oldEvent == null) return;
     232        if (!MainApplication.isDisplayingMapView() || oldEvent == null) return;
    230233        if (giveUserFeedback(oldEvent, modifiers)) {
    231234            mv.repaint();
     
    568571        startingDraggingPos = null;
    569572        mouseReleaseTime = System.currentTimeMillis();
     573        MapFrame map = MainApplication.getMap();
    570574
    571575        if (mode == Mode.SELECT) {
     
    578582            // Select Draw Tool if no selection has been made
    579583            if (!cancelDrawMode && getLayerManager().getEditDataSet().selectionEmpty()) {
    580                 Main.map.selectDrawTool(true);
     584                map.selectDrawTool(true);
    581585                updateStatusLine();
    582586                return;
     
    599603                        // We need to do it like this as otherwise drawAction will see a double
    600604                        // click and switch back to SelectMode
    601                         Main.worker.execute(() -> Main.map.selectDrawTool(true));
     605                        Main.worker.execute(() -> map.selectDrawTool(true));
    602606                        return;
    603607                    }
     
    630634    @Override
    631635    public void doKeyPressed(KeyEvent e) {
    632         if (!repeatedKeySwitchLassoOption || !Main.isDisplayingMapView() || !getShortcut().isEvent(e))
     636        if (!repeatedKeySwitchLassoOption || !MainApplication.isDisplayingMapView() || !getShortcut().isEvent(e))
    633637            return;
    634638        if (Logging.isDebugEnabled()) {
     
    636640        }
    637641        e.consume();
     642        MapFrame map = MainApplication.getMap();
    638643        if (!lassoMode) {
    639             Main.map.selectMapMode(Main.map.mapModeSelectLasso);
     644            map.selectMapMode(map.mapModeSelectLasso);
    640645        } else {
    641             Main.map.selectMapMode(Main.map.mapModeSelect);
     646            map.selectMapMode(map.mapModeSelect);
    642647        }
    643648    }
     
    751756                Collection<Way> ways = ds.getSelectedWays();
    752757                if (doesImpactStatusLine(affectedNodes, ways)) {
    753                     Main.map.statusLine.setDist(ways);
     758                    MainApplication.getMap().statusLine.setDist(ways);
    754759                }
    755760            } finally {
Note: See TracChangeset for help on using the changeset viewer.