Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-07-31 21:23:12 +0000
committerThomas Watson2012-08-01 20:56:58 +0000
commit10c452a1403362ab2e4d5d08938c8347ba53c8ef (patch)
tree17bf9955a538f0af4bde61e3725bacc8382042b5 /bundles/org.eclipse.osgi/supplement/src
parenta2763d35135b047fdc8aeddf5b63c240a2a79667 (diff)
downloadrt.equinox.framework-10c452a1403362ab2e4d5d08938c8347ba53c8ef.tar.gz
rt.equinox.framework-10c452a1403362ab2e4d5d08938c8347ba53c8ef.tar.xz
rt.equinox.framework-10c452a1403362ab2e4d5d08938c8347ba53c8ef.zip
update storage for new container
Diffstat (limited to 'bundles/org.eclipse.osgi/supplement/src')
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/Debug.java42
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java2
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java50
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/next/internal/debug/Debug.java370
4 files changed, 410 insertions, 54 deletions
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/Debug.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/Debug.java
index 1bda1eb01..51b605d8d 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/Debug.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/Debug.java
@@ -155,27 +155,27 @@ public class Debug {
*/
public static final String OPTION_DEBUG_MESSAGE_BUNDLES = ECLIPSE_OSGI + "/debug/messageBundles"; //$NON-NLS-1$
- static {
- FrameworkDebugOptions dbgOptions = FrameworkDebugOptions.getDefault();
- if (dbgOptions != null) {
- DEBUG_ENABLED = dbgOptions.isDebugEnabled();
- DEBUG_GENERAL = dbgOptions.getBooleanOption(OPTION_DEBUG_GENERAL, false);
- DEBUG_BUNDLE_TIME = dbgOptions.getBooleanOption(OPTION_DEBUG_BUNDLE_TIME, false) || dbgOptions.getBooleanOption("org.eclipse.core.runtime/timing/startup", false); //$NON-NLS-1$
- DEBUG_LOADER = dbgOptions.getBooleanOption(OPTION_DEBUG_LOADER, false);
- DEBUG_EVENTS = dbgOptions.getBooleanOption(OPTION_DEBUG_EVENTS, false);
- DEBUG_SERVICES = dbgOptions.getBooleanOption(OPTION_DEBUG_SERVICES, false);
- DEBUG_HOOKS = dbgOptions.getBooleanOption(OPTION_DEBUG_HOOKS, false);
- DEBUG_PACKAGES = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGES, false);
- DEBUG_MANIFEST = dbgOptions.getBooleanOption(OPTION_DEBUG_MANIFEST, false);
- DEBUG_FILTER = dbgOptions.getBooleanOption(OPTION_DEBUG_FILTER, false);
- DEBUG_SECURITY = dbgOptions.getBooleanOption(OPTION_DEBUG_SECURITY, false);
- DEBUG_STARTLEVEL = dbgOptions.getBooleanOption(OPTION_DEBUG_STARTLEVEL, false);
- DEBUG_PACKAGEADMIN = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGEADMIN, false);
- DEBUG_PACKAGEADMIN_TIMING = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGEADMIN_TIMING, false) || dbgOptions.getBooleanOption("org.eclipse.core.runtime/debug", false); //$NON-NLS-1$
- DEBUG_MESSAGE_BUNDLES = dbgOptions.getBooleanOption(OPTION_DEBUG_MESSAGE_BUNDLES, false);
- MONITOR_ACTIVATION = dbgOptions.getBooleanOption(OPTION_MONITOR_ACTIVATION, false);
- }
- }
+ // static {
+ // FrameworkDebugOptions dbgOptions = FrameworkDebugOptions.getDefault();
+ // if (dbgOptions != null) {
+ // DEBUG_ENABLED = dbgOptions.isDebugEnabled();
+ // DEBUG_GENERAL = dbgOptions.getBooleanOption(OPTION_DEBUG_GENERAL, false);
+ // DEBUG_BUNDLE_TIME = dbgOptions.getBooleanOption(OPTION_DEBUG_BUNDLE_TIME, false) || dbgOptions.getBooleanOption("org.eclipse.core.runtime/timing/startup", false); //$NON-NLS-1$
+ // DEBUG_LOADER = dbgOptions.getBooleanOption(OPTION_DEBUG_LOADER, false);
+ // DEBUG_EVENTS = dbgOptions.getBooleanOption(OPTION_DEBUG_EVENTS, false);
+ // DEBUG_SERVICES = dbgOptions.getBooleanOption(OPTION_DEBUG_SERVICES, false);
+ // DEBUG_HOOKS = dbgOptions.getBooleanOption(OPTION_DEBUG_HOOKS, false);
+ // DEBUG_PACKAGES = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGES, false);
+ // DEBUG_MANIFEST = dbgOptions.getBooleanOption(OPTION_DEBUG_MANIFEST, false);
+ // DEBUG_FILTER = dbgOptions.getBooleanOption(OPTION_DEBUG_FILTER, false);
+ // DEBUG_SECURITY = dbgOptions.getBooleanOption(OPTION_DEBUG_SECURITY, false);
+ // DEBUG_STARTLEVEL = dbgOptions.getBooleanOption(OPTION_DEBUG_STARTLEVEL, false);
+ // DEBUG_PACKAGEADMIN = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGEADMIN, false);
+ // DEBUG_PACKAGEADMIN_TIMING = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGEADMIN_TIMING, false) || dbgOptions.getBooleanOption("org.eclipse.core.runtime/debug", false); //$NON-NLS-1$
+ // DEBUG_MESSAGE_BUNDLES = dbgOptions.getBooleanOption(OPTION_DEBUG_MESSAGE_BUNDLES, false);
+ // MONITOR_ACTIVATION = dbgOptions.getBooleanOption(OPTION_MONITOR_ACTIVATION, false);
+ // }
+ // }
/**
* The PrintStream to print debug messages to.
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java
index a21bbcd01..bf1610eac 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/EclipseDebugTrace.java
@@ -523,7 +523,7 @@ class EclipseDebugTrace implements DebugTrace {
writeComment(traceWriter, EclipseDebugTrace.TRACE_FILE_VERSION_COMMENT + EclipseDebugTrace.TRACE_FILE_VERSION);
writeComment(traceWriter, EclipseDebugTrace.TRACE_FILE_VERBOSE_COMMENT + debugOptions.isVerbose());
writeComment(traceWriter, "The following option strings are specified for this debug session:"); //$NON-NLS-1$
- final String[] allOptions = FrameworkDebugOptions.getDefault().getAllOptions();
+ final String[] allOptions = debugOptions.getAllOptions();
for (int i = 0; i < allOptions.length; i++) {
writeComment(traceWriter, "\t" + allOptions[i]); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java
index d686ac843..f5142eb98 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java
@@ -14,7 +14,7 @@ import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
-import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
+import org.eclipse.osgi.internal.framework.EquinoxConfiguration;
import org.eclipse.osgi.service.debug.*;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
@@ -32,35 +32,33 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
private static final String OSGI_DEBUG = "osgi.debug"; //$NON-NLS-1$
private static final String OSGI_DEBUG_VERBOSE = "osgi.debug.verbose"; //$NON-NLS-1$
public static final String PROP_TRACEFILE = "osgi.tracefile"; //$NON-NLS-1$
+ /** The default name of the .options file if loading when the -debug command-line argument is used */
+ private static final String OPTIONS = ".options"; //$NON-NLS-1$
+
/** monitor used to lock the options maps */
private final Object lock = new Object();
/** A current map of all the options with values set */
private Properties options = null;
/** A map of all the disabled options with values set at the time debug was disabled */
private Properties disabledOptions = null;
- /** The singleton object of this class */
- private static FrameworkDebugOptions singleton = null;
- /** The default name of the .options file if loading when the -debug command-line argument is used */
- private static final String OPTIONS = ".options"; //$NON-NLS-1$
/** A cache of all of the bundles <code>DebugTrace</code> in the format <key,value> --> <bundle name, DebugTrace> */
- protected final static Map<String, DebugTrace> debugTraceCache = new HashMap<String, DebugTrace>();
+ protected final Map<String, DebugTrace> debugTraceCache = new HashMap<String, DebugTrace>();
/** The File object to store messages. This value may be null. */
protected File outFile = null;
/** Is verbose debugging enabled? Changing this value causes a new tracing session to start. */
protected boolean verboseDebug = true;
+ private final EquinoxConfiguration environmentInfo;
private volatile BundleContext context;
private volatile ServiceTracker<DebugOptionsListener, DebugOptionsListener> listenerTracker;
- /**
- * Internal constructor to create a <code>FrameworkDebugOptions</code> singleton object.
- */
- private FrameworkDebugOptions() {
+ public FrameworkDebugOptions(EquinoxConfiguration environmentInfo) {
+ this.environmentInfo = environmentInfo;
// check if verbose debugging was set during initialization. This needs to be set even if debugging is disabled
- this.verboseDebug = Boolean.valueOf(FrameworkProperties.getProperty(OSGI_DEBUG_VERBOSE, Boolean.TRUE.toString())).booleanValue();
+ this.verboseDebug = Boolean.valueOf(environmentInfo.getConfiguration(OSGI_DEBUG_VERBOSE, Boolean.TRUE.toString())).booleanValue();
// if no debug option was specified, don't even bother to try.
// Must ensure that the options slot is null as this is the signal to the
// platform that debugging is not enabled.
- String debugOptionsFilename = FrameworkProperties.getProperty(OSGI_DEBUG);
+ String debugOptionsFilename = environmentInfo.getConfiguration(OSGI_DEBUG);
if (debugOptionsFilename == null)
return;
options = new Properties();
@@ -69,7 +67,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
// default options location is user.dir (install location may be r/o so
// is not a good candidate for a trace options that need to be updatable by
// by the user)
- String userDir = FrameworkProperties.getProperty("user.dir").replace(File.separatorChar, '/'); //$NON-NLS-1$
+ String userDir = System.getProperty("user.dir").replace(File.separatorChar, '/'); //$NON-NLS-1$
if (!userDir.endsWith("/")) //$NON-NLS-1$
userDir += "/"; //$NON-NLS-1$
debugOptionsFilename = new File(userDir, OPTIONS).toString();
@@ -112,18 +110,6 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
this.context = null;
}
- /**
- * Returns the singleton instance of <code>FrameworkDebugOptions</code>.
- * @return the instance of <code>FrameworkDebugOptions</code>
- */
- public static FrameworkDebugOptions getDefault() {
-
- if (FrameworkDebugOptions.singleton == null) {
- FrameworkDebugOptions.singleton = new FrameworkDebugOptions();
- }
- return FrameworkDebugOptions.singleton;
- }
-
@SuppressWarnings("deprecation")
private static URL buildURL(String spec, boolean trailingSlash) {
if (spec == null)
@@ -363,7 +349,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
EclipseDebugTrace.newSession = true;
// enable platform debugging - there is no .options file
- FrameworkProperties.setProperty(OSGI_DEBUG, ""); //$NON-NLS-1$
+ environmentInfo.setConfiguration(OSGI_DEBUG, ""); //$NON-NLS-1$
if (disabledOptions != null) {
options = disabledOptions;
disabledOptions = null;
@@ -376,7 +362,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
if (options == null)
return;
// disable platform debugging.
- FrameworkProperties.clearProperty(OSGI_DEBUG);
+ environmentInfo.clearConfiguration(OSGI_DEBUG);
if (options.size() > 0) {
// Save the current options off in case debug is re-enabled
disabledOptions = options;
@@ -408,11 +394,11 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
public final DebugTrace newDebugTrace(String bundleSymbolicName, Class<?> traceEntryClass) {
DebugTrace debugTrace = null;
- synchronized (FrameworkDebugOptions.debugTraceCache) {
- debugTrace = FrameworkDebugOptions.debugTraceCache.get(bundleSymbolicName);
+ synchronized (debugTraceCache) {
+ debugTrace = debugTraceCache.get(bundleSymbolicName);
if (debugTrace == null) {
- debugTrace = new EclipseDebugTrace(bundleSymbolicName, FrameworkDebugOptions.singleton, traceEntryClass);
- FrameworkDebugOptions.debugTraceCache.put(bundleSymbolicName, debugTrace);
+ debugTrace = new EclipseDebugTrace(bundleSymbolicName, this, traceEntryClass);
+ debugTraceCache.put(bundleSymbolicName, debugTrace);
}
}
return debugTrace;
@@ -434,7 +420,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
public synchronized void setFile(final File traceFile) {
this.outFile = traceFile;
- FrameworkProperties.setProperty(PROP_TRACEFILE, this.outFile.getAbsolutePath());
+ environmentInfo.setConfiguration(PROP_TRACEFILE, this.outFile.getAbsolutePath());
// the file changed so start a new session
EclipseDebugTrace.newSession = true;
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/next/internal/debug/Debug.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/next/internal/debug/Debug.java
new file mode 100644
index 000000000..89031bffe
--- /dev/null
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/next/internal/debug/Debug.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osgi.next.internal.debug;
+
+import java.io.PrintStream;
+import java.lang.reflect.*;
+import org.eclipse.osgi.internal.framework.EquinoxContainer;
+import org.eclipse.osgi.service.debug.DebugOptions;
+
+/**
+ * This class has debug constants which can be used by the Framework implementation
+ * and Adaptor implementations
+ * @since 3.1
+ */
+public class Debug {
+ /**
+ * Base debug option key (org.eclispe.osgi).
+ */
+ public static final String ECLIPSE_OSGI = EquinoxContainer.NAME;
+ /**
+ * General Debug option key.
+ */
+ public static final String OPTION_DEBUG_GENERAL = ECLIPSE_OSGI + "/debug"; //$NON-NLS-1$
+ /**
+ * Bundle time Debug option key.
+ */
+ // TODO remove this or use it somewhere
+ public static final String OPTION_DEBUG_BUNDLE_TIME = ECLIPSE_OSGI + "/debug/bundleTime"; //$NON-NLS-1$
+ /**
+ * Loader Debug option key.
+ */
+ public static final String OPTION_DEBUG_LOADER = ECLIPSE_OSGI + "/debug/loader"; //$NON-NLS-1$
+ /**
+ * Events Debug option key.
+ */
+ public static final String OPTION_DEBUG_EVENTS = ECLIPSE_OSGI + "/debug/events"; //$NON-NLS-1$
+ /**
+ * Services Debug option key.
+ */
+ public static final String OPTION_DEBUG_SERVICES = ECLIPSE_OSGI + "/debug/services"; //$NON-NLS-1$
+ /**
+ * Services Debug option key.
+ */
+ public static final String OPTION_DEBUG_HOOKS = ECLIPSE_OSGI + "/debug/hooks"; //$NON-NLS-1$
+ /**
+ * Packages Debug option key.
+ */
+ public static final String OPTION_DEBUG_PACKAGES = ECLIPSE_OSGI + "/debug/packages"; //$NON-NLS-1$
+ /**
+ * Manifest Debug option key.
+ */
+ public static final String OPTION_DEBUG_MANIFEST = ECLIPSE_OSGI + "/debug/manifest"; //$NON-NLS-1$
+ /**
+ * Filter Debug option key.
+ */
+ public static final String OPTION_DEBUG_FILTER = ECLIPSE_OSGI + "/debug/filter"; //$NON-NLS-1$
+ /**
+ * Security Debug option key.
+ */
+ public static final String OPTION_DEBUG_SECURITY = ECLIPSE_OSGI + "/debug/security"; //$NON-NLS-1$
+ /**
+ * Start level Debug option key.
+ */
+ public static final String OPTION_DEBUG_STARTLEVEL = ECLIPSE_OSGI + "/debug/startlevel"; //$NON-NLS-1$
+ /**
+ * PackageAdmin Debug option key.
+ */
+ public static final String OPTION_DEBUG_PACKAGEADMIN = ECLIPSE_OSGI + "/debug/packageadmin"; //$NON-NLS-1$
+ /**
+ * PackageAdmin timing Debug option key.
+ */
+ public static final String OPTION_DEBUG_PACKAGEADMIN_TIMING = ECLIPSE_OSGI + "/debug/packageadmin/timing"; //$NON-NLS-1$
+ /**
+ * Monitor activation Debug option key.
+ */
+ public static final String OPTION_MONITOR_ACTIVATION = ECLIPSE_OSGI + "/monitor/activation"; //$NON-NLS-1$
+ /**
+ * Message bundles Debug option key.
+ */
+ public static final String OPTION_DEBUG_MESSAGE_BUNDLES = ECLIPSE_OSGI + "/debug/messageBundles"; //$NON-NLS-1$
+
+ public static final String OPTION_DEBUG_LOCATION = ECLIPSE_OSGI + "/debug/location"; //$NON-NLS-1$
+
+ /**
+ * Indicates if tracing is enabled
+ */
+ public boolean DEBUG_ENABLED = false;
+
+ /**
+ * General debug flag.
+ */
+ public boolean DEBUG_GENERAL = false; // "debug"
+ /**
+ * Bundle time debug flag.
+ */
+ public boolean DEBUG_BUNDLE_TIME = false; //"debug.bundleTime"
+ /**
+ * Loader debug flag.
+ */
+ public boolean DEBUG_LOADER = false; // "debug.loader"
+ /**
+ * Events debug flag.
+ */
+ public boolean DEBUG_EVENTS = false; // "debug.events"
+ /**
+ * Services debug flag.
+ */
+ public boolean DEBUG_SERVICES = false; // "debug.services"
+
+ /**
+ * Hooks debug flag.
+ */
+ public boolean DEBUG_HOOKS = false; // "debug.hooks"
+ /**
+ * Packages debug flag.
+ */
+ // TODO remove this or use it somewhere
+ public boolean DEBUG_PACKAGES = false; // "debug.packages"
+ /**
+ * Manifest debug flag.
+ */
+ public boolean DEBUG_MANIFEST = false; // "debug.manifest"
+ /**
+ * Filter debug flag.
+ */
+ public boolean DEBUG_FILTER = false; // "debug.filter"
+ /**
+ * Security debug flag.
+ */
+ public boolean DEBUG_SECURITY = false; // "debug.security"
+ /**
+ * Start level debug flag.
+ */
+ public boolean DEBUG_STARTLEVEL = false; // "debug.startlevel"
+ /**
+ * PackageAdmin debug flag.
+ */
+ public boolean DEBUG_PACKAGEADMIN = false; // "debug.packageadmin"
+ /**
+ * PackageAdmin timing debug flag.
+ */
+ // TODO remove this or use it somewhere
+ public boolean DEBUG_PACKAGEADMIN_TIMING = false; //"debug.packageadmin/timing"
+ /**
+ * Message debug flag.
+ */
+ public boolean DEBUG_MESSAGE_BUNDLES = false; //"/debug/messageBundles"
+ /**
+ * Monitor activation debug flag.
+ */
+ public boolean MONITOR_ACTIVATION = false; // "monitor/bundles"
+
+ public boolean DEBUG_LOCATION = false; // debug/location
+
+ public Debug(DebugOptions dbgOptions) {
+ if (dbgOptions == null) {
+ return;
+ }
+ DEBUG_ENABLED = dbgOptions.isDebugEnabled();
+ DEBUG_GENERAL = dbgOptions.getBooleanOption(OPTION_DEBUG_GENERAL, false);
+ DEBUG_BUNDLE_TIME = dbgOptions.getBooleanOption(OPTION_DEBUG_BUNDLE_TIME, false) || dbgOptions.getBooleanOption("org.eclipse.core.runtime/timing/startup", false); //$NON-NLS-1$
+ DEBUG_LOADER = dbgOptions.getBooleanOption(OPTION_DEBUG_LOADER, false);
+ DEBUG_EVENTS = dbgOptions.getBooleanOption(OPTION_DEBUG_EVENTS, false);
+ DEBUG_SERVICES = dbgOptions.getBooleanOption(OPTION_DEBUG_SERVICES, false);
+ DEBUG_HOOKS = dbgOptions.getBooleanOption(OPTION_DEBUG_HOOKS, false);
+ DEBUG_PACKAGES = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGES, false);
+ DEBUG_MANIFEST = dbgOptions.getBooleanOption(OPTION_DEBUG_MANIFEST, false);
+ DEBUG_FILTER = dbgOptions.getBooleanOption(OPTION_DEBUG_FILTER, false);
+ DEBUG_SECURITY = dbgOptions.getBooleanOption(OPTION_DEBUG_SECURITY, false);
+ DEBUG_STARTLEVEL = dbgOptions.getBooleanOption(OPTION_DEBUG_STARTLEVEL, false);
+ DEBUG_PACKAGEADMIN = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGEADMIN, false);
+ DEBUG_PACKAGEADMIN_TIMING = dbgOptions.getBooleanOption(OPTION_DEBUG_PACKAGEADMIN_TIMING, false) || dbgOptions.getBooleanOption("org.eclipse.core.runtime/debug", false); //$NON-NLS-1$
+ DEBUG_MESSAGE_BUNDLES = dbgOptions.getBooleanOption(OPTION_DEBUG_MESSAGE_BUNDLES, false);
+ MONITOR_ACTIVATION = dbgOptions.getBooleanOption(OPTION_MONITOR_ACTIVATION, false);
+ DEBUG_LOCATION = dbgOptions.getBooleanOption(OPTION_DEBUG_LOCATION, false);
+ }
+
+ /**
+ * The PrintStream to print debug messages to.
+ */
+ public static PrintStream out = System.out;
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(boolean x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(char x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(int x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(long x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(float x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(double x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(char x[]) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(String x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void print(Object x) {
+ out.print(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(boolean x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(char x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(int x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(long x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(float x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(double x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(char x[]) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(String x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints x to the PrintStream
+ * @param x
+ */
+ public static void println(Object x) {
+ out.println(x);
+ }
+
+ /**
+ * Prints t to the PrintStream
+ * @param t
+ */
+ public static void printStackTrace(Throwable t) {
+ if (t == null)
+ return;
+ t.printStackTrace(out);
+
+ Method[] methods = t.getClass().getMethods();
+
+ int size = methods.length;
+ Class<?> throwable = Throwable.class;
+
+ for (int i = 0; i < size; i++) {
+ Method method = methods[i];
+
+ if (Modifier.isPublic(method.getModifiers()) && method.getName().startsWith("get") && throwable.isAssignableFrom(method.getReturnType()) && (method.getParameterTypes().length == 0)) { //$NON-NLS-1$
+ try {
+ Throwable nested = (Throwable) method.invoke(t, (Object[]) null);
+
+ if ((nested != null) && (nested != t)) {
+ out.println("Nested Exception:"); //$NON-NLS-1$
+ printStackTrace(nested);
+ }
+ } catch (IllegalAccessException e) {
+ // nothing
+ } catch (InvocationTargetException e) {
+ // nothing
+ }
+ }
+ }
+ }
+
+}

Back to the top