Changeset 4681 in josm
- Timestamp:
- 2011-12-21T10:24:43+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r4582 r4681 22 22 import java.util.Collection; 23 23 import java.util.Iterator; 24 import java.util.LinkedList; 24 25 import java.util.List; 25 26 import java.util.Map; … … 222 223 } 223 224 225 private static InitStatusListener initListener = null; 226 227 public static interface InitStatusListener { 228 229 void updateStatus(String event); 230 } 231 232 public static void setInitStatusListener(InitStatusListener listener) { 233 initListener = listener; 234 } 235 224 236 public Main() { 225 237 main = this; 226 238 isOpenjdk = System.getProperty("java.vm.name").toUpperCase().indexOf("OPENJDK") != -1; 239 240 if (initListener != null) 241 initListener.updateStatus(tr("Executing platform startup hook")); 227 242 platform.startupHook(); 228 243 … … 230 245 // capabilities are already known to the editor instance. However 231 246 // if it goes wrong that's not critical at this stage. 247 if (initListener != null) 248 initListener.updateStatus(tr("Initializing OSM API")); 232 249 try { 233 250 OsmApi.getOsmApi().initialize(null, true); … … 236 253 } 237 254 255 if (initListener != null) 256 initListener.updateStatus(tr("Building main menu")); 238 257 contentPanePrivate.add(panel, BorderLayout.CENTER); 239 258 panel.add(gettingStarted, BorderLayout.CENTER); … … 248 267 KeyEvent.VK_F1, Shortcut.GROUP_DIRECT)); 249 268 269 if (initListener != null) 270 initListener.updateStatus(tr("Initializing presets")); 250 271 TaggingPresetPreference.initialize(); 272 273 if (initListener != null) 274 initListener.updateStatus(tr("Initializing map styles")); 251 275 MapPaintPreference.initialize(); 276 277 if (initListener != null) 278 initListener.updateStatus(tr("Loading imagery preferences")); 252 279 ImageryPreference.initialize(); 253 280 281 if (initListener != null) 282 initListener.updateStatus(tr("Initializing validator")); 254 283 validator = new OsmValidator(); 255 284 MapView.addLayerChangeListener(validator); … … 263 292 }); 264 293 FeatureAdapter.registerTranslationAdapter(I18n.getTranslationAdapter()); 294 295 if (initListener != null) 296 initListener.updateStatus(tr("Updating user interface")); 265 297 266 298 toolbar.refreshToolbarControl(); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r4527 r4681 210 210 211 211 SplashScreen splash = new SplashScreen(); 212 ProgressMonitor monitor = splash.getProgressMonitor();212 final ProgressMonitor monitor = splash.getProgressMonitor(); 213 213 monitor.beginTask(tr("Initializing")); 214 monitor.setTicksCount(7);215 214 splash.setVisible(Main.pref.getBoolean("draw.splashscreen", true)); 215 Main.setInitStatusListener(new InitStatusListener() { 216 217 @Override 218 public void updateStatus(String event) { 219 monitor.indeterminateSubTask(event); 220 } 221 }); 216 222 217 223 List<PluginInformation> pluginsToLoad = PluginHandler.buildListOfPluginsToLoad(splash,monitor.createSubTaskMonitor(1, false)); 218 224 if (!pluginsToLoad.isEmpty() && PluginHandler.checkAndConfirmPluginUpdate(splash)) { 219 monitor.subTask(tr("Updating plugins ..."));225 monitor.subTask(tr("Updating plugins")); 220 226 pluginsToLoad = PluginHandler.updatePlugins(splash,pluginsToLoad, monitor.createSubTaskMonitor(1, false)); 221 227 } 222 monitor.worked(1); 223 224 monitor.subTask(tr("Installing updated plugins")); 228 229 monitor.indeterminateSubTask(tr("Installing updated plugins")); 225 230 PluginHandler.installDownloadedPlugins(true); 226 monitor.worked(1); 227 228 monitor.subTask(tr("Loading early plugins")); 231 232 monitor.indeterminateSubTask(tr("Loading early plugins")); 229 233 PluginHandler.loadEarlyPlugins(splash,pluginsToLoad, monitor.createSubTaskMonitor(1, false)); 230 monitor.worked(1); 231 232 monitor.subTask(tr("Setting defaults")); 234 235 monitor.indeterminateSubTask(tr("Setting defaults")); 233 236 preConstructorInit(args); 234 237 removeObsoletePreferences(); 235 monitor.worked(1);236 238 237 239 monitor.indeterminateSubTask(tr("Creating main GUI")); … … 240 242 Main.addListener(); 241 243 final Main main = new MainApplication(mainFrame); 242 monitor.worked(1); 243 244 monitor.subTask(tr("Loading plugins")); 244 245 monitor.indeterminateSubTask(tr("Loading plugins")); 245 246 PluginHandler.loadLatePlugins(splash,pluginsToLoad, monitor.createSubTaskMonitor(1, false)); 246 monitor.worked(1);247 247 toolbar.refreshToolbarControl(); 248 248 splash.setVisible(false); -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r4030 r4681 13 13 import java.awt.event.MouseEvent; 14 14 15 import java.util.Arrays; 16 import java.util.LinkedList; 15 17 import javax.swing.JFrame; 16 18 import javax.swing.JLabel; … … 133 135 Dimension d = super.getPreferredSize(); 134 136 if(d.width < 600) d.width = 600; 137 d.height *= MAX_NUMBER_OF_MESSAGES; 135 138 return d; 136 139 } … … 167 170 } 168 171 172 private static final int MAX_NUMBER_OF_MESSAGES = 3; 173 private LinkedList<String> messages = new LinkedList<String>(Arrays.asList("", "", "")); //update when changing MAX_NUMBER_OF_MESSAGES 174 private long time = System.currentTimeMillis(); 175 176 /** 177 * Stores and displays the {@code MAX_NUMBER_OF_MESSAGES} most recent 178 * task titles together with their execution time. 179 */ 169 180 public void setTaskTitle(String taskTitle) { 170 lblTaskTitle.setText(taskTitle); 181 182 while (messages.size() >= MAX_NUMBER_OF_MESSAGES) { 183 messages.removeFirst(); 184 } 185 long now = System.currentTimeMillis(); 186 String prevMessageTitle = messages.getLast(); 187 if (!prevMessageTitle.isEmpty()) { 188 messages.removeLast(); 189 messages.add(tr("{0} ({1} ms)", prevMessageTitle, Long.toString(now - time))); 190 } 191 time = now; 192 if (!taskTitle.isEmpty()) { 193 messages.add(taskTitle); 194 } 195 String html = ""; 196 int i = 0; 197 for (String m : messages) { 198 html += "<p class=\"entry" + (++i) + "\">" + m + "</p>"; 199 } 200 201 lblTaskTitle.setText("<html><style>" 202 + ".entry1{color:#CCCCCC;}" 203 + ".entry2{color:#999999;}" 204 + ".entry3{color:#000000;}</style>" + html + "</html>"); //update when changing MAX_NUMBER_OF_MESSAGES 171 205 repaint(); 172 206 }
Note:
See TracChangeset
for help on using the changeset viewer.