diff options
author | Pawel Piech | 2012-03-13 18:31:36 +0000 |
---|---|---|
committer | Pawel Piech | 2012-03-19 03:50:44 +0000 |
commit | b9f5e87587dae4cecab6e29853c873caa090a055 (patch) | |
tree | 9919f072c9ac86f782b7467f0fdd9a287e8fe343 /debug/org.eclipse.cdt.debug.ui/src | |
parent | 5fc0587f6d7839eb356965a72a472f82e788e4c9 (diff) | |
download | org.eclipse.cdt-b9f5e87587dae4cecab6e29853c873caa090a055.tar.gz org.eclipse.cdt-b9f5e87587dae4cecab6e29853c873caa090a055.tar.xz org.eclipse.cdt-b9f5e87587dae4cecab6e29853c873caa090a055.zip |
Bug 360588 - [breakpoints] Allow user to edit all its properties prior to creating the breakpoint
Added ICBreakpointContext interface.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src')
4 files changed, 78 insertions, 19 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java index fbbb8343edf..d1d359322ef 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java @@ -15,6 +15,7 @@ import java.util.Map; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICTracepoint; +import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdapterFactory; @@ -24,7 +25,6 @@ import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IDebugModelProvider; import org.eclipse.debug.ui.contexts.IDebugContextListener; -import org.eclipse.debug.ui.contexts.IDebugContextProvider; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -37,7 +37,7 @@ import org.eclipse.ui.IWorkbenchPart; * This combined context can then be used by breakpoint property * pages to access model and target specific breakpoint settings. */ -public class CBreakpointContext extends PlatformObject implements IDebugContextProvider { +public class CBreakpointContext extends PlatformObject implements ICBreakpointContext { // Register an adapter factory for the class when it is first loaded. static { @@ -62,7 +62,7 @@ public class CBreakpointContext extends PlatformObject implements IDebugContextP /** * Associated preference store. */ - final CBreakpointPreferenceStore fPreferenceStore; + private final CBreakpointPreferenceStore fPreferenceStore; /** * Creates a new breakpoint context with given breakpoint and debug @@ -79,13 +79,15 @@ public class CBreakpointContext extends PlatformObject implements IDebugContextP fPreferenceStore = new CBreakpointPreferenceStore(this, attributes); } - /** - * Returns the breakpoint. - */ + @Override public ICBreakpoint getBreakpoint() { return fBreakpoint; } + @Override public IResource getResource() { return fResource; } + @Override + public IPreferenceStore getPreferenceStore() { return fPreferenceStore; } + /** * Returns the debug context. */ @@ -170,7 +172,7 @@ class CBreakpointContextAdapterFactory implements IAdapterFactory { } if ( IPreferenceStore.class.equals(adapterType) ) { - return ((CBreakpointContext)obj).fPreferenceStore; + return ((CBreakpointContext)obj).getPreferenceStore(); } if (IActionFilter.class.equals(adapterType)) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java index aa1b7de7e16..94777da096e 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java @@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory; +import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext; import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution; import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor; import org.eclipse.core.resources.IFile; @@ -389,16 +390,16 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement public IPreferenceStore getPreferenceStore() { IAdaptable element = getElement(); - IPreferenceStore store = (IPreferenceStore) element.getAdapter(IPreferenceStore.class); - if (store == null) { - if (fCBreakpointPreferenceStore == null) { - CBreakpointContext bpContext = element instanceof CBreakpointContext ? - (CBreakpointContext)element : null; - fCBreakpointPreferenceStore = new CBreakpointPreferenceStore(bpContext, null); - } - store = fCBreakpointPreferenceStore; - } - return store; + if (element instanceof ICBreakpointContext) { + return ((ICBreakpointContext)element).getPreferenceStore(); + } + + if (fCBreakpointPreferenceStore == null) { + CBreakpointContext bpContext = element instanceof CBreakpointContext ? + (CBreakpointContext)element : null; + fCBreakpointPreferenceStore = new CBreakpointPreferenceStore(bpContext, null); + } + return fCBreakpointPreferenceStore; } @Override diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java index 6acd34d8295..a2f1824acb8 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.debug.internal.ui.breakpoints; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext; import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -25,13 +26,13 @@ public class CreateBreakpointTester extends PropertyTester { @Override public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (PROP_CREATE_BREAKPOINT_ADAPT.equals(property) && - receiver instanceof CBreakpointContext && + receiver instanceof ICBreakpointContext && expectedValue instanceof String) { try { Class<?> expectedClass = Class.forName((String)expectedValue); return expectedClass.isAssignableFrom( - ((CBreakpointContext)receiver).getBreakpoint().getClass()); + ((ICBreakpointContext)receiver).getBreakpoint().getClass()); } catch (ClassNotFoundException e) { CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Unable to create class: " + expectedValue, e)); //$NON-NLS-1$ } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java new file mode 100644 index 00000000000..8527732e80b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2012 Wind River Systems 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpoints; + +import org.eclipse.cdt.debug.core.model.ICBreakpoint; +import org.eclipse.core.resources.IResource; +import org.eclipse.debug.ui.contexts.IDebugContextProvider; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * Input for the breakpoint properties dialog. It captures both the + * selected breakpoint object as well as the selected debug context. + * This combined context can then be used by breakpoint property + * pages to access model and target specific breakpoint settings. + * + * @since 7.2 + */ +public interface ICBreakpointContext extends IDebugContextProvider { + + /** + * Returns the breakpoint object that this context represents. + * <p> + * Note: The returned breakpoint may not yet have an associated marker. + * This is for the case where the property dialog is opened for a breakpoint + * that is yet to be created. + * + * @return Breakpoint object. + */ + public ICBreakpoint getBreakpoint(); + + /** + * Resource object that the breakpoint marker is on. In case where + * the breakpoint marker is not yet created, clients can access the intended + * breakpoint resource object through this method. + * + * @return The breakpoint's resource object. + */ + public IResource getResource(); + + /** + * Returns the preference store to be used by property pages. This + * preference overrides values in the breakpoint marker. + * @return Preference store for the property pages. + */ + public IPreferenceStore getPreferenceStore(); + +} |