diff options
author | Anton Leherbauer | 2008-03-13 15:22:13 +0000 |
---|---|---|
committer | Anton Leherbauer | 2008-03-13 15:22:13 +0000 |
commit | 72d5a9c71385607f5654900e4ea2642f0d53a3c6 (patch) | |
tree | 4bb55753b25581ad4e42ebd113dd4c04d530eaac /core/org.eclipse.cdt.core/src | |
parent | b1ec2cba256fa929ffc4922cd61c6c1a13343d23 (diff) | |
download | org.eclipse.cdt-72d5a9c71385607f5654900e4ea2642f0d53a3c6.tar.gz org.eclipse.cdt-72d5a9c71385607f5654900e4ea2642f0d53a3c6.tar.xz org.eclipse.cdt-72d5a9c71385607f5654900e4ea2642f0d53a3c6.zip |
Streamline logging methods
Diffstat (limited to 'core/org.eclipse.cdt.core/src')
-rw-r--r-- | core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index 5587cf3c31d..1776172f432 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.CDOM; import org.eclipse.cdt.core.dom.IPDOMManager; import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; import org.eclipse.cdt.core.index.IIndexManager; +import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.IWorkingCopy; import org.eclipse.cdt.core.parser.IScannerInfoProvider; @@ -257,11 +258,16 @@ public class CCorePlugin extends Plugin { } public static void log(Throwable e) { - if ( e instanceof CoreException ) { - log(((CoreException)e).getStatus()); - } else { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$ + log("Error", e); //$NON-NLS-1$ + } + + public static void log(String message, Throwable e) { + Throwable nestedException; + if (e instanceof CModelException + && (nestedException = ((CModelException)e).getException()) != null) { + e = nestedException; } + log(createStatus(message, e)); } public static IStatus createStatus(String msg) { @@ -273,7 +279,7 @@ public class CCorePlugin extends Plugin { } public static void log(IStatus status) { - ((Plugin) getDefault()).getLog().log(status); + getDefault().getLog().log(status); } // ------ CPlugin |