- Timestamp:
- 2017-05-12T19:53:09+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12125 r12127 203 203 204 204 /** 205 * The same main panel, required to be static for {@code MapFrameListener} handling. 206 */ 207 protected static MainPanel mainPanel; 208 209 /** 205 210 * The file watcher service. 206 211 */ … … 1153 1158 */ 1154 1159 public static boolean addAndFireMapFrameListener(MapFrameListener listener) { 1155 return main .panel.addAndFireMapFrameListener(listener);1160 return mainPanel.addAndFireMapFrameListener(listener); 1156 1161 } 1157 1162 … … 1164 1169 */ 1165 1170 public static boolean addMapFrameListener(MapFrameListener listener) { 1166 return main .panel.addMapFrameListener(listener);1171 return mainPanel.addMapFrameListener(listener); 1167 1172 } 1168 1173 … … 1174 1179 */ 1175 1180 public static boolean removeMapFrameListener(MapFrameListener listener) { 1176 return main .panel.removeMapFrameListener(listener);1181 return mainPanel.removeMapFrameListener(listener); 1177 1182 } 1178 1183 -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12125 r12127 88 88 private static final List<String> COMMAND_LINE_ARGS = new ArrayList<>(); 89 89 90 private static ProgramArguments args; 91 private static boolean skipLoadingPlugins; 92 90 93 private final MainFrame mainFrame; 91 94 … … 110 113 protected void initializeMainWindow() { 111 114 if (mainFrame != null) { 112 mainFrame.preInitialize();113 115 panel = mainFrame.getPanel(); 114 116 mainFrame.initialize(); … … 208 210 */ 209 211 public static void main(final String[] argArray) { 212 // First initializes all stuff that do not require AWT/Swing 213 mainNoGui(argArray); 214 // Then initializes all AWT/Swing stuff 215 mainGui(); 216 } 217 218 /** 219 * Initializes all stuff that do not require AWT/Swing. 220 * @param argArray Command-line arguments 221 */ 222 private static void mainNoGui(final String[] argArray) { 210 223 I18n.init(); 211 224 212 225 // construct argument table 213 ProgramArguments args = null;214 226 try { 215 227 args = new ProgramArguments(argArray); … … 261 273 COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray)); 262 274 263 booleanskipLoadingPlugins = args.hasOption(Option.SKIP_PLUGINS);275 skipLoadingPlugins = args.hasOption(Option.SKIP_PLUGINS); 264 276 if (skipLoadingPlugins) { 265 277 Main.info(tr("Plugin loading skipped")); … … 286 298 287 299 Main.platform.afterPrefStartupHook(); 288 300 } 301 302 /** 303 * Initializes all AWT/Swing stuff. 304 */ 305 private static void mainGui() { 289 306 FontsManager.initialize(); 290 307 … … 297 314 !args.hasOption(Option.NO_MAXIMIZE) && Main.pref.getBoolean("gui.maximized", false)); 298 315 final MainFrame mainFrame = new MainFrame(contentPanePrivate, geometry); 316 Main.mainPanel = mainFrame.getPanel(); 299 317 Main.parent = mainFrame; 300 318 -
trunk/src/org/openstreetmap/josm/gui/MainFrame.java
r12125 r12127 49 49 protected transient WindowGeometry geometry; 50 50 protected int windowState = JFrame.NORMAL; 51 private MainPanel panel;51 private final MainPanel panel; 52 52 private MainMenu menu; 53 53 … … 68 68 super(); 69 69 this.geometry = geometry; 70 this.panel = new MainPanel(Main.getLayerManager()); 70 71 setContentPane(contentPanePrivate); 71 72 } 72 73 73 74 /** 74 * Performs pre-initialization required before the call to {@link #initialize()}.75 * @since 1212576 */77 public void preInitialize() {78 panel = new MainPanel(Main.getLayerManager());79 }80 81 /**82 75 * Initializes the content of the window and get the current status panel. 83 * {@link #preInitialize()} must have been previously called.84 76 */ 85 77 public void initialize() { … … 138 130 * Gets the main panel. 139 131 * @return The main panel. 140 * @throws IllegalStateException if the main frame has not been initialized yet141 * @see #initialize142 132 * @since 12125 143 133 */ 144 134 public MainPanel getPanel() { 145 if (panel == null) {146 throw new IllegalStateException("Not initialized.");147 }148 135 return panel; 149 136 }
Note:
See TracChangeset
for help on using the changeset viewer.