mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
Changed UserNotifier from interface to abstract class.
This commit is contained in:
parent
bff6f2818b
commit
74f59c215a
@ -2,11 +2,7 @@ package processing.app.helpers;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
public class BasicUserNotifier implements UserNotifier {
|
||||
|
||||
public void showError(String title, String message, Throwable e) {
|
||||
showError(title, message, e, 1);
|
||||
}
|
||||
public class BasicUserNotifier extends UserNotifier {
|
||||
|
||||
/**
|
||||
* Show an error message that's actually fatal to the program.
|
||||
@ -28,4 +24,15 @@ public class BasicUserNotifier implements UserNotifier {
|
||||
System.out.println(title + ": " + message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-fatal error message with optional stack trace side dish.
|
||||
*/
|
||||
public void showWarning(String title, String message, Exception e) {
|
||||
if (title == null) title = _("Warning");
|
||||
|
||||
System.out.println(title + ": " + message);
|
||||
|
||||
if (e != null) e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,11 +6,7 @@ import java.awt.Frame;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class GUIUserNotifier implements UserNotifier {
|
||||
|
||||
public void showError(String title, String message, Throwable e) {
|
||||
showError(title, message, e, 1);
|
||||
}
|
||||
public class GUIUserNotifier extends UserNotifier {
|
||||
|
||||
/**
|
||||
* Show an error message that's actually fatal to the program.
|
||||
@ -38,4 +34,16 @@ public class GUIUserNotifier implements UserNotifier {
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-fatal error message with optional stack trace side dish.
|
||||
*/
|
||||
public void showWarning(String title, String message, Exception e) {
|
||||
if (title == null) title = _("Warning");
|
||||
|
||||
JOptionPane.showMessageDialog(new Frame(), message, title,
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
|
||||
if (e != null) e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,19 @@
|
||||
package processing.app.helpers;
|
||||
|
||||
public interface UserNotifier {
|
||||
public abstract class UserNotifier {
|
||||
|
||||
public void showError(String title, String message, Throwable e);
|
||||
public void showError(String title, String message, int exit_code) {
|
||||
showError(title, message, null, exit_code);
|
||||
}
|
||||
|
||||
public void showError(String title, String message, Throwable e, int exit_code);
|
||||
public void showError(String title, String message, Throwable e) {
|
||||
showError(title, message, e, 1);
|
||||
}
|
||||
|
||||
public void showMessage(String title, String message);
|
||||
public abstract void showError(String title, String message, Throwable e, int exit_code);
|
||||
|
||||
public abstract void showMessage(String title, String message);
|
||||
|
||||
public abstract void showWarning(String title, String message, Exception e);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user