From bc6b488cf66bb4fdd1d977d4720ce351209364b2 Mon Sep 17 00:00:00 2001 From: Claudio Indellicati Date: Thu, 21 Aug 2014 19:55:50 +0200 Subject: [PATCH] Removed leftover references to Base in BaseNoGui. --- app/src/processing/app/Base.java | 10 +--------- app/src/processing/app/BaseNoGui.java | 15 +++++++++++---- app/src/processing/app/helpers/BasicNotifier.java | 6 ++++++ app/src/processing/app/helpers/GUINotifier.java | 12 ++++++++++++ app/src/processing/app/helpers/UserNotifier.java | 2 ++ 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 6ee6acd14..b8d888b26 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -2257,15 +2257,7 @@ public class Base { * much of a bummer, but something to notify the user about. */ static public void showMessage(String title, String message) { - if (title == null) title = _("Message"); - - if (commandLine) { - System.out.println(title + ": " + message); - - } else { - JOptionPane.showMessageDialog(new Frame(), message, title, - JOptionPane.INFORMATION_MESSAGE); - } + BaseNoGui.showMessage(title, message); } diff --git a/app/src/processing/app/BaseNoGui.java b/app/src/processing/app/BaseNoGui.java index 340f7d9ea..a12c9f4a7 100644 --- a/app/src/processing/app/BaseNoGui.java +++ b/app/src/processing/app/BaseNoGui.java @@ -275,9 +275,9 @@ public class BaseNoGui { } platform = (Platform) platformClass.newInstance(); } catch (Exception e) { - Base.showError(_("Problem Setting the Platform"), - _("An unknown error occurred while trying to load\n" + - "platform-specific code for your machine."), e); + showError(_("Problem Setting the Platform"), + _("An unknown error occurred while trying to load\n" + + "platform-specific code for your machine."), e); } } @@ -413,7 +413,7 @@ public class BaseNoGui { + "Library names must contain only basic letters and numbers.\n" + "(ASCII only and no spaces, and it cannot start with a number)"), libName); - Base.showMessage(_("Ignoring bad library name"), mess); + showMessage(_("Ignoring bad library name"), mess); continue; } @@ -443,4 +443,11 @@ public class BaseNoGui { notifier.showError(title, message, e, exit_code); } + /** + * "No cookie for you" type messages. Nothing fatal or all that + * much of a bummer, but something to notify the user about. + */ + static public void showMessage(String title, String message) { + notifier.showMessage(title, message); + } } diff --git a/app/src/processing/app/helpers/BasicNotifier.java b/app/src/processing/app/helpers/BasicNotifier.java index 72146188b..3abb5d7d5 100644 --- a/app/src/processing/app/helpers/BasicNotifier.java +++ b/app/src/processing/app/helpers/BasicNotifier.java @@ -22,4 +22,10 @@ public class BasicNotifier implements UserNotifier { System.exit(exit_code); } + public void showMessage(String title, String message) { + if (title == null) title = _("Message"); + + System.out.println(title + ": " + message); + } + } diff --git a/app/src/processing/app/helpers/GUINotifier.java b/app/src/processing/app/helpers/GUINotifier.java index ecee305d0..0aea8d216 100644 --- a/app/src/processing/app/helpers/GUINotifier.java +++ b/app/src/processing/app/helpers/GUINotifier.java @@ -26,4 +26,16 @@ public class GUINotifier implements UserNotifier { if (e != null) e.printStackTrace(); System.exit(exit_code); } + + /** + * "No cookie for you" type messages. Nothing fatal or all that + * much of a bummer, but something to notify the user about. + */ + public void showMessage(String title, String message) { + if (title == null) title = _("Message"); + + JOptionPane.showMessageDialog(new Frame(), message, title, + JOptionPane.INFORMATION_MESSAGE); + } + } diff --git a/app/src/processing/app/helpers/UserNotifier.java b/app/src/processing/app/helpers/UserNotifier.java index 62388de68..082cae4e2 100644 --- a/app/src/processing/app/helpers/UserNotifier.java +++ b/app/src/processing/app/helpers/UserNotifier.java @@ -6,4 +6,6 @@ public interface UserNotifier { public void showError(String title, String message, Throwable e, int exit_code); + public void showMessage(String title, String message); + }