diff --git a/src/org/openstreetmap/josm/Main.java b/src/org/openstreetmap/josm/Main.java
index ed2f649..325aa72 100644
|
a
|
b
|
import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
|
| 101 | 101 | import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor; |
| 102 | 102 | import org.openstreetmap.josm.gui.progress.ProgressMonitorExecutor; |
| 103 | 103 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; |
| | 104 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 104 | 105 | import org.openstreetmap.josm.gui.util.RedirectInputMap; |
| 105 | 106 | import org.openstreetmap.josm.gui.widgets.JMultilineLabel; |
| 106 | 107 | import org.openstreetmap.josm.io.FileWatcher; |
| … |
… |
public abstract class Main {
|
| 808 | 809 | * @param bounds the bounds of the layer (target zoom area); can be null, then |
| 809 | 810 | * the viewport isn't changed |
| 810 | 811 | */ |
| 811 | | public final synchronized void addLayer(final Layer layer, ProjectionBounds bounds) { |
| | 812 | public final void addLayer(final Layer layer, ProjectionBounds bounds) { |
| 812 | 813 | addLayer(layer, bounds == null ? null : new ViewportData(bounds)); |
| 813 | 814 | } |
| 814 | 815 | |
| … |
… |
public abstract class Main {
|
| 820 | 821 | * @param layer the layer |
| 821 | 822 | * @param viewport the viewport to zoom to; can be null, then the viewport isn't changed |
| 822 | 823 | */ |
| 823 | | public final synchronized void addLayer(final Layer layer, ViewportData viewport) { |
| | 824 | public final void addLayer(Layer layer, final ViewportData viewport) { |
| 824 | 825 | getLayerManager().addLayer(layer); |
| 825 | 826 | if (viewport != null) { |
| 826 | 827 | Main.map.mapView.scheduleZoomTo(viewport); |
| 827 | 828 | } |
| 828 | 829 | } |
| 829 | 830 | |
| | 831 | /** |
| | 832 | * Creates the map frame. Call only in EDT Thread. |
| | 833 | * @param firstLayer The first layer that was added. |
| | 834 | * @param viewportData The initial viewport. Can be <code>null</code> to be automatically computed. |
| | 835 | */ |
| 830 | 836 | public synchronized void createMapFrame(Layer firstLayer, ViewportData viewportData) { |
| | 837 | GuiHelper.assertCallFromEdt(); |
| 831 | 838 | MapFrame mapFrame = new MapFrame(contentPanePrivate, viewportData); |
| 832 | 839 | setMapFrame(mapFrame); |
| 833 | 840 | if (firstLayer != null) { |
diff --git a/test/unit/org/openstreetmap/josm/JOSMFixture.java b/test/unit/org/openstreetmap/josm/JOSMFixture.java
index e7bdfbf..f08ca13 100644
|
a
|
b
|
import org.openstreetmap.josm.data.projection.Projections;
|
| 14 | 14 | import org.openstreetmap.josm.gui.MainApplication; |
| 15 | 15 | import org.openstreetmap.josm.gui.layer.Layer; |
| 16 | 16 | import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; |
| | 17 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| 17 | 18 | import org.openstreetmap.josm.io.CertificateAmendment; |
| 18 | 19 | import org.openstreetmap.josm.io.OsmApi; |
| 19 | 20 | import org.openstreetmap.josm.tools.I18n; |
| … |
… |
public class JOSMFixture {
|
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | if (createGui) { |
| 118 | | if (Main.toolbar == null) { |
| 119 | | Main.toolbar = new ToolbarPreferences(); |
| 120 | | } |
| 121 | | if (Main.main == null) { |
| 122 | | new MainApplication().initialize(); |
| 123 | | } |
| 124 | | if (Main.map == null) { |
| 125 | | Main.main.createMapFrame(null, null); |
| 126 | | } else { |
| 127 | | for (Layer l: Main.getLayerManager().getLayers()) { |
| 128 | | Main.getLayerManager().removeLayer(l); |
| | 119 | GuiHelper.runInEDTAndWaitWithException(new Runnable() { |
| | 120 | @Override |
| | 121 | public void run() { |
| | 122 | setupGUI(); |
| 129 | 123 | } |
| | 124 | }); |
| | 125 | } |
| | 126 | } |
| | 127 | |
| | 128 | private void setupGUI() { |
| | 129 | if (Main.toolbar == null) { |
| | 130 | Main.toolbar = new ToolbarPreferences(); |
| | 131 | } |
| | 132 | if (Main.main == null) { |
| | 133 | new MainApplication().initialize(); |
| | 134 | } |
| | 135 | if (Main.map == null) { |
| | 136 | Main.main.createMapFrame(null, null); |
| | 137 | } else { |
| | 138 | for (Layer l: Main.getLayerManager().getLayers()) { |
| | 139 | Main.getLayerManager().removeLayer(l); |
| 130 | 140 | } |
| 131 | 141 | } |
| 132 | 142 | } |