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:
parent
22e7a51e6b
commit
296ae8054f
2 changed files with 35 additions and 15 deletions
|
@ -25,7 +25,6 @@ import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.IAdapterManager;
|
import org.eclipse.core.runtime.IAdapterManager;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||||
import org.eclipse.core.runtime.IProduct;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
|
@ -97,6 +96,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
private SystemTeamViewResourceAdapterFactory svraf; // for fastpath
|
private SystemTeamViewResourceAdapterFactory svraf; // for fastpath
|
||||||
private SystemShowPreferencesPageAction[] showPrefPageActions = null;
|
private SystemShowPreferencesPageAction[] showPrefPageActions = null;
|
||||||
private boolean dontShowLocalConnection, dontShowProfilePageInitially;
|
private boolean dontShowLocalConnection, dontShowProfilePageInitially;
|
||||||
|
private boolean loggingSystemMessageLine = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemsPlugin
|
* Constructor for SystemsPlugin
|
||||||
|
@ -124,7 +124,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
* Initializes default preferences.
|
* Initializes default preferences.
|
||||||
*/
|
*/
|
||||||
public void initializeDefaultPreferences() {
|
public void initializeDefaultPreferences() {
|
||||||
|
|
||||||
boolean showNewConnPromptPref = ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT;
|
boolean showNewConnPromptPref = ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT;
|
||||||
dontShowLocalConnection = false;
|
dontShowLocalConnection = false;
|
||||||
dontShowProfilePageInitially = false;
|
dontShowProfilePageInitially = false;
|
||||||
|
@ -165,6 +165,24 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
||||||
return !dontShowProfilePageInitially;
|
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)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.core.SystemBasePlugin#initializeImageRegistry()
|
* @see org.eclipse.rse.core.SystemBasePlugin#initializeImageRegistry()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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 type The type of the message - NONE, INFO, WARNING or ERROR.
|
||||||
* @param text The text to log.
|
* @param text The text to log.
|
||||||
* @param stackTrace If true then generate a stack trace in the log. Ignored if the
|
* @param stackTrace If true then generate a stack trace in the log. Ignored if the
|
||||||
* type is not ERROR.
|
* type is not ERROR.
|
||||||
*/
|
*/
|
||||||
private void logMessage(int type, String text, boolean stackTrace) {
|
private void logMessage(int type, String text, boolean stackTrace) {
|
||||||
switch (type) {
|
boolean logging = RSEUIPlugin.getDefault().getLoggingSystemMessageLine();
|
||||||
case ERROR:
|
if (logging) {
|
||||||
Exception e = stackTrace ? new Exception("Stack Trace") : null; //$NON-NLS-1$
|
switch (type) {
|
||||||
SystemBasePlugin.logError(text, e);
|
case ERROR:
|
||||||
break;
|
Exception e = stackTrace ? new Exception("Stack Trace") : null; //$NON-NLS-1$
|
||||||
case WARNING:
|
SystemBasePlugin.logError(text, e);
|
||||||
SystemBasePlugin.logWarning(text);
|
break;
|
||||||
break;
|
case WARNING:
|
||||||
case INFO:
|
SystemBasePlugin.logWarning(text);
|
||||||
case NONE:
|
break;
|
||||||
default:
|
default:
|
||||||
SystemBasePlugin.logInfo(text);
|
SystemBasePlugin.logInfo(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue