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