mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
GUIUserNotifier uses active editor as parent component
This commit is contained in:
parent
17837197d1
commit
0b8e7922bf
@ -142,8 +142,6 @@ public class Base {
|
||||
BaseNoGui.initLogger();
|
||||
|
||||
initLogger();
|
||||
|
||||
BaseNoGui.notifier = new GUIUserNotifier();
|
||||
|
||||
BaseNoGui.initPlatform();
|
||||
|
||||
@ -270,6 +268,8 @@ public class Base {
|
||||
}
|
||||
|
||||
public Base(String[] args) throws Exception {
|
||||
BaseNoGui.notifier = new GUIUserNotifier(this);
|
||||
|
||||
String sketchbookPath = BaseNoGui.getSketchbookPath();
|
||||
|
||||
// If no path is set, get the default sketchbook folder for this platform
|
||||
|
@ -1,5 +1,7 @@
|
||||
package processing.app.helpers;
|
||||
|
||||
import processing.app.Base;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
import java.awt.Frame;
|
||||
@ -8,6 +10,12 @@ import javax.swing.JOptionPane;
|
||||
|
||||
public class GUIUserNotifier extends UserNotifier {
|
||||
|
||||
private final Base base;
|
||||
|
||||
public GUIUserNotifier(Base base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message that's actually fatal to the program.
|
||||
* This is an error that can't be recovered. Use showWarning()
|
||||
@ -16,7 +24,7 @@ public class GUIUserNotifier extends UserNotifier {
|
||||
public void showError(String title, String message, Throwable e, int exit_code) {
|
||||
if (title == null) title = _("Error");
|
||||
|
||||
JOptionPane.showMessageDialog(new Frame(), message, title,
|
||||
JOptionPane.showMessageDialog(base.getActiveEditor(), message, title,
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
if (e != null) e.printStackTrace();
|
||||
@ -30,7 +38,7 @@ public class GUIUserNotifier extends UserNotifier {
|
||||
public void showMessage(String title, String message) {
|
||||
if (title == null) title = _("Message");
|
||||
|
||||
JOptionPane.showMessageDialog(new Frame(), message, title,
|
||||
JOptionPane.showMessageDialog(base.getActiveEditor(), message, title,
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user