diff options
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java | 37 | ||||
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java | 39 |
2 files changed, 44 insertions, 32 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 792126d64..138e35d2b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -26,17 +26,9 @@ import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; -import com.ibm.icu.text.MessageFormat; - -import org.osgi.framework.BundleContext; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import org.eclipse.osgi.service.environment.Constants; - +import org.eclipse.core.resources.ISaveContext; +import org.eclipse.core.resources.ISaveParticipant; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdapterManager; @@ -52,11 +44,6 @@ import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; - -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.ResourcesPlugin; - import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IDisconnect; import org.eclipse.debug.core.model.IDropToFrame; @@ -80,6 +67,14 @@ import org.eclipse.debug.internal.core.Preferences; import org.eclipse.debug.internal.core.StepFilterManager; import org.eclipse.debug.internal.core.commands.CommandAdapterFactory; import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils; +import org.eclipse.osgi.service.environment.Constants; +import org.osgi.framework.BundleContext; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import com.ibm.icu.text.MessageFormat; /** * There is one instance of the debug plug-in available from @@ -94,7 +89,7 @@ import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils; * <li>status handlers</li> * </ul> * @noinstantiate This class is not intended to be instantiated by clients. - * @noextend This class is not intended to be subclassed by clients. + * @noextend This class is not intended to be sub-classed by clients. */ public class DebugPlugin extends Plugin { @@ -301,8 +296,6 @@ public class DebugPlugin extends Plugin { */ public static final String ATTR_BREAKPOINT_IS_DELETED= DebugPlugin.getUniqueIdentifier() + ".breakpointIsDeleted"; //$NON-NLS-1$ - - /** * The singleton debug plug-in instance. */ @@ -364,7 +357,6 @@ public class DebugPlugin extends Plugin { private static final int NOTIFY_FILTERS = 0; private static final int NOTIFY_EVENTS = 1; - /** * Queue of debug events to fire to listeners and asynchronous runnables to execute * in the order received. @@ -653,7 +645,7 @@ public class DebugPlugin extends Plugin { */ public void start(BundleContext context) throws Exception { super.start(context); - DebugOptions.initDebugOptions(); + new DebugOptions(context); ResourcesPlugin.getWorkspace().addSaveParticipant(getUniqueIdentifier(), new ISaveParticipant() { public void saving(ISaveContext saveContext) throws CoreException { @@ -680,6 +672,7 @@ public class DebugPlugin extends Plugin { manager.registerAdapters(actionFactory, IDebugElement.class); getBreakpointManager(); fBreakpointManager.start(); + } /** diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java index 2345f0556..3449f607a 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugOptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2012 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 @@ -10,25 +10,44 @@ *******************************************************************************/ package org.eclipse.debug.internal.core; -import org.eclipse.core.runtime.Platform; +import java.util.Hashtable; + +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.osgi.service.debug.DebugOptionsListener; +import org.osgi.framework.BundleContext; /** * Access to debug options. * * @since 3.3 */ -public class DebugOptions { - +public class DebugOptions implements DebugOptionsListener { + // debug option flags public static boolean DEBUG = false; public static boolean DEBUG_COMMANDS = false; public static boolean DEBUG_EVENTS = false; - public static void initDebugOptions() { - DEBUG = "true".equals(Platform.getDebugOption("org.eclipse.debug.core/debug")); //$NON-NLS-1$//$NON-NLS-2$ - DEBUG_COMMANDS = DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.core/debug/commands")); //$NON-NLS-1$ - DEBUG_EVENTS = DEBUG && "true".equals( //$NON-NLS-1$ - Platform.getDebugOption("org.eclipse.debug.core/debug/events")); //$NON-NLS-1$ + static final String DEBUG_FLAG = "org.eclipse.debug.core/debug"; //$NON-NLS-1$ + static final String DEBUG_FLAG_COMMANDS = "org.eclipse.debug.core/debug/commands"; //$NON-NLS-1$ + static final String DEBUG_FLAG_EVENTS = "org.eclipse.debug.core/debug/events"; //$NON-NLS-1$ + + /** + * Constructor + * @param context the bundle context + */ + public DebugOptions(BundleContext context) { + Hashtable props = new Hashtable(2); + props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, DebugPlugin.getUniqueIdentifier()); + context.registerService(DebugOptionsListener.class.getName(), this, props); + } + + /* (non-Javadoc) + * @see org.eclipse.osgi.service.debug.DebugOptionsListener#optionsChanged(org.eclipse.osgi.service.debug.DebugOptions) + */ + public void optionsChanged(org.eclipse.osgi.service.debug.DebugOptions options) { + DEBUG = options.getBooleanOption(DEBUG_FLAG, false); + DEBUG_COMMANDS = DEBUG & options.getBooleanOption(DEBUG_FLAG_COMMANDS, false); + DEBUG_EVENTS = DEBUG & options.getBooleanOption(DEBUG_FLAG_EVENTS, false); } } |