Skip to content

Commit ca63ffc

Browse files
committed
extracted model and rewrote some of it
1 parent e96a034 commit ca63ffc

3 files changed

Lines changed: 201 additions & 218 deletions

File tree

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
package org.netbeans.core.startup;
2121

22-
import java.awt.Component;
2322
import java.awt.Desktop;
2423
import java.awt.Dimension;
2524
import java.awt.EventQueue;
2625
import java.awt.GraphicsEnvironment;
2726
import java.awt.event.ActionEvent;
2827
import java.awt.event.ActionListener;
2928
import java.io.File;
29+
import java.lang.reflect.InvocationTargetException;
3030
import java.util.ArrayList;
3131
import java.util.Collection;
3232
import java.util.List;
@@ -51,7 +51,6 @@
5151
import org.openide.modules.SpecificationVersion;
5252
import org.openide.util.NbBundle.Messages;
5353
import org.openide.util.NbCollections;
54-
import org.openide.util.RequestProcessor;
5554

5655
/** Report events to the performance logger, status text/splash screen,
5756
* console, and so on.
@@ -333,9 +332,8 @@ private void notify(String text, boolean warn) {
333332
private static final class Notifier implements Runnable {
334333
private static boolean showDialog = true;
335334

336-
private boolean warn;
335+
private final boolean warn;
337336
private String text;
338-
private static RequestProcessor RP = new RequestProcessor("Notify About Module System"); // NOI18N
339337

340338
public Notifier(String text, boolean type) {
341339
this.warn = type;
@@ -347,7 +345,11 @@ void show() {
347345
if (EventQueue.isDispatchThread()) {
348346
run();
349347
} else {
350-
RP.post(this, 0, Thread.MIN_PRIORITY).waitFinished ();
348+
try {
349+
EventQueue.invokeAndWait(this);
350+
} catch (InterruptedException | InvocationTargetException ex) {
351+
logger.log(Level.SEVERE, "Notifier failed", ex); // NOI18N
352+
}
351353
}
352354
}
353355
}
@@ -362,17 +364,9 @@ void show() {
362364
int type = warn ? JOptionPane.WARNING_MESSAGE : JOptionPane.INFORMATION_MESSAGE;
363365
String msg = warn ? MSG_warning() : MSG_info();
364366

365-
Splash out = Splash.getInstance();
366-
final Component c = out.getComponent() == null ? null : out.getComponent();
367367
try {
368368
UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());
369-
} catch (ClassNotFoundException ex) {
370-
logger.log(Level.INFO, null, ex);
371-
} catch (InstantiationException ex) {
372-
logger.log(Level.INFO, null, ex);
373-
} catch (IllegalAccessException ex) {
374-
logger.log(Level.INFO, null, ex);
375-
} catch (UnsupportedLookAndFeelException ex) {
369+
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
376370
logger.log(Level.INFO, null, ex);
377371
}
378372
JTextPane tp = new JTextPane ();
@@ -423,7 +417,7 @@ void show() {
423417
Object [] options = new JButton [] {continueButton, exitButton};
424418
op.setOptions (options);
425419
op.setInitialValue (options [1]);
426-
JDialog d = op.createDialog (c, msg);
420+
JDialog d = op.createDialog(Splash.getInstance().getComponent(), msg);
427421
d.setResizable (true);
428422
d.pack();
429423
d.setVisible (true);

0 commit comments

Comments
 (0)