Changeset 12221 in josm for trunk


Ignore:
Timestamp:
2017-05-21T00:48:38+02:00 (7 years ago)
Author:
Don-vip
Message:

add public accessors to initialize internal Main variables

File:
1 edited

Legend:

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

    r12128 r12221  
    150150        assertNull(Main.getLayerManager().getActiveLayer());
    151151
    152         if (Main.contentPanePrivate == null) {
    153             Main.contentPanePrivate = new JPanel(new BorderLayout());
    154         }
    155         if (Main.mainPanel == null) {
    156             Main.mainPanel = new MainPanel(Main.getLayerManager());
    157         }
    158         if (Main.toolbar == null) {
    159             Main.toolbar = new ToolbarPreferences();
    160         }
     152        initContentPane();
     153        initMainPanel();
     154        initToolbar();
    161155        if (Main.main == null) {
    162156            new MainApplication().initialize();
     
    167161        Main.getLayerManager().addLayer(new TestLayer());
    168162    }
     163
     164    /**
     165     * Make sure {@code Main.contentPanePrivate} is initialized.
     166     */
     167    public static void initContentPane() {
     168        if (Main.contentPanePrivate == null) {
     169            Main.contentPanePrivate = new JPanel(new BorderLayout());
     170        }
     171    }
     172
     173    /**
     174     * Make sure {@code Main.mainPanel} is initialized.
     175     */
     176    public static void initMainPanel() {
     177        if (Main.mainPanel == null) {
     178            Main.mainPanel = new MainPanel(Main.getLayerManager());
     179        }
     180    }
     181
     182    /**
     183     * Make sure {@code Main.toolbar} is initialized.
     184     */
     185    public static void initToolbar() {
     186        if (Main.toolbar == null) {
     187            Main.toolbar = new ToolbarPreferences();
     188        }
     189    }
    169190}
Note: See TracChangeset for help on using the changeset viewer.