Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-03-13 14:31:36 -0400
committerPawel Piech2012-03-18 23:50:44 -0400
commitb9f5e87587dae4cecab6e29853c873caa090a055 (patch)
tree9919f072c9ac86f782b7467f0fdd9a287e8fe343 /debug/org.eclipse.cdt.debug.ui
parent5fc0587f6d7839eb356965a72a472f82e788e4c9 (diff)
downloadorg.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')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF1
-rw-r--r--debug/org.eclipse.cdt.debug.ui/plugin.xml5
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java16
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java21
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java5
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java55
6 files changed, 81 insertions, 22 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index b6b9a48ed7..aecef9f25a 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Export-Package:
org.eclipse.cdt.debug.internal.ui;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.actions;x-friends:="org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.memorybrowser",
org.eclipse.cdt.debug.internal.ui.actions.breakpoints;x-internal:=true,
+ org.eclipse.cdt.debug.internal.ui.breakpoints;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.commands;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.dialogfields;x-internal:=true,
org.eclipse.cdt.debug.internal.ui.dialogs;x-internal:=true,
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index ad4689c8b8..934e2a7cae 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -1194,8 +1194,7 @@
</and>
<and>
- <instanceof value="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext">
- </instanceof>
+ <instanceof value="org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext"/>
<test property="org.eclipse.cdt.debug.ui.createBreakpointAdapt" value="org.eclipse.cdt.debug.core.model.ICBreakpoint" />
<not>
<test property="org.eclipse.cdt.debug.ui.createBreakpointAdapt" value="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
@@ -2571,7 +2570,7 @@
id="org.eclipse.cdt.debug.ui.CreateBreakpointTester"
namespace="org.eclipse.cdt.debug.ui"
properties="createBreakpointAdapt"
- type="org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext">
+ type="org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext">
</propertyTester>
</extension>
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 fbbb8343ed..d1d359322e 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 aa1b7de7e1..94777da096 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 6acd34d829..a2f1824acb 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 0000000000..8527732e80
--- /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();
+
+}

Back to the top