Skip to content

Commit e96a034

Browse files
committed
Move Splash initialization to EDT and make it no longer modal
- about 100ms faster startup (main method duration measured) and technically more correct anyway - use JFrame to get double buffering (no progress bar flicker during repaint) - other change: splash window is no longer modal - code renovations
1 parent 26a05a6 commit e96a034

3 files changed

Lines changed: 140 additions & 154 deletions

File tree

platform/core.startup/src/org/netbeans/core/startup/Main.java

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.netbeans.core.startup;
2121

22-
import java.beans.Introspector;
2322
import java.io.File;
2423
import java.io.IOException;
2524
import java.lang.reflect.InvocationTargetException;
@@ -89,7 +88,7 @@ public static void initUICustomizations() {
8988
return;
9089
}
9190

92-
Class uiClass = CLIOptions.uiClass;
91+
Class<?> uiClass = CLIOptions.uiClass;
9392
// try again loading L&F class, this time with full module system.
9493
if (CLIOptions.uiClassName != null && CLIOptions.uiClass == null) {
9594
// try again
@@ -163,7 +162,7 @@ public static ModuleSystem getModuleSystem(boolean init) {
163162
SystemFileSystem.registerMutex(moduleSystem.getManager().mutex());
164163
} catch (IOException ioe) {
165164
// System will be screwed up.
166-
throw (IllegalStateException) new IllegalStateException("Module system cannot be created").initCause(ioe); // NOI18N
165+
throw new IllegalStateException("Module system cannot be created", ioe); // NOI18N
167166
}
168167
StartLog.logProgress ("ModuleSystem created"); // NOI18N
169168
}
@@ -316,7 +315,6 @@ static void start (String[] args) throws SecurityException {
316315
level.run();
317316
}
318317

319-
Splash.getInstance().setRunning(false);
320318
Splash.getInstance().dispose();
321319
StartLog.logProgress ("Splash hidden"); // NOI18N
322320
StartLog.logEnd ("Preparation"); // NOI18N
@@ -347,7 +345,7 @@ private static void rm(File f) {
347345
}
348346

349347
/** Loads a class from available class loaders. */
350-
private static final Class getKlass(String cls) {
348+
private static Class<?> getKlass(String cls) {
351349
try {
352350
ClassLoader loader;
353351
ModuleSystem ms = moduleSystem;
@@ -380,7 +378,7 @@ public boolean shouldDoAnImport () {
380378
return classname != null && !installed.exists ();
381379
}
382380

383-
381+
@Override
384382
public void run() {
385383
// This module is included in our distro somewhere... may or may not be turned on.
386384
// Whatever - try running some classes from it anyway.
@@ -400,16 +398,12 @@ public void run() {
400398
} else {
401399
LOG.log(Level.WARNING, null, ex);
402400
}
403-
} catch (Exception e) {
401+
} catch (Exception | LinkageError e) {
404402
// If exceptions are thrown, notify them - something is broken.
405403
LOG.log(Level.WARNING, null, e);
406-
} catch (LinkageError e) {
407-
// These too...
408-
LOG.log(Level.WARNING, null, e);
409404
}
410405
}
411406

412-
413407
public boolean canContinue () {
414408
if (shouldDoAnImport ()) {
415409
try {
@@ -440,7 +434,6 @@ public boolean canContinue () {
440434
}
441435
}
442436

443-
444437
ImportHandler handler = new ImportHandler ();
445438

446439
return handler.canContinue ();
@@ -493,12 +486,9 @@ public void run() {
493486
} else {
494487
LOG.log(Level.WARNING, null, ex);
495488
}
496-
} catch (Exception ex) {
489+
} catch (Exception | LinkageError ex) {
497490
// If exceptions are thrown, notify them - something is broken.
498491
LOG.log(Level.WARNING, null, ex);
499-
} catch (LinkageError ex) {
500-
// These too...
501-
LOG.log(Level.WARNING, null, ex);
502492
}
503493
}
504494

0 commit comments

Comments
 (0)