Changeset 12636 in josm for trunk/test/unit


Ignore:
Timestamp:
2017-08-24T22:53:50+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15182 - deprecate Main.getLayerManager(). Replacement: gui.MainApplication.getLayerManager()

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
59 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r12569 r12636  
    146146    private void setupGUI() {
    147147        JOSMTestRules.cleanLayerEnvironment();
    148         assertTrue(Main.getLayerManager().getLayers().isEmpty());
    149         assertNull(Main.getLayerManager().getEditLayer());
    150         assertNull(Main.getLayerManager().getActiveLayer());
     148        assertTrue(MainApplication.getLayerManager().getLayers().isEmpty());
     149        assertNull(MainApplication.getLayerManager().getEditLayer());
     150        assertNull(MainApplication.getLayerManager().getActiveLayer());
    151151
    152152        initContentPane();
     
    163163        }
    164164        // Add a test layer to the layer manager to get the MapFrame
    165         Main.getLayerManager().addLayer(new TestLayer());
     165        MainApplication.getLayerManager().addLayer(new TestLayer());
    166166    }
    167167
     
    188188    public static void initMainPanel(boolean reAddListeners) {
    189189        if (Main.mainPanel == null) {
    190             Main.mainPanel = new MainPanel(Main.getLayerManager());
     190            Main.mainPanel = new MainPanel(MainApplication.getLayerManager());
    191191        }
    192192        if (reAddListeners) {
  • trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    r12562 r12636  
    1313import org.junit.Rule;
    1414import org.junit.Test;
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.TestUtils;
    1716import org.openstreetmap.josm.data.imagery.ImageryInfo;
     17import org.openstreetmap.josm.gui.MainApplication;
    1818import org.openstreetmap.josm.gui.layer.TMSLayer;
    1919import org.openstreetmap.josm.gui.layer.WMSLayer;
     
    5858    @Test
    5959    public void testActionPerformedEnabledTms() {
    60         assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
     60        assertTrue(MainApplication.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
    6161        new AddImageryLayerAction(new ImageryInfo("foo_tms", "http://bar", "tms", null, null)).actionPerformed(null);
    62         List<TMSLayer> tmsLayers = Main.getLayerManager().getLayersOfType(TMSLayer.class);
     62        List<TMSLayer> tmsLayers = MainApplication.getLayerManager().getLayersOfType(TMSLayer.class);
    6363        assertEquals(1, tmsLayers.size());
    64         Main.getLayerManager().removeLayer(tmsLayers.get(0));
     64        MainApplication.getLayerManager().removeLayer(tmsLayers.get(0));
    6565    }
    6666
     
    7777        new AddImageryLayerAction(new ImageryInfo("localhost", "http://localhost:" + wireMockRule.port() + "/wms?",
    7878                "wms_endpoint", null, null)).actionPerformed(null);
    79         List<WMSLayer> wmsLayers = Main.getLayerManager().getLayersOfType(WMSLayer.class);
     79        List<WMSLayer> wmsLayers = MainApplication.getLayerManager().getLayersOfType(WMSLayer.class);
    8080        assertEquals(1, wmsLayers.size());
    8181
    82         Main.getLayerManager().removeLayer(wmsLayers.get(0));
     82        MainApplication.getLayerManager().removeLayer(wmsLayers.get(0));
    8383    }
    8484
     
    8888    @Test
    8989    public void testActionPerformedDisabled() {
    90         assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
     90        assertTrue(MainApplication.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
    9191        try {
    9292            new AddImageryLayerAction(new ImageryInfo("foo")).actionPerformed(null);
     
    9494            assertEquals("Parameter 'info.url' must not be null", expected.getMessage());
    9595        }
    96         assertTrue(Main.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
     96        assertTrue(MainApplication.getLayerManager().getLayersOfType(TMSLayer.class).isEmpty());
    9797    }
    9898}
  • trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java

    r12632 r12636  
    1616import org.openstreetmap.josm.data.osm.Node;
    1717import org.openstreetmap.josm.data.osm.Way;
     18import org.openstreetmap.josm.gui.MainApplication;
    1819import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1920import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    6869
    6970        try {
    70             Main.getLayerManager().addLayer(layer);
     71            MainApplication.getLayerManager().addLayer(layer);
    7172
    7273            // Create an open way.
     
    7980        } finally {
    8081            // Ensure we clean the place before leaving, even if test fails.
    81             Main.getLayerManager().removeLayer(layer);
     82            MainApplication.getLayerManager().removeLayer(layer);
    8283        }
    8384
     
    109110
    110111        try {
    111             Main.getLayerManager().addLayer(layer);
     112            MainApplication.getLayerManager().addLayer(layer);
    112113
    113114            // Create a closed way.
     
    119120        } finally {
    120121            // Ensure we clean the place before leaving, even if test fails.
    121             Main.getLayerManager().removeLayer(layer);
     122            MainApplication.getLayerManager().removeLayer(layer);
    122123        }
    123124
     
    150151
    151152        try {
    152             Main.getLayerManager().addLayer(layer);
     153            MainApplication.getLayerManager().addLayer(layer);
    153154
    154155            // Create 2 ways.
     
    163164        } finally {
    164165            // Ensure we clean the place before leaving, even if test fails.
    165             Main.getLayerManager().removeLayer(layer);
     166            MainApplication.getLayerManager().removeLayer(layer);
    166167        }
    167168
  • trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java

    r10604 r12636  
    1717import org.junit.Rule;
    1818import org.junit.Test;
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.data.coor.LatLon;
    2120import org.openstreetmap.josm.data.osm.DataSet;
    2221import org.openstreetmap.josm.data.osm.Node;
    2322import org.openstreetmap.josm.data.osm.Way;
     23import org.openstreetmap.josm.gui.MainApplication;
    2424import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    2525import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
     
    6666        assertTrue(action.warningShown);
    6767
    68         Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "test", null));
     68        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "test", null));
    6969        action.warningShown = false;
    7070
     
    9797        data.setSelected(way);
    9898
    99         Main.getLayerManager().addLayer(new OsmDataLayer(data, "test", null));
     99        MainApplication.getLayerManager().addLayer(new OsmDataLayer(data, "test", null));
    100100
    101101        CopyAction action = new CopyAction() {
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r12632 r12636  
    1111import org.junit.Rule;
    1212import org.junit.Test;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.data.coor.EastNorth;
    1514import org.openstreetmap.josm.data.coor.LatLon;
     
    1817import org.openstreetmap.josm.data.osm.Node;
    1918import org.openstreetmap.josm.data.osm.Way;
     19import org.openstreetmap.josm.gui.MainApplication;
    2020import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2121import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    6767        action.setEnabled(true);
    6868        try {
    69             Main.getLayerManager().addLayer(layer);
     69            MainApplication.getLayerManager().addLayer(layer);
    7070            action.actionPerformed(null);
    7171        } finally {
    7272            // Ensure we clean the place before leaving, even if test fails.
    73             Main.getLayerManager().removeLayer(layer);
     73            MainApplication.getLayerManager().removeLayer(layer);
    7474        }
    7575
     
    138138            action.setEnabled(true);
    139139            try {
    140                 Main.getLayerManager().addLayer(layer);
     140                MainApplication.getLayerManager().addLayer(layer);
    141141                action.actionPerformed(null);
    142142            } finally {
    143143                // Ensure we clean the place before leaving, even if test fails.
    144                 Main.getLayerManager().removeLayer(layer);
     144                MainApplication.getLayerManager().removeLayer(layer);
    145145            }
    146146
  • trunk/test/unit/org/openstreetmap/josm/actions/DeleteLayerActionTest.java

    r11101 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.osm.DataSet;
     10import org.openstreetmap.josm.gui.MainApplication;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    3636        // OsmDataLayer
    3737        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    38         Main.getLayerManager().addLayer(layer);
    39         assertNotNull(Main.getLayerManager().getActiveLayer());
     38        MainApplication.getLayerManager().addLayer(layer);
     39        assertNotNull(MainApplication.getLayerManager().getActiveLayer());
    4040        action.actionPerformed(null);
    41         assertNull(Main.getLayerManager().getActiveLayer());
     41        assertNull(MainApplication.getLayerManager().getActiveLayer());
    4242    }
    4343}
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r12632 r12636  
    2626import org.openstreetmap.josm.data.osm.RelationMember;
    2727import org.openstreetmap.josm.data.osm.Way;
     28import org.openstreetmap.josm.gui.MainApplication;
    2829import org.openstreetmap.josm.gui.layer.Layer;
    2930import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    6061            DataSet ds = OsmReader.parseDataSet(is, null);
    6162            Layer layer = new OsmDataLayer(ds, null, null);
    62             Main.getLayerManager().addLayer(layer);
     63            MainApplication.getLayerManager().addLayer(layer);
    6364            try {
    6465                new JoinAreasAction().join(ds.getWays());
    6566            } finally {
    6667                // Ensure we clean the place before leaving, even if test fails.
    67                 Main.getLayerManager().removeLayer(layer);
     68                MainApplication.getLayerManager().removeLayer(layer);
    6869            }
    6970        }
     
    8182            assertEquals(10, ds.getWays().size());
    8283            Layer layer = new OsmDataLayer(ds, null, null);
    83             Main.getLayerManager().addLayer(layer);
     84            MainApplication.getLayerManager().addLayer(layer);
    8485            for (String ref : new String[]{"A", "B", "C", "D", "E"}) {
    8586                System.out.print("Joining ways " + ref);
     
    112113
    113114        // set current edit layer
    114         Main.getLayerManager().addLayer(new OsmDataLayer(dsToJoin, "join", null));
     115        MainApplication.getLayerManager().addLayer(new OsmDataLayer(dsToJoin, "join", null));
    115116
    116117        Collection<OsmPrimitive> testPrims = dsToJoin.getPrimitives(osm -> osm.get("test") != null);
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java

    r12632 r12636  
    88import org.junit.Rule;
    99import org.junit.Test;
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.osm.DataSet;
     11import org.openstreetmap.josm.gui.MainApplication;
    1212import org.openstreetmap.josm.gui.layer.LayerManagerTest.TestLayer;
    1313import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    3838            action = new MergeLayerAction();
    3939        }
    40         for (TestLayer testLayer : Main.getLayerManager().getLayersOfType(TestLayer.class)) {
    41             Main.getLayerManager().removeLayer(testLayer);
     40        for (TestLayer testLayer : MainApplication.getLayerManager().getLayersOfType(TestLayer.class)) {
     41            MainApplication.getLayerManager().removeLayer(testLayer);
    4242        }
    4343    }
     
    4848    @Test
    4949    public void testMergeNoSourceLayer() {
    50         assertNull(Main.getLayerManager().getActiveLayer());
     50        assertNull(MainApplication.getLayerManager().getActiveLayer());
    5151        action.actionPerformed(null);
    52         assertEquals(0, Main.getLayerManager().getLayers().size());
     52        assertEquals(0, MainApplication.getLayerManager().getLayers().size());
    5353    }
    5454
     
    5959    public void testMergeNoTargetLayer() {
    6060        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    61         Main.getLayerManager().addLayer(layer);
    62         assertEquals(1, Main.getLayerManager().getLayers().size());
     61        MainApplication.getLayerManager().addLayer(layer);
     62        assertEquals(1, MainApplication.getLayerManager().getLayers().size());
    6363        assertNull(action.merge(layer));
    64         assertEquals(1, Main.getLayerManager().getLayers().size());
     64        assertEquals(1, MainApplication.getLayerManager().getLayers().size());
    6565    }
    6666
     
    7373        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "1", null);
    7474        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "2", null);
    75         Main.getLayerManager().addLayer(layer1);
    76         Main.getLayerManager().addLayer(layer2);
    77         assertEquals(2, Main.getLayerManager().getLayers().size());
     75        MainApplication.getLayerManager().addLayer(layer1);
     76        MainApplication.getLayerManager().addLayer(layer2);
     77        assertEquals(2, MainApplication.getLayerManager().getLayers().size());
    7878        action.merge(layer2).get();
    79         assertEquals(1, Main.getLayerManager().getLayers().size());
     79        assertEquals(1, MainApplication.getLayerManager().getLayers().size());
    8080    }
    8181}
  • trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java

    r12359 r12636  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.TestUtils;
    1413import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction;
     
    1817import org.openstreetmap.josm.data.osm.Node;
    1918import org.openstreetmap.josm.data.osm.Way;
     19import org.openstreetmap.josm.gui.MainApplication;
    2020import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2121import org.openstreetmap.josm.io.OsmReader;
     
    100100            final DataSet ds = OsmReader.parseDataSet(in, null);
    101101            // TODO: Executing commands depends on active edit layer
    102             Main.getLayerManager().addLayer(new OsmDataLayer(ds, "ds", null));
     102            MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, "ds", null));
    103103            for (String s : search) {
    104104                ds.addSelected(SubclassFilteredCollection.filter(ds.allPrimitives(), SearchCompiler.compile(s)));
  • trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java

    r12632 r12636  
    1111import org.junit.Rule;
    1212import org.junit.Test;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.TestUtils;
    1514import org.openstreetmap.josm.data.osm.DataSet;
    1615import org.openstreetmap.josm.data.osm.Way;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1818import org.openstreetmap.josm.io.IllegalDataException;
     
    4545            DataSet ds = OsmReader.parseDataSet(is, null);
    4646            OsmDataLayer layer = new OsmDataLayer(ds, null, null);
    47             Main.getLayerManager().addLayer(layer);
     47            MainApplication.getLayerManager().addLayer(layer);
    4848            try {
    4949                for (Way w : ds.getWays()) {
     
    6161            } finally {
    6262                // Ensure we clean the place before leaving, even if test fails.
    63                 Main.getLayerManager().removeLayer(layer);
     63                MainApplication.getLayerManager().removeLayer(layer);
    6464            }
    6565        }
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java

    r12632 r12636  
    99import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.data.coor.EastNorth;
    1312import org.openstreetmap.josm.data.osm.DataSet;
     
    1615import org.openstreetmap.josm.data.osm.RelationMember;
    1716import org.openstreetmap.josm.data.osm.Way;
     17import org.openstreetmap.josm.gui.MainApplication;
    1818import org.openstreetmap.josm.gui.layer.Layer;
    1919import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4949    @Test
    5050    public void testNoDataSet() {
    51         assertNull(Main.getLayerManager().getEditDataSet());
     51        assertNull(MainApplication.getLayerManager().getEditDataSet());
    5252        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
    5353        assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null));
     
    7777        ds.addPrimitive(r);
    7878        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    79         Main.getLayerManager().addLayer(layer);
     79        MainApplication.getLayerManager().addLayer(layer);
    8080        return layer;
    8181    }
     
    109109    public void testPerformSelection() {
    110110        initDataSet();
    111         DataSet ds = Main.getLayerManager().getEditDataSet();
     111        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
    112112
    113113        assertEquals(0, ds.getSelected().size());
  • trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java

    r12632 r12636  
    2020import org.openstreetmap.josm.data.osm.Node;
    2121import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.gui.MainApplication;
    2223import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2324import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    7374        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    7475        try {
    75             Main.getLayerManager().addLayer(layer);
     76            MainApplication.getLayerManager().addLayer(layer);
    7677            assertTrue(ds.getSelected().isEmpty());
    7778            action.actionPerformed(null);
    7879        } finally {
    79             Main.getLayerManager().removeLayer(layer);
     80            MainApplication.getLayerManager().removeLayer(layer);
    8081        }
    8182    }
     
    9091        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    9192        try {
    92             Main.getLayerManager().addLayer(layer);
     93            MainApplication.getLayerManager().addLayer(layer);
    9394            assertEquals(1, ds.getSelected().size());
    9495            action.actionPerformed(null);
    9596        } finally {
    96             Main.getLayerManager().removeLayer(layer);
     97            MainApplication.getLayerManager().removeLayer(layer);
    9798        }
    9899    }
     
    109110        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    110111        try {
    111             Main.getLayerManager().addLayer(layer);
     112            MainApplication.getLayerManager().addLayer(layer);
    112113            assertEquals(11, ds.getSelected().size());
    113114            action.actionPerformed(null);
    114115        } finally {
    115             Main.getLayerManager().removeLayer(layer);
     116            MainApplication.getLayerManager().removeLayer(layer);
    116117        }
    117118    }
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r12632 r12636  
    2424import org.openstreetmap.josm.data.osm.RelationMember;
    2525import org.openstreetmap.josm.data.osm.Way;
     26import org.openstreetmap.josm.gui.MainApplication;
    2627import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2728import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    9192
    9293        try {
    93             Main.getLayerManager().addLayer(layer);
     94            MainApplication.getLayerManager().addLayer(layer);
    9495            action.actionPerformed(null);
    9596        } finally {
    9697            // Ensure we clean the place before leaving, even if test fails.
    97             Main.getLayerManager().removeLayer(layer);
     98            MainApplication.getLayerManager().removeLayer(layer);
    9899        }
    99100
  • trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java

    r12632 r12636  
    1313import org.openstreetmap.josm.data.osm.Node;
    1414import org.openstreetmap.josm.data.osm.Way;
     15import org.openstreetmap.josm.gui.MainApplication;
    1516import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1617import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    5253        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    5354        try {
    54             Main.getLayerManager().addLayer(layer);
     55            MainApplication.getLayerManager().addLayer(layer);
    5556            assertTrue(ds.getSelected().isEmpty());
    5657            assertTrue(ds.allPrimitives().isEmpty());
     
    5859            assertTrue(ds.allPrimitives().isEmpty());
    5960        } finally {
    60             Main.getLayerManager().removeLayer(layer);
     61            MainApplication.getLayerManager().removeLayer(layer);
    6162        }
    6263    }
     
    7374        ds.setSelected(n);
    7475        try {
    75             Main.getLayerManager().addLayer(layer);
     76            MainApplication.getLayerManager().addLayer(layer);
    7677            assertEquals(1, ds.getSelected().size());
    7778            assertEquals(1, ds.allPrimitives().size());
     
    7980            assertEquals(1, ds.allPrimitives().size());
    8081        } finally {
    81             Main.getLayerManager().removeLayer(layer);
     82            MainApplication.getLayerManager().removeLayer(layer);
    8283        }
    8384    }
     
    100101        ds.setSelected(n1);
    101102        try {
    102             Main.getLayerManager().addLayer(layer);
     103            MainApplication.getLayerManager().addLayer(layer);
    103104            assertEquals(1, ds.getSelected().size());
    104105            assertEquals(3, ds.allPrimitives().size());
     
    106107            assertEquals(3, ds.allPrimitives().size());
    107108        } finally {
    108             Main.getLayerManager().removeLayer(layer);
     109            MainApplication.getLayerManager().removeLayer(layer);
    109110        }
    110111    }
     
    133134        ds.setSelected(n1);
    134135        try {
    135             Main.getLayerManager().addLayer(layer);
     136            MainApplication.getLayerManager().addLayer(layer);
    136137            assertEquals(1, ds.getSelected().size());
    137138            assertEquals(5, ds.allPrimitives().size());
     
    139140            assertEquals(6, ds.allPrimitives().size());
    140141        } finally {
    141             Main.getLayerManager().removeLayer(layer);
     142            MainApplication.getLayerManager().removeLayer(layer);
    142143        }
    143144    }
  • trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java

    r10945 r12636  
    88import org.junit.Rule;
    99import org.junit.Test;
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.data.coor.EastNorth;
    1211import org.openstreetmap.josm.data.osm.DataSet;
    1312import org.openstreetmap.josm.data.osm.Node;
    1413import org.openstreetmap.josm.data.osm.Way;
     14import org.openstreetmap.josm.gui.MainApplication;
    1515import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1616import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    7575        action.setEnabled(true);
    7676        try {
    77             Main.getLayerManager().addLayer(layer);
     77            MainApplication.getLayerManager().addLayer(layer);
    7878            action.actionPerformed(null);
    7979        } finally {
    8080            // Ensure we clean the place before leaving, even if test fails.
    81             Main.getLayerManager().removeLayer(layer);
     81            MainApplication.getLayerManager().removeLayer(layer);
    8282        }
    8383
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java

    r12632 r12636  
    99import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.data.notes.Note;
    1312import org.openstreetmap.josm.data.osm.DataSet;
     
    3938        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    4039        try {
    41             Main.getLayerManager().addLayer(layer);
     40            MainApplication.getLayerManager().addLayer(layer);
    4241            AddNoteAction mapMode = new AddNoteAction(new NoteData(Collections.<Note>emptyList()));
    4342            MapFrame map = MainApplication.getMap();
     
    4746            assertTrue(map.selectMapMode(oldMapMode));
    4847        } finally {
    49             Main.getLayerManager().removeLayer(layer);
     48            MainApplication.getLayerManager().removeLayer(layer);
    5049        }
    5150    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java

    r12632 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.actions.mapmode.DeleteAction.DeleteMode;
     
    3736        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3837        try {
    39             Main.getLayerManager().addLayer(layer);
     38            MainApplication.getLayerManager().addLayer(layer);
    4039            DeleteAction mapMode = new DeleteAction();
    4140            MapFrame map = MainApplication.getMap();
     
    4544            assertTrue(map.selectMapMode(oldMapMode));
    4645        } finally {
    47             Main.getLayerManager().removeLayer(layer);
     46            MainApplication.getLayerManager().removeLayer(layer);
    4847        }
    4948    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r12632 r12636  
    5555        DataSet dataSet = new DataSet();
    5656        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
    57         Main.getLayerManager().addLayer(layer);
     57        MainApplication.getLayerManager().addLayer(layer);
    5858
    5959        // fix map view position
     
    101101        } finally {
    102102            // Ensure we clean the place before leaving, even if test fails.
    103             Main.getLayerManager().removeLayer(layer);
     103            MainApplication.getLayerManager().removeLayer(layer);
    104104        }
    105105    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java

    r12632 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode;
     
    3736        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3837        try {
    39             Main.getLayerManager().addLayer(layer);
     38            MainApplication.getLayerManager().addLayer(layer);
    4039            ExtrudeAction mapMode = new ExtrudeAction();
    4140            MapFrame map = MainApplication.getMap();
     
    4544            assertTrue(map.selectMapMode(oldMapMode));
    4645        } finally {
    47             Main.getLayerManager().removeLayer(layer);
     46            MainApplication.getLayerManager().removeLayer(layer);
    4847        }
    4948    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java

    r12632 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.State;
     
    3736        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3837        try {
    39             Main.getLayerManager().addLayer(layer);
     38            MainApplication.getLayerManager().addLayer(layer);
    4039            ImproveWayAccuracyAction mapMode = new ImproveWayAccuracyAction();
    4140            MapFrame map = MainApplication.getMap();
     
    4544            assertTrue(map.selectMapMode(oldMapMode));
    4645        } finally {
    47             Main.getLayerManager().removeLayer(layer);
     46            MainApplication.getLayerManager().removeLayer(layer);
    4847        }
    4948    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java

    r12024 r12636  
    66import java.awt.geom.Point2D;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.data.coor.EastNorth;
     9import org.openstreetmap.josm.gui.MainApplication;
    1010import org.openstreetmap.josm.gui.MapView;
    1111import org.openstreetmap.josm.gui.layer.MainLayerManager;
     
    1313class MapViewMock extends MapView {
    1414    MapViewMock() {
    15         this(Main.getLayerManager());
     15        this(MainApplication.getLayerManager());
    1616    }
    1717
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java

    r12632 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode;
     
    3837        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3938        try {
    40             Main.getLayerManager().addLayer(layer);
     39            MainApplication.getLayerManager().addLayer(layer);
    4140            MapFrame map = MainApplication.getMap();
    4241            ParallelWayAction mapMode = new ParallelWayAction(map);
     
    4645            assertTrue(map.selectMapMode(oldMapMode));
    4746        } finally {
    48             Main.getLayerManager().removeLayer(layer);
     47            MainApplication.getLayerManager().removeLayer(layer);
    4948        }
    5049    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java

    r12632 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.osm.DataSet;
    1110import org.openstreetmap.josm.gui.MainApplication;
     
    3635        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3736        try {
    38             Main.getLayerManager().addLayer(layer);
     37            MainApplication.getLayerManager().addLayer(layer);
    3938            PlayHeadDragMode mapMode = new PlayHeadDragMode(PlayHeadMarker.create());
    4039            MapFrame map = MainApplication.getMap();
     
    4443            assertTrue(map.selectMapMode(oldMapMode));
    4544        } finally {
    46             Main.getLayerManager().removeLayer(layer);
     45            MainApplication.getLayerManager().removeLayer(layer);
    4746        }
    4847    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java

    r12632 r12636  
    8989
    9090        Main.pref.put("edit.initial-move-delay", "0");
    91         Main.getLayerManager().addLayer(layer);
     91        MainApplication.getLayerManager().addLayer(layer);
    9292        try {
    9393            MapFrame map = MainApplication.getMap();
     
    145145        } finally {
    146146            // Ensure we clean the place before leaving, even if test fails.
    147             Main.getLayerManager().removeLayer(layer);
     147            MainApplication.getLayerManager().removeLayer(layer);
    148148        }
    149149    }
  • trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java

    r10758 r12636  
    99import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.data.coor.LatLon;
    1312import org.openstreetmap.josm.data.osm.DataSet;
     
    1716import org.openstreetmap.josm.data.osm.User;
    1817import org.openstreetmap.josm.data.osm.Way;
     18import org.openstreetmap.josm.gui.MainApplication;
    1919import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2020import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    4242    public void testAdd() {
    4343        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    44         Main.getLayerManager().addLayer(layer1);
     44        MainApplication.getLayerManager().addLayer(layer1);
    4545        assertArrayEquals(new Object[0], layer1.data.allPrimitives().toArray());
    4646
     
    6161        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "l1", null);
    6262
    63         Main.getLayerManager().addLayer(layer1);
    64         Main.getLayerManager().addLayer(layer2);
     63        MainApplication.getLayerManager().addLayer(layer1);
     64        MainApplication.getLayerManager().addLayer(layer2);
    6565
    6666        Node osm = new Node(LatLon.ZERO);
     
    7777    public void testUndo() {
    7878        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    79         Main.getLayerManager().addLayer(layer1);
     79        MainApplication.getLayerManager().addLayer(layer1);
    8080        Node osm = new Node(LatLon.ZERO);
    8181        layer1.data.addPrimitive(osm);
  • trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java

    r11609 r12636  
    1414import org.junit.Rule;
    1515import org.junit.Test;
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.data.coor.LatLon;
    1817import org.openstreetmap.josm.data.osm.DataSet;
     
    2423import org.openstreetmap.josm.data.osm.Way;
    2524import org.openstreetmap.josm.data.osm.WayData;
     25import org.openstreetmap.josm.gui.MainApplication;
    2626import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2727import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    4949    public void testAdd() {
    5050        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    51         Main.getLayerManager().addLayer(layer1);
     51        MainApplication.getLayerManager().addLayer(layer1);
    5252
    5353        List<PrimitiveData> testData = createTestData();
     
    6464    public void testAddSetSelection() {
    6565        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    66         Main.getLayerManager().addLayer(layer1);
     66        MainApplication.getLayerManager().addLayer(layer1);
    6767
    6868        List<PrimitiveData> testData = createTestData();
     
    8383        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "l1", null);
    8484
    85         Main.getLayerManager().addLayer(layer1);
    86         Main.getLayerManager().addLayer(layer2);
     85        MainApplication.getLayerManager().addLayer(layer1);
     86        MainApplication.getLayerManager().addLayer(layer2);
    8787
    8888        List<PrimitiveData> testData = createTestData();
     
    102102    public void testAddIgnoresExisting() {
    103103        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    104         Main.getLayerManager().addLayer(layer1);
     104        MainApplication.getLayerManager().addLayer(layer1);
    105105
    106106        List<PrimitiveData> testData = createTestData();
     
    122122    public void testDescription() {
    123123        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    124         Main.getLayerManager().addLayer(layer1);
     124        MainApplication.getLayerManager().addLayer(layer1);
    125125
    126126        List<PrimitiveData> testData = createTestData();
     
    147147    public void testUndo() {
    148148        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    149         Main.getLayerManager().addLayer(layer1);
     149        MainApplication.getLayerManager().addLayer(layer1);
    150150
    151151        List<PrimitiveData> testData = createTestData();
     
    182182    public void testUndoIgnoresExisting() {
    183183        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    184         Main.getLayerManager().addLayer(layer1);
     184        MainApplication.getLayerManager().addLayer(layer1);
    185185
    186186        List<PrimitiveData> testData = createTestData();
     
    220220    public void testParticipatingPrimitives() {
    221221        OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), "l1", null);
    222         Main.getLayerManager().addLayer(layer1);
     222        MainApplication.getLayerManager().addLayer(layer1);
    223223
    224224        List<PrimitiveData> testData = createTestData();
  • trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java

    r10758 r12636  
    1212import org.junit.Rule;
    1313import org.junit.Test;
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.data.coor.LatLon;
    1615import org.openstreetmap.josm.data.osm.DataSet;
     
    2120import org.openstreetmap.josm.data.osm.User;
    2221import org.openstreetmap.josm.data.osm.Way;
     22import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2424import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    141141        public CommandTestData() {
    142142            layer = new OsmDataLayer(new DataSet(), "layer", null);
    143             Main.getLayerManager().addLayer(layer);
     143            MainApplication.getLayerManager().addLayer(layer);
    144144
    145145            existingNode = createNode(5);
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r12564 r12636  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.conflict.Conflict;
    1413import org.openstreetmap.josm.data.osm.DataSet;
     
    1615import org.openstreetmap.josm.data.osm.User;
    1716import org.openstreetmap.josm.data.osm.Way;
     17import org.openstreetmap.josm.gui.MainApplication;
    1818import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1919import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    4343    public void setUp() {
    4444        layer = new OsmDataLayer(new DataSet(), null, null);
    45         Main.getLayerManager().addLayer(layer);
     45        MainApplication.getLayerManager().addLayer(layer);
    4646    }
    4747
     
    5151    @After
    5252    public void tearDown() {
    53         Main.getLayerManager().removeLayer(layer);
     53        MainApplication.getLayerManager().removeLayer(layer);
    5454    }
    5555
     
    5959    @Test
    6060    public void testExecuteUndoCommand() {
    61         OsmDataLayer layer = Main.getLayerManager().getEditLayer();
     61        OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer();
    6262        Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
    6363        ConflictAddCommand cmd = new ConflictAddCommand(layer, conflict);
     
    7575    @Test
    7676    public void testGetDescriptionIcon() {
    77         OsmDataLayer layer = Main.getLayerManager().getEditLayer();
     77        OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer();
    7878        Conflict<Node> conflict = new Conflict<>(new Node(), new Node());
    7979        assertNotNull(new ConflictAddCommand(layer, conflict).getDescriptionIcon());
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java

    r12564 r12636  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.conflict.Conflict;
    1413import org.openstreetmap.josm.data.coor.LatLon;
     
    1716import org.openstreetmap.josm.data.osm.User;
    1817import org.openstreetmap.josm.data.osm.Way;
     18import org.openstreetmap.josm.gui.MainApplication;
    1919import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
    2020import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4545    public void setUp() {
    4646        layer = new OsmDataLayer(new DataSet(), null, null);
    47         Main.getLayerManager().addLayer(layer);
     47        MainApplication.getLayerManager().addLayer(layer);
    4848    }
    4949
     
    5353    @After
    5454    public void tearDown() {
    55         Main.getLayerManager().removeLayer(layer);
     55        MainApplication.getLayerManager().removeLayer(layer);
    5656    }
    5757
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/SelectionEventManagerTest.java

    r12109 r12636  
    1111import org.junit.Rule;
    1212import org.junit.Test;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
    1514import org.openstreetmap.josm.data.SelectionChangedListener;
     
    1716import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1817import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
     18import org.openstreetmap.josm.gui.MainApplication;
    1919import org.openstreetmap.josm.gui.util.GuiHelper;
    2020import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    6161        CommandTestDataWithRelation testData1 = new CommandTestDataWithRelation();
    6262        CommandTestDataWithRelation testData2 = new CommandTestDataWithRelation();
    63         Main.getLayerManager().setActiveLayer(testData1.layer);
    64         assertEquals(testData1.layer, Main.getLayerManager().getEditLayer());
     63        MainApplication.getLayerManager().setActiveLayer(testData1.layer);
     64        assertEquals(testData1.layer, MainApplication.getLayerManager().getEditLayer());
    6565
    6666        SelectionListener listener1 = new SelectionListener("IMMEDIATELY");
     
    8787
    8888        // changing to other dataset should trigger a empty selection
    89         Main.getLayerManager().setActiveLayer(testData2.layer);
     89        MainApplication.getLayerManager().setActiveLayer(testData2.layer);
    9090        assertSelectionEquals(listeners, new HashSet<OsmPrimitive>(Arrays.asList()));
    9191
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r12634 r12636  
    2121import org.junit.Rule;
    2222import org.junit.Test;
    23 import org.openstreetmap.josm.Main;
    2423import org.openstreetmap.josm.TestUtils;
    2524import org.openstreetmap.josm.data.Version;
     
    148147
    149148    private static void doTestPostConstructorProcessCmdLine(String download, String downloadGps, boolean gpx) {
    150         assertNull(Main.getLayerManager().getEditDataSet());
     149        assertNull(MainApplication.getLayerManager().getEditDataSet());
    151150        for (Future<?> f : MainApplication.postConstructorProcessCmdLine(new ProgramArguments(new String[]{
    152151                "--download=" + download,
     
    159158            }
    160159        }
    161         DataSet ds = Main.getLayerManager().getEditDataSet();
     160        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
    162161        assertNotNull(ds);
    163162        assertFalse(ds.getSelected().isEmpty());
    164         Main.getLayerManager().removeLayer(Main.getLayerManager().getEditLayer());
     163        MainApplication.getLayerManager().removeLayer(MainApplication.getLayerManager().getEditLayer());
    165164        if (gpx) {
    166             List<GpxLayer> gpxLayers = Main.getLayerManager().getLayersOfType(GpxLayer.class);
     165            List<GpxLayer> gpxLayers = MainApplication.getLayerManager().getLayersOfType(GpxLayer.class);
    167166            assertEquals(1, gpxLayers.size());
    168             Main.getLayerManager().removeLayer(gpxLayers.iterator().next());
     167            MainApplication.getLayerManager().removeLayer(gpxLayers.iterator().next());
    169168        }
    170169    }
  • trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java

    r12632 r12636  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.TestUtils;
    1413import org.openstreetmap.josm.data.osm.DataSet;
     
    3635    @Test
    3736    public void testMapScaler() {
    38         Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     37        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3938        assertEquals(Color.WHITE, MapScaler.getColor());
    4039        MapScaler ms = new MapScaler(MainApplication.getMap().mapView);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r12632 r12636  
    4848    public void testCommandStackDialogNotEmpty() {
    4949        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    50         Main.getLayerManager().addLayer(layer);
     50        MainApplication.getLayerManager().addLayer(layer);
    5151        try {
    5252            Command cmd1 = TestUtils.newCommand();
     
    6969        } finally {
    7070            Main.main.undoRedo.clean();
    71             Main.getLayerManager().removeLayer(layer);
     71            MainApplication.getLayerManager().removeLayer(layer);
    7272        }
    7373    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java

    r12632 r12636  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.coor.LatLon;
    1413import org.openstreetmap.josm.data.osm.DataSet;
     
    5756    @Test
    5857    public void testConflictPainter() {
    59         Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     58        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    6059        ConflictPainter cp = new ConflictPainter(MainApplication.getMap().mapView,
    6160                new BufferedImage(800, 600, BufferedImage.TYPE_3BYTE_BGR).createGraphics());
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java

    r12632 r12636  
    1111import org.junit.Rule;
    1212import org.junit.Test;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.data.coor.LatLon;
    1514import org.openstreetmap.josm.data.osm.DataSet;
    1615import org.openstreetmap.josm.data.osm.Node;
    1716import org.openstreetmap.josm.data.osm.User;
     17import org.openstreetmap.josm.gui.MainApplication;
    1818import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1919import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    113113
    114114        try {
    115             Main.getLayerManager().addLayer(layer);
     115            MainApplication.getLayerManager().addLayer(layer);
    116116            assertEquals("", InspectPrimitiveDialog.buildMapPaintText());
    117117            Node n = new Node(LatLon.ZERO);
     
    128128                    InspectPrimitiveDialog.buildMapPaintText().replaceAll("@(\\p{XDigit})+", ""));
    129129        } finally {
    130             Main.getLayerManager().removeLayer(layer);
     130            MainApplication.getLayerManager().removeLayer(layer);
    131131        }
    132132    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java

    r12632 r12636  
    44import org.junit.Rule;
    55import org.junit.Test;
    6 import org.openstreetmap.josm.Main;
    76import org.openstreetmap.josm.data.osm.DataSet;
    87import org.openstreetmap.josm.gui.MainApplication;
     
    2928    @Test
    3029    public void testInfoAction() {
    31         Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     30        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3231        MainApplication.getMap().mapPaintDialog.new InfoAction().actionPerformed(null);
    3332    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/DuplicateActionTest.java

    r11505 r12636  
    1111import org.junit.Rule;
    1212import org.junit.Test;
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.TestUtils;
     14import org.openstreetmap.josm.gui.MainApplication;
    1515import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1616import org.openstreetmap.josm.io.OsmReader;
     
    3838        try (InputStream is = TestUtils.getRegressionDataStream(4539, "josm_error_#4539.osm.zip")) {
    3939            OsmDataLayer layer = new OsmDataLayer(OsmReader.parseDataSet(is, null), null, null);
    40             OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();
     40            OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();
    4141            assertNull(editLayer);
    4242            try {
    4343                new DuplicateAction(layer, null).actionPerformed(null);
    44                 editLayer = Main.getLayerManager().getEditLayer();
     44                editLayer = MainApplication.getLayerManager().getEditLayer();
    4545                assertNotNull(editLayer);
    4646                assertFalse(layer.equals(editLayer));
     
    5151                // Ensure we clean the place before leaving, even if test fails.
    5252                if (editLayer != null) {
    53                     Main.getLayerManager().removeLayer(editLayer);
     53                    MainApplication.getLayerManager().removeLayer(editLayer);
    5454                }
    5555            }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r12632 r12636  
    88import org.junit.Rule;
    99import org.junit.Test;
    10 import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.gui.MainApplication;
    1111import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    1212import org.openstreetmap.josm.gui.dialogs.LayerListDialog.LayerListModel;
     
    3434    public void testLayerVisibilityAction() {
    3535        TMSLayer layer = TMSLayerTest.createTmsLayer();
    36         LayerListModel model = new LayerListDialog(Main.getLayerManager()) {
     36        LayerListModel model = new LayerListDialog(MainApplication.getLayerManager()) {
    3737            @Override
    3838            protected void registerInWindowMenu() {
     
    4444        assertFalse(action.isEnabled());
    4545
    46         Main.getLayerManager().addLayer(layer);
     46        MainApplication.getLayerManager().addLayer(layer);
    4747        model.setSelectedLayer(layer);
    4848        action.updateEnabledState();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java

    r10962 r12636  
    1010import org.junit.Rule;
    1111import org.junit.Test;
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.data.coor.LatLon;
    1413import org.openstreetmap.josm.data.osm.DataSet;
     
    1615import org.openstreetmap.josm.data.osm.Relation;
    1716import org.openstreetmap.josm.data.osm.RelationMember;
     17import org.openstreetmap.josm.gui.MainApplication;
    1818import org.openstreetmap.josm.gui.dialogs.relation.SelectionTable.DoubleClickAdapter;
    1919import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    5050        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    5151        try {
    52             Main.getLayerManager().addLayer(layer);
     52            MainApplication.getLayerManager().addLayer(layer);
    5353            // Constructs models and table
    5454            MemberTableModel memberTableModel = new MemberTableModel(r, layer, null);
     
    8585            }
    8686        } finally {
    87             Main.getLayerManager().removeLayer(layer);
     87            MainApplication.getLayerManager().removeLayer(layer);
    8888        }
    8989    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java

    r12632 r12636  
    2727import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource;
    2828import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo;
    29 import org.openstreetmap.josm.Main;
    3029import org.openstreetmap.josm.data.imagery.ImageryInfo;
    3130import org.openstreetmap.josm.data.imagery.TileLoaderFactory;
    3231import org.openstreetmap.josm.data.osm.DataSet;
     32import org.openstreetmap.josm.gui.MainApplication;
    3333import org.openstreetmap.josm.gui.layer.imagery.ImageryFilterSettings;
    3434import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    149149    @Before
    150150    public void setUp() {
    151         Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     151        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    152152        testLayer = new TileSourceStubLayer();
    153153        testLayer.addInvalidationListener(l -> invalidated.set(true));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java

    r12635 r12636  
    2222import org.junit.Rule;
    2323import org.junit.Test;
    24 import org.openstreetmap.josm.Main;
    2524import org.openstreetmap.josm.data.coor.LatLon;
    2625import org.openstreetmap.josm.data.osm.DataSet;
    2726import org.openstreetmap.josm.data.osm.Node;
     27import org.openstreetmap.josm.gui.MainApplication;
    2828import org.openstreetmap.josm.gui.layer.AutosaveTask.AutosaveLayerInfo;
    2929import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    130130    public void testAutosaveIgnoresUnmodifiedLayer() {
    131131        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "OsmData", null);
    132         Main.getLayerManager().addLayer(layer);
     132        MainApplication.getLayerManager().addLayer(layer);
    133133        try {
    134134            task.schedule();
     
    166166        DataSet data = new DataSet();
    167167        OsmDataLayer layer = new OsmDataLayer(data, "OsmData", null);
    168         Main.getLayerManager().addLayer(layer);
     168        MainApplication.getLayerManager().addLayer(layer);
    169169        try {
    170170            task.schedule();
     
    206206        DataSet data1 = new DataSet();
    207207        OsmDataLayer layer1 = new OsmDataLayer(data1, "OsmData", null);
    208         Main.getLayerManager().addLayer(layer1);
     208        MainApplication.getLayerManager().addLayer(layer1);
    209209
    210210        DataSet data2 = new DataSet();
     
    215215            assertEquals(0, countFiles());
    216216            // also test adding layer later
    217             Main.getLayerManager().addLayer(layer2);
     217            MainApplication.getLayerManager().addLayer(layer2);
    218218
    219219            data1.addPrimitive(new Node(new LatLon(10, 10)));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r12632 r12636  
    1717import org.junit.Rule;
    1818import org.junit.Test;
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.TestUtils;
    2120import org.openstreetmap.josm.data.gpx.GpxData;
     
    210209        GpxLayer layer = getMinimalGpxLayer();
    211210        try {
    212             Main.getLayerManager().addLayer(layer);
     211            MainApplication.getLayerManager().addLayer(layer);
    213212            assertTrue(layer.getMenuEntries().length > 0);
    214213            layer.paint(TestUtils.newGraphics(), MainApplication.getMap().mapView, layer.data.getMetaBounds());
    215214        } finally {
    216             Main.getLayerManager().removeLayer(layer);
     215            MainApplication.getLayerManager().removeLayer(layer);
    217216        }
    218217    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/MarkerLayerTest.java

    r12632 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.data.gpx.GpxData;
    1110import org.openstreetmap.josm.data.osm.DataSet;
     
    3534    public void testPlayHeadMarker() {
    3635        try {
    37             Main.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     36            MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3837            MapFrame map = MainApplication.getMap();
    3938            MarkerLayer layer = new MarkerLayer(new GpxData(), null, null, null);
    4039            assertNull(map.mapView.playHeadMarker);
    41             Main.getLayerManager().addLayer(layer);
     40            MainApplication.getLayerManager().addLayer(layer);
    4241            assertNotNull(map.mapView.playHeadMarker);
    43             Main.getLayerManager().removeLayer(layer);
     42            MainApplication.getLayerManager().removeLayer(layer);
    4443        } finally {
    4544            if (MainApplication.isDisplayingMapView()) {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r12630 r12636  
    1212import org.junit.Test;
    1313import org.openstreetmap.josm.JOSMFixture;
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.actions.ExpertToggleAction;
     
    4544        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    4645        try {
    47             Main.getLayerManager().addLayer(layer);
     46            MainApplication.getLayerManager().addLayer(layer);
    4847            int n = OsmDataLayer.PROPERTY_RECENT_RELATIONS_NUMBER.get();
    4948            assertTrue(n > 0);
     
    6160            assertTrue(layer.getRecentRelations().isEmpty());
    6261        } finally {
    63             Main.getLayerManager().removeLayer(layer);
     62            MainApplication.getLayerManager().removeLayer(layer);
    6463        }
    6564    }
     
    135134        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
    136135        try {
    137             Main.getLayerManager().addLayer(layer);
     136            MainApplication.getLayerManager().addLayer(layer);
    138137            assertTrue(layer.getMenuEntries().length > 0);
    139138            layer.paint(TestUtils.newGraphics(), MainApplication.getMap().mapView, new Bounds(LatLon.ZERO));
    140139        } finally {
    141             Main.getLayerManager().removeLayer(layer);
     140            MainApplication.getLayerManager().removeLayer(layer);
    142141        }
    143142    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java

    r12632 r12636  
    66import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.data.imagery.ImageryInfo;
    109import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     10import org.openstreetmap.josm.gui.MainApplication;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
    1212
     
    5151    private static void test(ImageryType expected, TMSLayer layer) {
    5252        try {
    53             Main.getLayerManager().addLayer(layer);
     53            MainApplication.getLayerManager().addLayer(layer);
    5454            assertEquals(expected, layer.getInfo().getImageryType());
    5555        } finally {
    5656            // Ensure we clean the place before leaving, even if test fails.
    57             Main.getLayerManager().removeLayer(layer);
     57            MainApplication.getLayerManager().removeLayer(layer);
    5858        }
    5959    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java

    r10436 r12636  
    1010import org.junit.Test;
    1111import org.openstreetmap.josm.JOSMFixture;
    12 import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313
    1414/**
     
    3333        try {
    3434            layer = new ValidatorLayer();
    35             Main.getLayerManager().addLayer(layer);
     35            MainApplication.getLayerManager().addLayer(layer);
    3636            assertFalse(layer.isMergable(null));
    3737            assertNotNull(layer.getIcon());
     
    4242            // Ensure we clean the place before leaving, even if test fails.
    4343            if (layer != null) {
    44                 Main.getLayerManager().removeLayer(layer);
     44                MainApplication.getLayerManager().removeLayer(layer);
    4545            }
    4646        }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

    r12632 r12636  
    66import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.data.imagery.ImageryInfo;
    109import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     10import org.openstreetmap.josm.gui.MainApplication;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
    1212
     
    3131    public void testWMSLayer() {
    3232        WMSLayer wms = new WMSLayer(new ImageryInfo("test wms", "http://localhost"));
    33         Main.getLayerManager().addLayer(wms);
     33        MainApplication.getLayerManager().addLayer(wms);
    3434        try {
    3535            assertEquals(ImageryType.WMS, wms.getInfo().getImageryType());
    3636        } finally {
    3737            // Ensure we clean the place before leaving, even if test fails.
    38             Main.getLayerManager().removeLayer(wms);
     38            MainApplication.getLayerManager().removeLayer(wms);
    3939        }
    4040    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

    r11383 r12636  
    1212import org.junit.Rule;
    1313import org.junit.Test;
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.data.osm.DataSet;
     16import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.gui.layer.GpxLayer;
    1818import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4545            assertTrue(reader.parse(true));
    4646            GpxLayer gpxLayer = new GpxLayer(reader.getGpxData());
    47             Main.getLayerManager().addLayer(gpxLayer);
    48             assertEquals(1, Main.getLayerManager().getLayers().size());
     47            MainApplication.getLayerManager().addLayer(gpxLayer);
     48            assertEquals(1, MainApplication.getLayerManager().getLayers().size());
    4949            new Loader(
    5050                    Collections.singleton(new File(TestUtils.getRegressionDataFile(12255, "G0016941.JPG"))),
    5151                    gpxLayer).run();
    52             assertEquals(2, Main.getLayerManager().getLayers().size());
    53             GeoImageLayer layer = Main.getLayerManager().getLayersOfType(GeoImageLayer.class).iterator().next();
     52            assertEquals(2, MainApplication.getLayerManager().getLayers().size());
     53            GeoImageLayer layer = MainApplication.getLayerManager().getLayersOfType(GeoImageLayer.class).iterator().next();
    5454            assertEquals(gpxLayer, layer.getGpxLayer());
    5555            List<ImageEntry> images = layer.getImages();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackActionTest.java

    r12358 r12636  
    77import org.junit.Rule;
    88import org.junit.Test;
    9 import org.openstreetmap.josm.Main;
    109import org.openstreetmap.josm.TestUtils;
    1110import org.openstreetmap.josm.data.gpx.GpxData;
    1211import org.openstreetmap.josm.data.osm.DataSet;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    1414import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    3333        final OsmDataLayer layer = new OsmDataLayer(new DataSet(), DownloadAlongTrackActionTest.class.getName(), null);
    3434        try {
    35             Main.getLayerManager().addLayer(layer);
     35            MainApplication.getLayerManager().addLayer(layer);
    3636            // Perform action
    3737            final GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + file);
     
    3939        } finally {
    4040            // Ensure we clean the place before leaving, even if test fails.
    41             Main.getLayerManager().removeLayer(layer);
     41            MainApplication.getLayerManager().removeLayer(layer);
    4242        }
    4343    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java

    r12632 r12636  
    99import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.data.gpx.GpxData;
    1312import org.openstreetmap.josm.data.imagery.ImageryInfo;
     13import org.openstreetmap.josm.gui.MainApplication;
    1414import org.openstreetmap.josm.gui.layer.GpxLayerTest;
    1515import org.openstreetmap.josm.gui.layer.TMSLayer;
     
    4848        TMSLayer layer = new TMSLayer(new ImageryInfo("OSM TMS", "https://a.tile.openstreetmap.org/{zoom}/{x}/{y}.png", "tms", null, null));
    4949        try {
    50             Main.getLayerManager().addLayer(layer);
     50            MainApplication.getLayerManager().addLayer(layer);
    5151            TMSLayer.getCache().clear();
    5252            assertTrue(TMSLayer.getCache().getMatching(".*").isEmpty());
     
    5959        } finally {
    6060            // Ensure we clean the place before leaving, even if test fails.
    61             Main.getLayerManager().removeLayer(layer);
     61            MainApplication.getLayerManager().removeLayer(layer);
    6262        }
    6363    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java

    r12632 r12636  
    1818import org.openstreetmap.josm.data.gpx.GpxLink;
    1919import org.openstreetmap.josm.data.gpx.WayPoint;
     20import org.openstreetmap.josm.gui.MainApplication;
    2021import org.openstreetmap.josm.testutils.JOSMTestRules;
    2122
     
    4950        assertEquals(Color.magenta, MarkerLayer.getGenericColor());
    5051        MarkerLayer layer = new MarkerLayer(new GpxData(), "foo", null, null);
    51         Main.getLayerManager().addLayer(layer);
     52        MainApplication.getLayerManager().addLayer(layer);
    5253
    5354        assertEquals("foo", layer.getName());
  • trunk/test/unit/org/openstreetmap/josm/io/NoteImporterTest.java

    r12630 r12636  
    99import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.TestUtils;
    1312import org.openstreetmap.josm.gui.MainApplication;
     
    3029    @Test
    3130    public void testTicket12531() {
    32         Main.getLayerManager().resetState();
     31        MainApplication.getLayerManager().resetState();
    3332        assertNull(MainApplication.getMap());
    3433        assertTrue(new NoteImporter().importDataHandleExceptions(
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java

    r12558 r12636  
    55import org.junit.Test;
    66import org.junit.rules.ExpectedException;
    7 import org.openstreetmap.josm.Main;
    87import org.openstreetmap.josm.data.osm.DataSet;
     8import org.openstreetmap.josm.gui.MainApplication;
    99import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1010import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    5959        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    6060        try {
    61             Main.getLayerManager().addLayer(layer);
     61            MainApplication.getLayerManager().addLayer(layer);
    6262            newHandler(null).handle();
    6363        } finally {
    64             Main.getLayerManager().removeLayer(layer);
     64            MainApplication.getLayerManager().removeLayer(layer);
    6565        }
    6666    }
     
    9696        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    9797        try {
    98             Main.getLayerManager().addLayer(layer);
     98            MainApplication.getLayerManager().addLayer(layer);
    9999            newHandler("https://localhost?lat=0&lon=0").handle();
    100100        } finally {
    101             Main.getLayerManager().removeLayer(layer);
     101            MainApplication.getLayerManager().removeLayer(layer);
    102102        }
    103103    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java

    r12558 r12636  
    55import org.junit.Test;
    66import org.junit.rules.ExpectedException;
    7 import org.openstreetmap.josm.Main;
    87import org.openstreetmap.josm.data.osm.DataSet;
     8import org.openstreetmap.josm.gui.MainApplication;
    99import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1010import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    5959        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    6060        try {
    61             Main.getLayerManager().addLayer(layer);
     61            MainApplication.getLayerManager().addLayer(layer);
    6262            newHandler(null).handle();
    6363        } finally {
    64             Main.getLayerManager().removeLayer(layer);
     64            MainApplication.getLayerManager().removeLayer(layer);
    6565        }
    6666    }
     
    9696        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    9797        try {
    98             Main.getLayerManager().addLayer(layer);
     98            MainApplication.getLayerManager().addLayer(layer);
    9999            newHandler("https://localhost?way=0,0;1,1").handle();
    100100        } finally {
    101             Main.getLayerManager().removeLayer(layer);
     101            MainApplication.getLayerManager().removeLayer(layer);
    102102        }
    103103    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java

    r12632 r12636  
    99import org.junit.Test;
    1010import org.junit.rules.ExpectedException;
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.TestUtils;
     12import org.openstreetmap.josm.gui.MainApplication;
    1313import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1414import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    9696            newHandler("https://localhost?url=" + Utils.encodeUrl(url)).handle();
    9797        } finally {
    98             for (OsmDataLayer layer : Main.getLayerManager().getLayersOfType(OsmDataLayer.class)) {
    99                 Main.getLayerManager().removeLayer(layer);
     98            for (OsmDataLayer layer : MainApplication.getLayerManager().getLayersOfType(OsmDataLayer.class)) {
     99                MainApplication.getLayerManager().removeLayer(layer);
    100100            }
    101101        }
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r12631 r12636  
    1212import org.junit.Rule;
    1313import org.junit.Test;
    14 import org.openstreetmap.josm.Main;
    1514import org.openstreetmap.josm.TestUtils;
    1615import org.openstreetmap.josm.gui.MainApplication;
     
    142141    public void testReadNotes() throws IOException, IllegalDataException {
    143142        if (MainApplication.isDisplayingMapView()) {
    144             for (NoteLayer nl : Main.getLayerManager().getLayersOfType(NoteLayer.class)) {
    145                 Main.getLayerManager().removeLayer(nl);
     143            for (NoteLayer nl : MainApplication.getLayerManager().getLayersOfType(NoteLayer.class)) {
     144                MainApplication.getLayerManager().removeLayer(nl);
    146145            }
    147146        }
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r12632 r12636  
    2121import org.openstreetmap.josm.data.notes.Note;
    2222import org.openstreetmap.josm.data.osm.DataSet;
     23import org.openstreetmap.josm.gui.MainApplication;
    2324import org.openstreetmap.josm.gui.layer.GpxLayer;
    2425import org.openstreetmap.josm.gui.layer.ImageryLayer;
     
    9596    @Before
    9697    public void setUp() {
    97         Main.getLayerManager().addLayer(createOsmLayer());
     98        MainApplication.getLayerManager().addLayer(createOsmLayer());
    9899    }
    99100
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r12625 r12636  
    2626import org.openstreetmap.josm.data.gpx.GpxData;
    2727import org.openstreetmap.josm.data.osm.DataSet;
     28import org.openstreetmap.josm.gui.MainApplication;
    2829import org.openstreetmap.josm.gui.layer.GpxLayer;
    2930import org.openstreetmap.josm.gui.layer.Layer;
     
    9899        for (int i = 0; i < 2; i++) {
    99100            OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Layer "+i, null);
    100             testPlugin(Main.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
    101             testPlugin(Main.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
     101            testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
     102            testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    102103        }
    103104        for (int i = 0; i < 2; i++) {
    104105            GpxLayer layer = new GpxLayer(new GpxData());
    105             testPlugin(Main.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
    106             testPlugin(Main.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
     106            testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
     107            testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    107108        }
    108109
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r12632 r12636  
    376376        // Get the instance before cleaning - this ensures that it is initialized.
    377377        SelectionEventManager eventManager = SelectionEventManager.getInstance();
    378         Main.getLayerManager().resetState();
     378        MainApplication.getLayerManager().resetState();
    379379        eventManager.resetState();
    380380    }
Note: See TracChangeset for help on using the changeset viewer.