mirror of https://github.com/noisymime/Arduino.git
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._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
public class BasicUserNotifier implements UserNotifier {
|
public class BasicUserNotifier extends UserNotifier {
|
||||||
|
|
||||||
public void showError(String title, String message, Throwable e) {
|
|
||||||
showError(title, message, e, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an error message that's actually fatal to the program.
|
* 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);
|
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;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
public class GUIUserNotifier implements UserNotifier {
|
public class GUIUserNotifier extends UserNotifier {
|
||||||
|
|
||||||
public void showError(String title, String message, Throwable e) {
|
|
||||||
showError(title, message, e, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an error message that's actually fatal to the program.
|
* Show an error message that's actually fatal to the program.
|
||||||
|
@ -38,4 +34,16 @@ public class GUIUserNotifier implements UserNotifier {
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
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;
|
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…
Reference in New Issue