From 296ae8054f383822e6f17e430f00f3c946d8a592 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Fri, 22 Sep 2006 21:31:45 +0000 Subject: [PATCH] Bug 158320 - An API call has been added to RSEUIPlugin to set and retrieve a setting for logging. The default is to not log these messages. --- .../UI/org/eclipse/rse/ui/RSEUIPlugin.java | 22 +++++++++++++-- .../rse/ui/messages/SystemMessageLine.java | 28 ++++++++++--------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java index 4ab65ce24c0..d8de8a2a2bb 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java @@ -25,7 +25,6 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IAdapterManager; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IProduct; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.rse.core.IRSESystemType; @@ -97,6 +96,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi private SystemTeamViewResourceAdapterFactory svraf; // for fastpath private SystemShowPreferencesPageAction[] showPrefPageActions = null; private boolean dontShowLocalConnection, dontShowProfilePageInitially; + private boolean loggingSystemMessageLine = false; /** * Constructor for SystemsPlugin @@ -124,7 +124,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi * Initializes default preferences. */ public void initializeDefaultPreferences() { - + boolean showNewConnPromptPref = ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT; dontShowLocalConnection = false; dontShowProfilePageInitially = false; @@ -165,6 +165,24 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi return !dontShowProfilePageInitially; } + /** + * Set whether or not to log the messages shown on the system message line for dialogs + * and wizards. These message are typically validation messages for fields. + * These are logged using the RSE logging settings. The default is to not log + * these messages. + * @param flag true if logging of these messages is desired, false otherwise. + */ + public void setLoggingSystemMessageLine(boolean flag) { + loggingSystemMessageLine = flag; + } + + /** + * @return true if we are logging messages displayed on the system message line. + */ + public boolean getLoggingSystemMessageLine() { + return loggingSystemMessageLine; + } + /* (non-Javadoc) * @see org.eclipse.rse.core.SystemBasePlugin#initializeImageRegistry() */ diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java index 20bdf6e5412..a74aefac7aa 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java @@ -675,25 +675,27 @@ public class SystemMessageLine extends Composite implements ISystemMessageLine { } /** - * Sends a text message to the log. + * Sends a text message to the log. Will log messages only if the RSEUIPlugin has been + * set to log these. * @param type The type of the message - NONE, INFO, WARNING or ERROR. * @param text The text to log. * @param stackTrace If true then generate a stack trace in the log. Ignored if the * type is not ERROR. */ private void logMessage(int type, String text, boolean stackTrace) { - switch (type) { - case ERROR: - Exception e = stackTrace ? new Exception("Stack Trace") : null; //$NON-NLS-1$ - SystemBasePlugin.logError(text, e); - break; - case WARNING: - SystemBasePlugin.logWarning(text); - break; - case INFO: - case NONE: - default: - SystemBasePlugin.logInfo(text); + boolean logging = RSEUIPlugin.getDefault().getLoggingSystemMessageLine(); + if (logging) { + switch (type) { + case ERROR: + Exception e = stackTrace ? new Exception("Stack Trace") : null; //$NON-NLS-1$ + SystemBasePlugin.logError(text, e); + break; + case WARNING: + SystemBasePlugin.logWarning(text); + break; + default: + SystemBasePlugin.logInfo(text); + } } }