1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

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.

This commit is contained in:
David Dykstal 2006-09-22 21:31:45 +00:00
parent 22e7a51e6b
commit 296ae8054f
2 changed files with 35 additions and 15 deletions

View file

@ -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
@ -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()
*/

View file

@ -675,13 +675,16 @@ 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) {
boolean logging = RSEUIPlugin.getDefault().getLoggingSystemMessageLine();
if (logging) {
switch (type) {
case ERROR:
Exception e = stackTrace ? new Exception("Stack Trace") : null; //$NON-NLS-1$
@ -690,11 +693,10 @@ public class SystemMessageLine extends Composite implements ISystemMessageLine {
case WARNING:
SystemBasePlugin.logWarning(text);
break;
case INFO:
case NONE:
default:
SystemBasePlugin.logInfo(text);
}
}
}
}