Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointImageProvider.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointContext.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java)121
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java)4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java)8
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java90
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ToggleCBreakpointTester.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AbstractBreakpointRulerAction.java)67
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java463
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties14
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddEventBreakpointActionDelegate.java)3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java)35
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java)4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnMemoryActionDelegate.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnVariableActionDelegate.java)3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java39
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesHandler.java)42
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java93
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerActionDelegate.java)2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/EnableDisableBreakpointRulerAction.java)3
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java27
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java132
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCBreakpointsTargetFactory.java)6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCTracepointsTargetFactory.java)6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java66
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java115
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java31
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java75
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java218
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java97
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java96
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java97
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java48
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java123
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java91
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java33
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties40
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java299
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java498
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java43
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java9
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java)4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java46
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java525
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties23
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java (renamed from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java)12
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java752
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java182
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java59
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java55
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java133
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java13
54 files changed, 1728 insertions, 3233 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointImageProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java
index c18640cccc7..3b490af3c32 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointImageProvider.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui;
import org.eclipse.core.resources.IMarker;
import org.eclipse.debug.core.DebugPlugin;
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/CBreakpointContext.java
index bc179355e35..22a7bd92f31 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/CBreakpointContext.java
@@ -9,20 +9,10 @@
* Wind River Systems - initial API and implementation
* Ericsson - Added tracepoint support (284286)
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICTracepoint;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-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;
import org.eclipse.core.runtime.Platform;
@@ -30,14 +20,9 @@ import org.eclipse.core.runtime.PlatformObject;
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.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.model.IWorkbenchAdapter;
/**
* Input for breakpoint properties dialog. It captures both the
@@ -45,7 +30,7 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
* 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 ICBreakpointContext {
+public class CBreakpointContext extends PlatformObject {
// Register an adapter factory for the class when it is first loaded.
static {
@@ -58,60 +43,28 @@ public class CBreakpointContext extends PlatformObject implements ICBreakpointCo
private final ICBreakpoint fBreakpoint;
/**
- * The resource that the breakpoint is to be created for.
- */
- private final IResource fResource;
-
- /**
* The active debug context held by this context.
*/
private final ISelection fDebugContext;
/**
- * Associated preference store.
- */
- private final CBreakpointPreferenceStore fPreferenceStore;
-
- /**
- * Creates a new breakpoint context with given breakpoint and debug
+ * Creates a new breakpoint context with given breakpoint and debbug
* context selection.
*/
public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext) {
- this (breakpoint, debugContext, null, null);
- }
-
- public CBreakpointContext(ICBreakpoint breakpoint, ISelection debugContext, IResource resource, Map<String, Object> attributes) {
fBreakpoint = breakpoint;
- fResource = resource;
fDebugContext = debugContext;
- fPreferenceStore = new CBreakpointPreferenceStore(this, attributes);
}
- @Override
+ /**
+ * Returns the breakpoint.
+ */
public ICBreakpoint getBreakpoint() { return fBreakpoint; }
-
- @Override
- public IResource getResource() { return fResource; }
-
- @Override
- public IPreferenceStore getPreferenceStore() { return fPreferenceStore; }
/**
* Returns the debug context.
*/
public ISelection getDebugContext() { return fDebugContext; }
-
- /**
- * (non-Javadoc)
- * @see org.eclipse.debug.ui.contexts.IDebugContextProvider implementation
- */
- public IWorkbenchPart getPart() { return null; }
- public void addDebugContextListener(IDebugContextListener listener) {}
- public void removeDebugContextListener(IDebugContextListener listener) {}
-
- public ISelection getActiveContext() {
- return fDebugContext;
- }
}
/**
@@ -156,84 +109,30 @@ class CBreakpointContextActionFilter implements IActionFilter {
}
}
-class CBreakpointContextWorkbenchAdapter implements IWorkbenchAdapter {
- @Override
- public String getLabel(Object o) {
- if (o instanceof ICBreakpointContext) {
- ICBreakpoint bp = ((ICBreakpointContext)o).getBreakpoint();
- return getBreakpointMainLabel(bp);
- }
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public Object[] getChildren(Object o) { return null; }
-
- @Override
- public ImageDescriptor getImageDescriptor(Object object) { return null; }
-
- @Override
- public Object getParent(Object o) { return null; }
-
- private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
- if (breakpoint instanceof ICFunctionBreakpoint) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_function_label"); //$NON-NLS-1$
- } else if (breakpoint instanceof ICAddressBreakpoint) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_address_label"); //$NON-NLS-1$
- } else if (breakpoint instanceof ICLineBreakpoint) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_line_label"); //$NON-NLS-1$
- } else if (breakpoint instanceof ICEventBreakpoint) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_event_label"); //$NON-NLS-1$
- } else if (breakpoint instanceof ICWatchpoint) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
- }
- // default main label is the label of marker type for the breakpoint
- return CDIDebugModel.calculateMarkerType(breakpoint);
- }
-
-}
-
/**
* Adapter factory which returns the breakpoint object and the action
* filter for the CBreakpointContext type.
*/
class CBreakpointContextAdapterFactory implements IAdapterFactory {
- private static final Class<?>[] fgAdapterList = new Class[] {
- IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class, IPreferenceStore.class,
- IWorkbenchAdapter.class,
+ private static final Class[] fgAdapterList = new Class[] {
+ IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class
};
private static final IActionFilter fgActionFilter = new CBreakpointContextActionFilter();
- private static final IWorkbenchAdapter fgWorkbenchAdapter = new CBreakpointContextWorkbenchAdapter();
@Override
- public Object getAdapter(Object obj, @SuppressWarnings("rawtypes") Class adapterType) {
- // Note: only return the breakpoint object as an adapter if it has
- // an associated marker. Otherwise the property pages will throw multiple
- // exceptions.
- if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() ) &&
- ((CBreakpointContext)obj).getBreakpoint().getMarker() != null)
- {
+ public Object getAdapter(Object obj, Class adapterType) {
+ if (adapterType.isInstance( ((CBreakpointContext)obj).getBreakpoint() )) {
return ((CBreakpointContext)obj).getBreakpoint();
}
- if ( IPreferenceStore.class.equals(adapterType) ) {
- return ((CBreakpointContext)obj).getPreferenceStore();
- }
-
if (IActionFilter.class.equals(adapterType)) {
return fgActionFilter;
}
-
- if (IWorkbenchAdapter.class.equals(adapterType)) {
- return fgWorkbenchAdapter;
- }
-
return null;
}
- @SuppressWarnings("rawtypes")
@Override
public Class[] getAdapterList() {
return fgAdapterList;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java
index b555f52ce2f..01556ead2e2 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointUpdater.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointUpdater.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui;
import java.util.Map;
import org.eclipse.cdt.debug.core.ICBreakpointListener;
@@ -79,7 +79,7 @@ public class CBreakpointUpdater implements ICBreakpointListener {
* org.eclipse.debug.core.model.IBreakpoint, java.util.Map)
*/
@Override
- public void breakpointChanged( IDebugTarget target, final IBreakpoint breakpoint, @SuppressWarnings("rawtypes") final Map attributes ) {
+ public void breakpointChanged( IDebugTarget target, final IBreakpoint breakpoint, final Map attributes ) {
asyncExec( new Runnable() {
@Override
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java
index 53812b2ee5a..38014d83d93 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointWorkbenchAdapterFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CBreakpointWorkbenchAdapterFactory.java
@@ -8,12 +8,11 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.WorkbenchAdapter;
@@ -27,7 +26,7 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
@Override
- public Object getAdapter( Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType ) {
+ public Object getAdapter( Object adaptableObject, Class adapterType ) {
if ( adapterType != IWorkbenchAdapter.class || !(adaptableObject instanceof ICBreakpoint) ) {
return null;
}
@@ -49,8 +48,7 @@ public class CBreakpointWorkbenchAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
- @SuppressWarnings("rawtypes")
- @Override
+ @Override
public Class[] getAdapterList() {
return new Class[] { IWorkbenchAdapter.class };
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
index 473330f68a3..ac66eb4759d 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
@@ -11,10 +11,9 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
-import java.util.Iterator;
+import com.ibm.icu.text.MessageFormat;
import org.eclipse.cdt.debug.core.CDebugUtils;
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICDebugElementStatus;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
@@ -22,9 +21,7 @@ import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;
import org.eclipse.cdt.debug.internal.ui.disassembly.rendering.DisassemblyEditorInput;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
import org.eclipse.core.filesystem.URIUtil;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
@@ -32,38 +29,21 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.contexts.IDebugContextProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IURIEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
-
-import com.ibm.icu.text.MessageFormat;
/**
* Utility methods for C/C++ Debug UI.
@@ -229,7 +209,7 @@ public class CDebugUIUtils {
return null;
StringBuffer baseText = new StringBuffer( text );
if ( element instanceof ICDebugElementStatus && !((ICDebugElementStatus)element).isOK() ) {
- baseText.append( MessageFormat.format( " <{0}>", new Object[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
+ baseText.append( MessageFormat.format( " <{0}>", new String[] { ((ICDebugElementStatus)element).getMessage() } ) ); //$NON-NLS-1$
}
if ( element instanceof IAdaptable ) {
IEnableDisableTarget target = (IEnableDisableTarget)((IAdaptable)element).getAdapter( IEnableDisableTarget.class );
@@ -271,71 +251,5 @@ public class CDebugUIUtils {
uiJob.setSystem(true);
uiJob.schedule();
}
-
- /**
- * Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>null</code>
- * if no breakpoint exists or the operation fails.
- *
- * @param editor the editor
- * @param info the current ruler information
- * @return the {@link IBreakpoint} from the current editor position or <code>null</code>
- */
- public static IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
- IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
- IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- if (annotationModel != null) {
- @SuppressWarnings("unchecked")
- Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof SimpleMarkerAnnotation) {
- SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
- IMarker marker = markerAnnotation.getMarker();
- try {
- if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
- Position position = annotationModel.getPosition(markerAnnotation);
- int line = document.getLineOfOffset(position.getOffset());
- if (line == info.getLineOfLastMouseButtonActivity()) {
- IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
- if (breakpoint != null) {
- return breakpoint;
- }
- }
- }
- } catch (CoreException e) {
- } catch (BadLocationException e) {
- }
- }
- }
- }
- return null;
- }
- public static void editBreakpointProperties(IWorkbenchPart part, final ICBreakpoint bp) {
- final ISelection debugContext = DebugUITools.getDebugContextForPart(part);
- CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
- part.getSite(),
- new ISelectionProvider() {
- @Override
- public ISelection getSelection() {
- return new StructuredSelection( bp );
- }
- @Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
- @Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
- @Override public void setSelection( ISelection selection ) {}
- },
- new IDebugContextProvider() {
- @Override
- public ISelection getActiveContext() {
- return debugContext;
- }
- @Override public void addDebugContextListener(IDebugContextListener listener) {}
- @Override public void removeDebugContextListener(IDebugContextListener listener) {}
- @Override public IWorkbenchPart getPart() { return null; }
-
- }
- );
- propertiesAction.run();
- propertiesAction.dispose();
- }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ToggleCBreakpointTester.java
index d4b161db193..74cae165f56 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ToggleCBreakpointTester.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ToggleCBreakpointTester.java
@@ -9,7 +9,7 @@
* Patrick Chuong (Texas Instruments) -
* Update CDT ToggleBreakpointTargetFactory enablement (340177)
*****************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui;
import java.util.List;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AbstractBreakpointRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java
index 6402f536567..1578a3eb803 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AbstractBreakpointRulerAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractBreakpointRulerAction.java
@@ -9,17 +9,27 @@
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems) - bug 183397
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
-import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.ui.actions.RulerBreakpointAction;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
/**
* Abstract base implementation of the breakpoint ruler actions.
@@ -51,11 +61,33 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU
* @return breakpoint associated with activity in the ruler or <code>null</code>
*/
protected IBreakpoint getBreakpoint() {
- IWorkbenchPart targetPart = getTargetPart();
- if (targetPart instanceof ITextEditor) {
- return CDebugUIUtils.getBreakpointFromEditor((ITextEditor)targetPart, getVerticalRulerInfo());
- }
- return null;
+ IAnnotationModel annotationModel = getAnnotationModel();
+ IDocument document = getDocument();
+ if (annotationModel != null) {
+ Iterator<?> iterator = annotationModel.getAnnotationIterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object instanceof SimpleMarkerAnnotation) {
+ SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
+ IMarker marker = markerAnnotation.getMarker();
+ try {
+ if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
+ Position position = annotationModel.getPosition(markerAnnotation);
+ int line = document.getLineOfOffset(position.getOffset());
+ if (line == fRulerInfo.getLineOfLastMouseButtonActivity()) {
+ IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
+ if (breakpoint != null) {
+ return breakpoint;
+ }
+ }
+ }
+ } catch (CoreException e) {
+ } catch (BadLocationException e) {
+ }
+ }
+ }
+ }
+ return null;
}
/**
@@ -76,4 +108,25 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU
return fRulerInfo;
}
+ private IDocument getDocument() {
+ IWorkbenchPart targetPart = getTargetPart();
+ if ( targetPart instanceof ITextEditor ) {
+ ITextEditor textEditor = (ITextEditor)targetPart;
+ IDocumentProvider provider = textEditor.getDocumentProvider();
+ if ( provider != null )
+ return provider.getDocument( textEditor.getEditorInput() );
+ }
+ return null;
+ }
+
+ private IAnnotationModel getAnnotationModel() {
+ IWorkbenchPart targetPart = getTargetPart();
+ if ( targetPart instanceof ITextEditor ) {
+ ITextEditor textEditor = (ITextEditor)targetPart;
+ IDocumentProvider provider = textEditor.getDocumentProvider();
+ if ( provider != null )
+ return provider.getAnnotationModel( textEditor.getEditorInput() );
+ }
+ return null;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java
new file mode 100644
index 00000000000..466d291bbdb
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractToggleBreakpointAdapter.java
@@ -0,0 +1,463 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Mentor Graphics 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:
+ * Mentor Graphics - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import java.math.BigInteger;
+
+import org.eclipse.cdt.core.model.CModelException;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.IDeclaration;
+import org.eclipse.cdt.core.model.IFunction;
+import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.IMethod;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ITranslationUnit;
+import org.eclipse.cdt.core.model.IVariable;
+import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
+import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
+import org.eclipse.cdt.ui.CDTUITools;
+import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.ui.texteditor.IEditorStatusLine;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+abstract public class AbstractToggleBreakpointAdapter implements IToggleBreakpointsTargetExtension {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ String errorMessage = null;
+ if ( part instanceof ITextEditor ) {
+ ITextEditor textEditor = (ITextEditor)part;
+ IEditorInput input = textEditor.getEditorInput();
+ if ( input == null ) {
+ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$
+ }
+ else {
+ IDocument document = textEditor.getDocumentProvider().getDocument( input );
+ if ( document == null ) {
+ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_document_1" ); //$NON-NLS-1$
+ }
+ else {
+ IResource resource = getResource( textEditor );
+ if ( resource == null ) {
+ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Missing_resource_1" ); //$NON-NLS-1$
+ }
+ else {
+ BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
+ int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() );
+ if ( lineNumber == -1 ) {
+ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
+ }
+ else {
+ String sourceHandle = getSourceHandle( input );
+ ICLineBreakpoint breakpoint = findLineBreakpoint( sourceHandle, resource, lineNumber );
+ if ( breakpoint != null ) {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
+ }
+ else {
+ createLineBreakpoint( sourceHandle, resource, lineNumber );
+ }
+ return;
+ }
+ }
+ }
+ }
+ }
+ else {
+ errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
+ }
+ throw new CoreException(
+ new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ return (selection instanceof ITextSelection);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IFunction || element instanceof IMethod ) {
+ toggleMethodBreakpoints0( (IDeclaration)element );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ ICElement element = getCElementFromSelection( part, selection );
+ return (element instanceof IFunction || element instanceof IMethod);
+ }
+
+ protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
+ if ( selection instanceof ITextSelection ) {
+ ITextSelection textSelection = (ITextSelection)selection;
+ String text = textSelection.getText();
+ if ( text != null ) {
+ if ( part instanceof ITextEditor ) {
+ ICElement editorElement = CDTUITools.getEditorInputCElement( ((ITextEditor)part).getEditorInput() );
+ if ( editorElement instanceof ITranslationUnit ) {
+ ITranslationUnit tu = (ITranslationUnit)editorElement;
+ try {
+ if ( tu.isStructureKnown() && tu.isConsistent() ) {
+ return tu.getElementAtOffset( textSelection.getOffset() );
+ }
+ }
+ catch( CModelException exc ) {
+ // ignored on purpose
+ }
+ }
+ }
+ else {
+ IResource resource = getResource( part );
+ if ( resource instanceof IFile ) {
+ ITranslationUnit tu = getTranslationUnit( (IFile)resource );
+ if ( tu != null ) {
+ try {
+ ICElement element = tu.getElement( text.trim() );
+ if ( element == null ) {
+ element = tu.getElementAtLine( textSelection.getStartLine() );
+ }
+ return element;
+ }
+ catch( CModelException e ) {
+ }
+ }
+ }
+ }
+ }
+ }
+ else if ( selection instanceof IStructuredSelection ) {
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ if ( ss.size() == 1 ) {
+ Object object = ss.getFirstElement();
+ if ( object instanceof ICElement ) {
+ return (ICElement)object;
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ IVariable variable = getVariableFromSelection( part, selection );
+ if ( variable != null ) {
+ toggleVariableWatchpoint( part, variable );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
+ return getVariableFromSelection( part, selection ) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
+ return ( canToggleLineBreakpoints( part, selection )
+ || canToggleWatchpoints( part, selection )
+ || canToggleMethodBreakpoints( part, selection ) );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
+ if ( canToggleLineBreakpoints( part, selection ) ) {
+ toggleLineBreakpoints( part, selection );
+ }
+ else {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IFunction || element instanceof IMethod ) {
+ toggleMethodBreakpoints0( (IDeclaration)element );
+ }
+ else if ( element instanceof IVariable ) {
+ toggleVariableWatchpoint( part, (IVariable)element );
+ }
+ }
+ }
+
+ protected IVariable getVariableFromSelection( IWorkbenchPart part, ISelection selection ) {
+ ICElement element = getCElementFromSelection( part, selection );
+ if ( element instanceof IVariable ) {
+ return (IVariable)element;
+ }
+ return null;
+ }
+
+ protected void report( String message, IWorkbenchPart part ) {
+ IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
+ if ( statusLine != null ) {
+ if ( message != null ) {
+ statusLine.setMessage( true, message, null );
+ }
+ else {
+ statusLine.setMessage( true, null, null );
+ }
+ }
+ if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
+ CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
+ }
+ }
+
+ protected static IResource getResource( IWorkbenchPart part ) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if ( part instanceof IEditorPart ) {
+ IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
+ IResource resource = null;
+ if ( editorInput instanceof IFileEditorInput ) {
+ resource = ((IFileEditorInput)editorInput).getFile();
+ }
+ else if ( editorInput instanceof ExternalEditorInput ) {
+ resource = ((ExternalEditorInput)editorInput).getMarkerResource();
+ }
+ if ( resource != null )
+ return resource;
+ /* This file is not in a project, let default case handle it */
+ ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
+ if ( provider != null ) {
+ IPath location = provider.getPath( editorInput );
+ if ( location != null ) {
+ IFile[] files = root.findFilesForLocationURI( URIUtil.toURI( location ) );
+ if ( files.length > 0 && files[0].isAccessible())
+ return files[0];
+ }
+ }
+ }
+ return root;
+ }
+
+ private String getSourceHandle( IEditorInput input ) throws CoreException {
+ return CDebugUIUtils.getEditorFilePath( input );
+ }
+
+ private void toggleVariableWatchpoint( IWorkbenchPart part, IVariable variable ) throws CoreException {
+ String sourceHandle = getSourceHandle( variable );
+ IResource resource = getElementResource( variable );
+ String expression = getVariableName( variable );
+ ICWatchpoint watchpoint = findWatchpoint( sourceHandle, resource, expression );
+ if ( watchpoint != null ) {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( watchpoint, true );
+ }
+ else {
+ AddWatchpointDialog dlg = new AddWatchpointDialog( part.getSite().getShell(), AddWatchpointActionDelegate.getMemorySpaceManagement() );
+ dlg.setExpression( expression );
+ if ( dlg.open() != Window.OK )
+ return;
+ expression = dlg.getExpression();
+ int lineNumber = -1;
+ int charStart = -1;
+ int charEnd = -1;
+ try {
+ ISourceRange sourceRange = variable.getSourceRange();
+ if ( sourceRange != null ) {
+ charStart = sourceRange.getStartPos();
+ charEnd = charStart + sourceRange.getLength();
+ if ( charEnd <= 0 ) {
+ charStart = -1;
+ charEnd = -1;
+ }
+ lineNumber = sourceRange.getStartLine();
+ }
+ }
+ catch( CModelException e ) {
+ DebugPlugin.log( e );
+ }
+ createWatchpoint(
+ sourceHandle,
+ resource,
+ charStart,
+ charEnd,
+ lineNumber,
+ dlg.getWriteAccess(),
+ dlg.getReadAccess(),
+ expression,
+ dlg.getMemorySpace(),
+ dlg.getRange() );
+ }
+ }
+
+ private String getSourceHandle( IDeclaration declaration ) {
+ ITranslationUnit tu = declaration.getTranslationUnit();
+ if ( tu != null ) {
+ IPath location = tu.getLocation();
+ if ( location != null ) {
+ return location.toOSString();
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private IResource getElementResource( IDeclaration declaration ) {
+ return declaration.getUnderlyingResource();
+ }
+
+ private String getFunctionName( IFunction function ) {
+ String functionName = function.getElementName();
+ StringBuffer name = new StringBuffer( functionName );
+ ITranslationUnit tu = function.getTranslationUnit();
+ if ( tu != null && tu.isCXXLanguage() ) {
+ appendParameters( name, function );
+ }
+ return name.toString();
+ }
+
+ private String getMethodName( IMethod method ) {
+ StringBuffer name = new StringBuffer();
+ String methodName = method.getElementName();
+ ICElement parent = method.getParent();
+ while( parent != null
+ && (parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
+ || parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION) ) {
+ name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
+ parent = parent.getParent();
+ }
+ name.append( methodName );
+ appendParameters( name, method );
+ return name.toString();
+ }
+
+ private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
+ String[] params = fd.getParameterTypes();
+ sb.append( '(' );
+ for( int i = 0; i < params.length; ++i ) {
+ sb.append( params[i] );
+ if ( i != params.length - 1 )
+ sb.append( ',' );
+ }
+ sb.append( ')' );
+ }
+
+ private String getVariableName( IVariable variable ) {
+ return variable.getElementName();
+ }
+
+ private ITranslationUnit getTranslationUnit( IFile file ) {
+ Object element = CoreModel.getDefault().create( file );
+ if ( element instanceof ITranslationUnit ) {
+ return (ITranslationUnit)element;
+ }
+ return null;
+ }
+
+ private void toggleMethodBreakpoints0( IDeclaration declaration ) throws CoreException {
+ String sourceHandle = getSourceHandle( declaration );
+ IResource resource = getElementResource( declaration );
+ String functionName = (declaration instanceof IFunction) ? getFunctionName( (IFunction)declaration ) : getMethodName( (IMethod)declaration );
+ ICFunctionBreakpoint breakpoint = findFunctionBreakpoint( sourceHandle, resource, functionName );
+ if ( breakpoint != null ) {
+ DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
+ }
+ else {
+ int lineNumber = -1;
+ int charStart = -1;
+ int charEnd = -1;
+ try {
+ ISourceRange sourceRange = declaration.getSourceRange();
+ if ( sourceRange != null ) {
+ charStart = sourceRange.getStartPos();
+ charEnd = charStart + sourceRange.getLength();
+ if ( charEnd <= 0 ) {
+ charStart = -1;
+ charEnd = -1;
+ }
+ lineNumber = sourceRange.getStartLine();
+ }
+ }
+ catch( CModelException e ) {
+ DebugPlugin.log( e );
+ }
+ createFunctionBreakpoint(
+ sourceHandle,
+ resource,
+ functionName,
+ charStart,
+ charEnd,
+ lineNumber );
+ }
+ }
+
+ protected abstract ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException;
+
+ protected abstract void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException;
+
+ protected abstract ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException;
+
+ protected abstract void createFunctionBreakpoint(
+ String sourceHandle,
+ IResource resource,
+ String functionName,
+ int charStart,
+ int charEnd,
+ int lineNumber ) throws CoreException;
+
+ protected abstract ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException;
+
+ protected abstract void createWatchpoint(
+ String sourceHandle,
+ IResource resource,
+ int charStart,
+ int charEnd,
+ int lineNumber,
+ boolean writeAccess,
+ boolean readAccess,
+ String expression,
+ String memorySpace,
+ BigInteger range ) throws CoreException;
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
index eb47e4a36bb..34fed677de0 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
@@ -37,15 +37,15 @@ ToggleBreakpointAdapter.Missing_document_2=Missing document
ToggleBreakpointAdapter.Missing_resource_2=Missing resource
ToggleBreakpointAdapter.Invalid_expression_1=Invalid expression:
RunToLineAdapter.Operation_is_not_supported_1=Operation is not supported.
-EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint\tShift+Double Click
+EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint
EnableDisableBreakpointRulerAction.Enabling_disabling_breakpoints_1=Enabling/disabling breakpoints
EnableDisableBreakpointRulerAction.Exceptions_occurred_enabling_or_disabling_breakpoint_1=Exceptions occurred enabling or disabling the breakpoint
-EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint\tShift+Double Click
+EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint
+ToggleBreakpointRulerAction.Toggle_Breakpoint_1=Toggle &Breakpoint
ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
ToggleBreakpointRulerAction.Error_1=Error
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
-CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...\tCtrl+Double Click
-CBreakpointPropertiesRulerAction.Error=Unable to edit breakpoint properties.
+CBreakpointPropertiesRulerAction.Breakpoint_Properties=Breakpoint &Properties...
ResumeAtLineActionDelegate.Error_1=Error
ResumeAtLineActionDelegate.1=Error
ResumeAtLineActionDelegate.2=Resume at line failed
@@ -129,9 +129,3 @@ RetargetAction.0=Error
RetargetAction.1=Operation failed
RetargetMoveToLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
RetargetResumeAtLineAction.0=The operation is unavailable on the current selection. Please place the cursor on valid line to run to.
-CAddBreakpointInteractiveRulerAction_label=&Add Breakpoint...\tCtrl+Double Click
-CAddBreakpointInteractiveRulerAction_error_title=Error
-CAddBreakpointInteractiveRulerAction_error_message=Unable to create breakpoint
-CBreakpointToggleRulerAction_error_label=Toggle Brea&kpoint\tDouble Click
-CBreakpointToggleRulerAction_error_title=Error
-CBreakpointToggleRulerAction_error_message=Unable to toggle breakpoint \ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddEventBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java
index b959f77ebfe..c4637bfbfe5 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddEventBreakpointActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddEventBreakpointActionDelegate.java
@@ -10,10 +10,9 @@
* QNX Software Systems - Initial API and implementation
* QNX Software Systems - catchpoints - bug 226689
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.internal.ui.dialogs.AddEventBreakpointDialog;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.UIMessages;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java
index 9fab7944647..2cdfb1f1aa7 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointActionDelegate.java
@@ -9,7 +9,7 @@
* QNX Software Systems - Initial API and implementation
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import java.math.BigInteger;
@@ -17,17 +17,14 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.ActionDelegate;
@@ -38,9 +35,7 @@ import org.eclipse.ui.actions.ActionDelegate;
public class AddWatchpointActionDelegate extends ActionDelegate implements IViewActionDelegate {
private IViewPart fView;
- private ISelection fSelection;
- private ToggleBreakpointAdapter fDefaultToggleTarget = new ToggleBreakpointAdapter();
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
@@ -57,29 +52,15 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
return fView;
}
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- fSelection = selection;
- }
-
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run( IAction action ) {
- IToggleBreakpointsTarget toggleTarget = DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fView, fSelection);
- IToggleBreakpointsTargetCExtension cToggleTarget = null;
- if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
- cToggleTarget = (IToggleBreakpointsTargetCExtension)toggleTarget;
- } else {
- cToggleTarget = fDefaultToggleTarget;
- }
-
- try {
- cToggleTarget.createWatchpointsInteractive(fView, fSelection);
- } catch (CoreException e) {
- CDebugUIPlugin.errorDialog( ActionMessages.getString( "AddWatchpointActionDelegate1.0" ), e ); //$NON-NLS-1$
- }
+ AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(), getMemorySpaceManagement() );
+ if ( dlg.open() == Window.OK ) {
+ addWatchpoint( dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange() );
+ }
}
protected void addWatchpoint(boolean write, boolean read, String expression, String memorySpace, BigInteger range) {
@@ -101,7 +82,7 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
return ""; //$NON-NLS-1$
}
- public static ICDIMemorySpaceManagement getMemorySpaceManagement(){
+ static ICDIMemorySpaceManagement getMemorySpaceManagement(){
IAdaptable debugViewElement = DebugUITools.getDebugContext();
ICDIMemorySpaceManagement memMgr = null;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java
index 8144e4d4cd4..8d6bab94516 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointDialog.java
@@ -10,14 +10,13 @@
* Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
* IBM Corporation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -45,7 +44,6 @@ import org.eclipse.swt.widgets.Text;
/**
* The "Add Watchpoint" dialog of the "Toggle watchpoint" action.
- * @deprecated Replaced by opening a properties dialog on a new breakpoint.
*/
public class AddWatchpointDialog extends Dialog implements ModifyListener, SelectionListener {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnMemoryActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java
index 01e61b53471..c403a5e34ee 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnMemoryActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnMemoryActionDelegate.java
@@ -8,7 +8,7 @@
* Contributors:
* Nokia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import java.math.BigInteger;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnVariableActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java
index 66a5d5e03de..131616fb9af 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointOnVariableActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java
@@ -8,12 +8,11 @@
* Contributors:
* Nokia - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.internal.core.CRequest;
import org.eclipse.cdt.debug.internal.core.ICWatchpointTarget;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java
new file mode 100644
index 00000000000..d51adf334fc
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/BreakpointLocationVerifier.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.jface.text.IDocument;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Aug 29, 2002
+ */
+public class BreakpointLocationVerifier
+{
+ /**
+ * Returns the line number closest to the given line number that represents a
+ * valid location for a breakpoint in the given document, or -1 if a valid location
+ * cannot be found.
+ */
+ public int getValidLineBreakpointLocation( IDocument doc, int lineNumber )
+ {
+ // for now
+ return lineNumber + 1;
+ }
+
+ public int getValidAddressBreakpointLocation( IDocument doc, int lineNumber )
+ {
+ // for now
+ return lineNumber + 1;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java
index 10bab0d10c1..5dc43b5f299 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesHandler.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesHandler.java
@@ -9,18 +9,24 @@
* QNX Software Systems - Initial API and implementation
* Wind River Systems - Converted into a command
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
+import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.handlers.HandlerUtil;
/**
@@ -38,12 +44,36 @@ public class CBreakpointPropertiesHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
- final ICBreakpoint bp = getBreakpoint(event.getApplicationContext());
+ ICBreakpoint bp = getBreakpoint(event.getApplicationContext());
if (part != null && bp != null) {
- CDebugUIUtils.editBreakpointProperties(part, bp);
- }
-
+ ISelection debugContext = DebugUITools.getDebugContextManager().
+ getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
+
+ final CBreakpointContext bpContext = new CBreakpointContext(bp, debugContext);
+
+ PropertyDialogAction propertyAction = new PropertyDialogAction( part.getSite(), new ISelectionProvider() {
+
+ @Override
+ public void addSelectionChangedListener( ISelectionChangedListener listener ) {
+ }
+
+ @Override
+ public ISelection getSelection() {
+ return new StructuredSelection( bpContext );
+ }
+
+ @Override
+ public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
+ }
+
+ @Override
+ public void setSelection( ISelection selection ) {
+ assert false; // Not supported
+ }
+ } );
+ propertyAction.run();
+ }
return null;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java
new file mode 100644
index 00000000000..1a82827cb9f
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerAction.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems) - bug 183397
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.internal.ui.CBreakpointContext;
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.dialogs.PropertyDialogAction;
+
+/**
+ * Opens a custom properties dialog to configure the attibutes of a C/C++ breakpoint
+ * from the ruler popup menu.
+ */
+public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
+
+ private Object fContext;
+
+ /**
+ * Creates the action to modify the breakpoint properties.
+ */
+ public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
+ super( part, info );
+ setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
+ part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
+ setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
+ }
+
+ /* (non-Javadoc)
+ * @see Action#run()
+ */
+ @Override
+ public void run() {
+ if ( fContext != null ) {
+ PropertyDialogAction action = new PropertyDialogAction( getTargetPart().getSite(), new ISelectionProvider() {
+
+ @Override
+ public void addSelectionChangedListener( ISelectionChangedListener listener ) {
+ }
+
+ @Override
+ public ISelection getSelection() {
+ return new StructuredSelection( fContext );
+ }
+
+ @Override
+ public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
+ }
+
+ @Override
+ public void setSelection( ISelection selection ) {
+ }
+ } );
+ action.run();
+ action.dispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see IUpdate#update()
+ */
+ @Override
+ public void update() {
+ IBreakpoint breakpoint = getBreakpoint();
+ if (breakpoint instanceof ICBreakpoint) {
+ fContext = new CBreakpointContext((ICBreakpoint)breakpoint, getDebugContext());
+ } else {
+ fContext = breakpoint;
+ }
+ setEnabled( fContext != null );
+ }
+
+ private ISelection getDebugContext() {
+ return DebugUITools.getDebugContextManager().getContextService(getTargetPart().getSite().getWorkbenchWindow()).getActiveContext();
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java
index e4d58903a2f..30adad5629c 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CBreakpointPropertiesRulerActionDelegate.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/EnableDisableBreakpointRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java
index 586020c4fae..858d371b37b 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/EnableDisableBreakpointRulerAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerAction.java
@@ -9,11 +9,10 @@
* QNX Software Systems - Initial API and implementation
* Anton Leherbauer (Wind River Systems) - bug 183397
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java
new file mode 100644
index 00000000000..de3df78eb7d
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/EnableDisableBreakpointRulerActionDelegate.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class EnableDisableBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
+
+ /*
+ * @see AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
+ */
+ @Override
+ protected IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo ) {
+ return new EnableDisableBreakpointRulerAction( editor, rulerInfo );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java
new file mode 100644
index 00000000000..3212ffcb7f3
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
+ * Warren Paul (Nokia) - Bug 217485, Bug 218342
+ * Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 225099
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import java.math.BigInteger;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpointType;
+import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Toggles a line breakpoint in a C/C++ editor.
+ */
+public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
+ */
+ @Override
+ protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
+ */
+ @Override
+ protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ CDIDebugModel.createLineBreakpoint( sourceHandle,
+ resource,
+ getBreakpointType(),
+ lineNumber,
+ true,
+ 0,
+ "", //$NON-NLS-1$
+ true );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
+ protected ICFunctionBreakpoint findFunctionBreakpoint(
+ String sourceHandle,
+ IResource resource,
+ String functionName ) throws CoreException {
+ return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String, int, int, int)
+ */
+ @Override
+ protected void createFunctionBreakpoint(
+ String sourceHandle,
+ IResource resource,
+ String functionName,
+ int charStart,
+ int charEnd,
+ int lineNumber ) throws CoreException {
+ CDIDebugModel.createFunctionBreakpoint( sourceHandle,
+ resource,
+ getBreakpointType(),
+ functionName,
+ charStart,
+ charEnd,
+ lineNumber,
+ true,
+ 0,
+ "", //$NON-NLS-1$
+ true );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
+ protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
+ return CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, int, int, int, boolean, boolean, java.lang.String, java.lang.String, java.math.BigInteger)
+ */
+ @Override
+ protected void createWatchpoint(
+ String sourceHandle,
+ IResource resource,
+ int charStart,
+ int charEnd,
+ int lineNumber,
+ boolean writeAccess,
+ boolean readAccess,
+ String expression,
+ String memorySpace,
+ BigInteger range ) throws CoreException {
+
+ CDIDebugModel.createWatchpoint( sourceHandle,
+ resource,
+ charStart,
+ charEnd,
+ lineNumber,
+ writeAccess,
+ readAccess,
+ expression,
+ memorySpace,
+ range,
+ true,
+ 0,
+ "", //$NON-NLS-1$
+ true );
+ }
+
+ protected int getBreakpointType() {
+ return ICBreakpointType.REGULAR;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCBreakpointsTargetFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java
index 44a38a5baa2..d394abe0a3a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCBreakpointsTargetFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCBreakpointsTargetFactory.java
@@ -8,14 +8,13 @@
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.model.IDebugElement;
@@ -87,7 +86,8 @@ public class ToggleCBreakpointsTargetFactory implements IToggleBreakpointsTarget
}
@Override
- public Set<?> getToggleTargets(IWorkbenchPart part, ISelection selection) {
+ @SuppressWarnings("unchecked")
+ public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
return TOGGLE_TARGET_IDS;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCTracepointsTargetFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java
index 70668a699c4..75789e586b7 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleCTracepointsTargetFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleCTracepointsTargetFactory.java
@@ -8,12 +8,11 @@
* Contributors:
* Ericsson - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.actions;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
@@ -67,7 +66,8 @@ public class ToggleCTracepointsTargetFactory implements IToggleBreakpointsTarget
}
@Override
- public Set<?> getToggleTargets(IWorkbenchPart part, ISelection selection) {
+ @SuppressWarnings("unchecked")
+ public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
return TOGGLE_TARGET_IDS;
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java
new file mode 100644
index 00000000000..b0b57142df3
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleShowColumnsAction.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 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.cdt.debug.internal.ui.actions;
+
+import org.eclipse.cdt.debug.internal.ui.CDebugImages;
+import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.IUpdate;
+
+/**
+ * Action to toggle the use of contributed variables content providers on and off.
+ * When on, all registered variables content providers for the current debug model
+ * are used. When off, the default content provider (that shows all children)
+ * is used for all debug models.
+ */
+public class ToggleShowColumnsAction extends Action implements IUpdate {
+
+ private TreeModelViewer fViewer;
+
+ public ToggleShowColumnsAction( TreeModelViewer viewew ) {
+ super( "&Show Columns", IAction.AS_CHECK_BOX );
+ fViewer = viewew;
+ setToolTipText( "Show Columns" );
+ setImageDescriptor( CDebugImages.DESC_OBJS_COMMON_TAB );
+ setId( CDebugUIPlugin.getUniqueIdentifier() + ".ToggleShowColumsAction" ); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.SHOW_COLUMNS_ACTION );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if ( fViewer.getControl().isDisposed() ) {
+ return;
+ }
+ BusyIndicator.showWhile( fViewer.getControl().getDisplay(), new Runnable() {
+ @Override
+ public void run() {
+ fViewer.setShowColumns( isChecked() );
+ }
+ } );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.IUpdate#update()
+ */
+ @Override
+ public void update() {
+ setEnabled( fViewer.canToggleColumns() );
+ setChecked( fViewer.isShowColumns() );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java
new file mode 100644
index 00000000000..b7c07a60377
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ToggleTracepointAdapter.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson 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:
+ * Ericsson - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import java.math.BigInteger;
+
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.model.ICBreakpointType;
+import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Toggles a tracepoint in a C/C++ editor.
+ */
+public class ToggleTracepointAdapter extends AbstractToggleBreakpointAdapter {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
+ */
+ @Override
+ protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+ return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createLineBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, int)
+ */
+ @Override
+ protected void createLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
+
+ CDIDebugModel.createLineTracepoint(
+ sourceHandle,
+ resource,
+ getBreakpointType(),
+ lineNumber,
+ true,
+ 0,
+ "", //$NON-NLS-1$
+ true );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
+ protected ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException {
+ return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createFunctionBreakpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String, int, int, int)
+ */
+ @Override
+ protected void createFunctionBreakpoint(
+ String sourceHandle,
+ IResource resource,
+ String functionName,
+ int charStart,
+ int charEnd,
+ int lineNumber ) throws CoreException {
+
+ CDIDebugModel.createFunctionTracepoint(
+ sourceHandle,
+ resource,
+ getBreakpointType(),
+ functionName,
+ charStart,
+ charEnd,
+ lineNumber,
+ true,
+ 0,
+ "", //$NON-NLS-1$
+ true );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#findWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, java.lang.String)
+ */
+ @Override
+ protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.ui.actions.AbstractToggleBreakpointAdapter#createWatchpoint(java.lang.String, org.eclipse.core.resources.IResource, int, int, int, boolean, boolean, java.lang.String, java.lang.String, java.math.BigInteger)
+ */
+ @Override
+ protected void createWatchpoint(
+ String sourceHandle,
+ IResource resource,
+ int charStart,
+ int charEnd,
+ int lineNumber,
+ boolean writeAccess,
+ boolean readAccess,
+ String expression,
+ String memorySpace,
+ BigInteger range ) throws CoreException {
+ }
+
+ protected int getBreakpointType() {
+ return ICBreakpointType.REGULAR;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java
new file mode 100644
index 00000000000..5335df117bf
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/WatchpointExpressionVerifier.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import org.eclipse.jface.text.IDocument;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Sep 5, 2002
+ */
+public class WatchpointExpressionVerifier
+{
+ /**
+ * Returns whether the specified expression is valid for a watchpoint.
+ */
+ public boolean isValidExpression( IDocument doc, String expression )
+ {
+ // for now
+ return expression.trim().length() > 0;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java
deleted file mode 100644
index b6b50b235b7..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007-7 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
-*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * A delegate for the "Add Function Breakpoint" action.
- */
-public class AddFunctionBreakpointActionDelegate extends ActionDelegate implements IViewActionDelegate {
-
- private IViewPart fView;
- private ISelection fSelection;
- private ToggleBreakpointAdapter fDefaultToggleTarget = new ToggleBreakpointAdapter();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
- */
- @Override
- public void init( IViewPart view ) {
- setView( view );
- }
-
- private void setView(IViewPart view) {
- fView = view;
- }
-
- protected IViewPart getView() {
- return fView;
- }
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- fSelection = selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- @Override
- public void run( IAction action ) {
- IToggleBreakpointsTarget toggleTarget = DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fView, fSelection);
- IToggleBreakpointsTargetCExtension cToggleTarget = null;
- if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
- cToggleTarget = (IToggleBreakpointsTargetCExtension)toggleTarget;
- } else {
- cToggleTarget = fDefaultToggleTarget;
- }
-
- try {
- cToggleTarget.createFunctionBreakpointInteractive(fView, fSelection);
- } catch (CoreException e) {
- CDebugUIPlugin.errorDialog( ActionMessages.getString( "AddWatchpointActionDelegate1.0" ), e ); //$NON-NLS-1$
- }
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java
deleted file mode 100644
index a7923b204cc..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 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
- * Wind River Systems - added support for IToggleBreakpointsTargetFactory
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetManagerListener;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * Action to interactively create a breakpoint from vertical ruler of a
- * workbench part containing a document. The part must provide an
- * <code>IToggleBreakpointsTargetExtension2</code> adapter.
- * <p>
- * Clients may instantiate this class.
- * </p>
- * @since 3.8
- * @see org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate
- */
-public class CAddBreakpointInteractiveRulerAction extends Action implements IUpdate {
-
- private IWorkbenchPart fPart;
- private IDocument fDocument;
- private IVerticalRulerInfo fRulerInfo;
- private IToggleBreakpointsTargetManagerListener fListener = new IToggleBreakpointsTargetManagerListener() {
- public void preferredTargetsChanged() {
- update();
- }
- };
-
- /**
- * Constructs a new action to toggle a breakpoint in the given
- * part containing the given document and ruler.
- *
- * @param part the part in which to toggle the breakpoint - provides
- * an <code>IToggleBreakpointsTarget</code> adapter
- * @param document the document breakpoints are being set in or
- * <code>null</code> when the document should be derived from the
- * given part
- * @param rulerInfo specifies location the user has double-clicked
- */
- public CAddBreakpointInteractiveRulerAction(IWorkbenchPart part, IDocument document, IVerticalRulerInfo rulerInfo) {
- super(ActionMessages.getString("CAddBreakpointInteractiveRulerAction_label")); //$NON-NLS-1$
- fPart = part;
- fDocument = document;
- fRulerInfo = rulerInfo;
- DebugUITools.getToggleBreakpointsTargetManager().addChangedListener(fListener);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IDocument document= getDocument();
- if (document == null) {
- return;
- }
-
- int line = fRulerInfo.getLineOfLastMouseButtonActivity();
-
- // Test if line is valid
- if (line == -1)
- return;
-
- try {
- ITextSelection selection = getTextSelection(document, line);
- IToggleBreakpointsTarget toggleTarget =
- DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
- if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
- IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) toggleTarget;
- if (extension.canCreateLineBreakpointsInteractive(fPart, selection)) {
- extension.createLineBreakpointsInteractive(fPart, selection);
- }
- }
- } catch (BadLocationException e) {
- reportException(e);
- } catch (CoreException e) {
- reportException(e);
- }
- }
-
- /**
- * Report an error to the user.
- *
- * @param e underlying exception
- */
- private void reportException(Exception e) {
- IStatus status= new Status(IStatus.ERROR, CDebugUIPlugin.PLUGIN_ID, "Error creating breakpoint: ", e); //$NON-NLS-1$
- ErrorDialog.openError(
- fPart.getSite().getShell(),
- ActionMessages.getString("CAddBreakpointInteractiveRulerAction_error_title"), //$NON-NLS-1$
- ActionMessages.getString("CAddBreakpointInteractiveRulerAction_error_message"), //$NON-NLS-1$
- status);
- CDebugUIPlugin.log(status); //
- }
-
- /**
- * Disposes this action. Clients must call this method when
- * this action is no longer needed.
- */
- public void dispose() {
- fDocument = null;
- fPart = null;
- fRulerInfo = null;
- DebugUITools.getToggleBreakpointsTargetManager().removeChangedListener(fListener);
- }
-
- /**
- * Returns the document on which this action operates.
- *
- * @return the document or <code>null</code> if none
- */
- private IDocument getDocument() {
- if (fDocument != null)
- return fDocument;
-
- if (fPart instanceof ITextEditor) {
- ITextEditor editor= (ITextEditor)fPart;
- IDocumentProvider provider = editor.getDocumentProvider();
- if (provider != null)
- return provider.getDocument(editor.getEditorInput());
- }
-
- IDocument doc = (IDocument) fPart.getAdapter(IDocument.class);
- if (doc != null) {
- return doc;
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- IDocument document= getDocument();
- if (document != null) {
- int line = fRulerInfo.getLineOfLastMouseButtonActivity();
- if (line > -1) {
- try {
- ITextSelection selection = getTextSelection(document, line);
-
- IToggleBreakpointsTarget adapter =
- DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
- if (adapter == null) {
- setEnabled(false);
- return;
- }
- if (adapter instanceof IToggleBreakpointsTargetCExtension) {
- IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) adapter;
- if (extension.canCreateLineBreakpointsInteractive(fPart, selection)) {
- setEnabled(true);
- return;
- }
- }
- } catch (BadLocationException e) {
- reportException(e);
- }
- }
- }
- setEnabled(false);
- }
-
- /**
- * Determines the text selection for the breakpoint action. If clicking on the ruler inside
- * the highlighted text, return the text selection for the highlighted text. Otherwise,
- * return a text selection representing the start of the line.
- *
- * @param document The IDocument backing the Editor.
- * @param line The line clicked on in the ruler.
- * @return An ITextSelection as described.
- * @throws BadLocationException If underlying operations throw.
- */
- private ITextSelection getTextSelection(IDocument document, int line) throws BadLocationException {
- IRegion region = document.getLineInformation(line);
- ITextSelection textSelection = new TextSelection(document, region.getOffset(), 0);
- ISelectionProvider provider = fPart.getSite().getSelectionProvider();
- if (provider != null){
- ISelection selection = provider.getSelection();
- if (selection instanceof ITextSelection
- && ((ITextSelection) selection).getStartLine() <= line
- && ((ITextSelection) selection).getEndLine() >= line) {
- textSelection = (ITextSelection) selection;
- }
- }
- return textSelection;
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java
deleted file mode 100644
index c6a4e0edb9b..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerActionDelegate.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Creates a breakpoint interactively, that is with user input as well as context
- * information gathered from editor location. This action delegate can be
- * contributed to an editor with the <code>editorActions</code> extension point.
- * This action is as a factory that creates another action that performs the
- * actual breakpoint toggling. The created action acts on the editor's
- * <code>IToggleBreakpointsTagretCExtension</code> to create the breakpoint.
- * <p>
- * This action should be be contributed to a vertical ruler context menu via the
- * <code>popupMenus</code> extension point, by referencing the ruler's context
- * menu identifier in the <code>targetID</code> attribute.
- * <pre>
- * &lt;extension point="org.eclipse.ui.popupMenus"&gt;
- * &lt;viewerContribution
- * targetID="example.rulerContextMenuId"
- * id="example.RulerPopupActions"&gt;
- * &lt;action
- * label="Toggle Breakpoint"
- * class="org.eclipse.debug.ui.actions.RulerCreateBreakpointInteractiveActionDelegate"
- * menubarPath="additions"
- * id="example.rulerContextMenu.createBreakpointAction"&gt;
- * &lt;/action&gt;
- * &lt;/viewerContribution&gt;
- * </pre>
- * </p>
- * <p>
- * Clients may refer to this class as an action delegate in plug-in XML.
- * </p>
- * @see IToggleBreakpointsTargetCExtension
- * @since 7.2
- * @noextend This class is not intended to be sub-classed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- */
-public class CAddBreakpointInteractiveRulerActionDelegate extends AbstractRulerActionDelegate implements IActionDelegate2 {
-
- private IEditorPart fEditor = null;
- private CAddBreakpointInteractiveRulerAction fDelegate = null;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo)
- */
- protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- fDelegate = new CAddBreakpointInteractiveRulerAction(editor, null, rulerInfo);
- return fDelegate;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
- */
- public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
- if (fEditor != null) {
- if (fDelegate != null) {
- fDelegate.dispose();
- fDelegate = null;
- }
- }
- fEditor = targetEditor;
- super.setActiveEditor(callerAction, targetEditor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
- */
- public void init(IAction action) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate2#dispose()
- */
- public void dispose() {
- if (fDelegate != null) {
- fDelegate.dispose();
- }
- fDelegate = null;
- fEditor = null;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java
deleted file mode 100644
index 49f5b40c95e..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CBreakpointPropertiesRulerAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- * Anton Leherbauer (Wind River Systems) - bug 183397
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
-import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
-import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointPropertyDialogAction;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.contexts.IDebugContextListener;
-import org.eclipse.debug.ui.contexts.IDebugContextProvider;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Opens a custom properties dialog to configure the attibutes of a C/C++ breakpoint
- * from the ruler popup menu.
- */
-public class CBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
-
- private ICBreakpoint fBreakpoint;
-
- /**
- * Creates the action to modify the breakpoint properties.
- */
- public CBreakpointPropertiesRulerAction( IWorkbenchPart part, IVerticalRulerInfo info ) {
- super( part, info );
- setText( ActionMessages.getString( "CBreakpointPropertiesRulerAction.Breakpoint_Properties" ) ); //$NON-NLS-1$
- part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.BREAKPOINT_PROPERTIES_ACTION );
- setId( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES );
- }
-
- /* (non-Javadoc)
- * @see Action#run()
- */
- @Override
- public void run() {
- if ( fBreakpoint != null ) {
- final ISelection debugContext = DebugUITools.getDebugContextForPart(getTargetPart());
- CBreakpointPropertyDialogAction propertiesAction = new CBreakpointPropertyDialogAction(
- getTargetPart().getSite(),
- new ISelectionProvider() {
- @Override
- public ISelection getSelection() {
- return new StructuredSelection( fBreakpoint );
- }
- @Override public void addSelectionChangedListener( ISelectionChangedListener listener ) {}
- @Override public void removeSelectionChangedListener( ISelectionChangedListener listener ) {}
- @Override public void setSelection( ISelection selection ) {}
- },
- new IDebugContextProvider() {
- @Override
- public ISelection getActiveContext() {
- return debugContext;
- }
- @Override public void addDebugContextListener(IDebugContextListener listener) {}
- @Override public void removeDebugContextListener(IDebugContextListener listener) {}
- @Override public IWorkbenchPart getPart() { return null; }
-
- }
- );
- propertiesAction.run();
- propertiesAction.dispose();
- }
- }
-
- /* (non-Javadoc)
- * @see IUpdate#update()
- */
- @Override
- public void update() {
- IBreakpoint breakpoint= getBreakpoint();
-
- if (breakpoint instanceof ICBreakpoint) {
- fBreakpoint = (ICBreakpoint)breakpoint;
- } else {
- fBreakpoint = null;
- }
- setEnabled( fBreakpoint != null );
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java
deleted file mode 100644
index 14e1e3e24be..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleBreakpointObjectActionDelegate.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 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
- * Wind River Systems - added support for IToggleBreakpointsTargetFactory
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * A toggle breakpoint action that can be contributed to an object. The action
- * will perform a toggle breakpoint operation for a selected object.
- * <p>
- * This class is based on {@link org.eclipse.debug.internal.ui.actions.breakpoints.ToggleBreakpointObjectActionDelegate }
- * class. In addition to the copied functionality, it adds the handling of
- * action-triggering event.
- * </p>
- *
- * @since 7.2
- */
-public abstract class CToggleBreakpointObjectActionDelegate implements IObjectActionDelegate, IActionDelegate2 {
-
- private IWorkbenchPart fPart;
- private IStructuredSelection fSelection;
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- fPart = targetPart;
- }
-
- public void run(IAction action) {
- runWithEvent(action, null);
- }
-
- public void runWithEvent(IAction action, Event event) {
- IToggleBreakpointsTarget target =
- DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
- if (target != null) {
- try {
- performAction(target, fPart, fSelection, event);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
-
- /**
- * Performs the operation specific to this action.
- *
- * @param target adapter to toggle breakpoints
- * @param part the active part
- * @param selection the selection in the active part
- * @param event that triggered this action
- * @exception CoreException if an exception occurs
- */
- protected abstract void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection, Event event)
- throws CoreException;
-
- public void selectionChanged(IAction action, ISelection selection) {
- boolean enabled = false;
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- this.fSelection = ss;
- // selectionChagned() can sometimes be called before setActivePart().
- // Guard here against that possibility.
- if (fPart != null) {
- IToggleBreakpointsTarget target =
- DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, fSelection);
- enabled = target != null;
- }
- }
- action.setEnabled(enabled);
- }
-
- public void init(IAction action) {
- }
-
- public void dispose() {
- fSelection = null;
- fPart = null;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java
deleted file mode 100644
index 37aa40ad275..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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.cdt.debug.internal.ui.actions.breakpoints;
-
-import org.eclipse.cdt.debug.ui.breakpoints.IToggleBreakpointsTargetCExtension;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * A toggle method breakpoint action that can be contributed an object
- * contribution. The action will toggle method breakpoints on objects
- * that provide an <code>IToggleBreakpointsTarget</code> adapter.
- * <p>
- * This class is based on {@link org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate }
- * class. In addition to the copied functionality, it adds the handling of
- * action-triggering event.
- * </p>
- *
- * @since 7.2
- */
-public class CToggleMethodBreakpointActionDelegate extends CToggleBreakpointObjectActionDelegate {
-
- protected void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection, Event event)
- throws CoreException
- {
- if ((event.stateMask & SWT.MOD1) != 0 &&
- target instanceof IToggleBreakpointsTargetCExtension &&
- ((IToggleBreakpointsTargetCExtension)target).canCreateFunctionBreakpointInteractive(part, selection))
- {
- ((IToggleBreakpointsTargetCExtension)target).createFunctionBreakpointInteractive(part, selection);
- }
- else {
- target.toggleMethodBreakpoints(part, selection);
- }
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
deleted file mode 100644
index 41201f51497..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- * Freescale Semiconductor - Address watchpoints, https://bugs.eclipse.org/bugs/show_bug.cgi?id=118299
- * Warren Paul (Nokia) - Bug 217485, Bug 218342
- * Oyvind Harboe (oyvind.harboe@zylin.com) - Bug 225099
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import java.math.BigInteger;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
-import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
-import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Toggles a line breakpoint in a C/C++ editor.
- *
- * @since 7.2
- */
-public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
-
- @Override
- protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
- }
-
- @Override
- protected void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, int lineNumber) throws CoreException
- {
- if (interactive) {
- ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineBreakpoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setLineBreakpointAttributes(
- attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
- } else {
- CDIDebugModel.createLineBreakpoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true );//$NON-NLS-1$
- }
- }
-
- @Override
- protected ICFunctionBreakpoint findFunctionBreakpoint(String sourceHandle, IResource resource, String functionName)
- throws CoreException
- {
- return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
- }
-
- @Override
- protected void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, String functionName, int charStart, int charEnd, int lineNumber ) throws CoreException
- {
- if (interactive) {
- ICFunctionBreakpoint bp = CDIDebugModel.createBlankFunctionBreakpoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setFunctionBreakpointAttributes( attributes, sourceHandle, getBreakpointType(), functionName,
- charStart, charEnd, lineNumber, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(bp, part, resource, attributes);
- } else {
- CDIDebugModel.createFunctionBreakpoint(sourceHandle, resource, getBreakpointType(), functionName, charStart,
- charEnd, lineNumber, true, 0, "", true); //$NON-NLS-1$
- }
- }
-
- @Override
- protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
- return CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
- }
-
- @Override
- protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
- int charStart, int charEnd, int lineNumber, String expression) throws CoreException
- {
- ICWatchpoint bp = CDIDebugModel.createBlankWatchpoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setWatchPointAttributes(attributes, sourceHandle, resource, true, false,
- expression, "", new BigInteger("0"), true, 0, ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- openBreakpointPropertiesDialog(bp, part, resource, attributes);
- }
-
- protected int getBreakpointType() {
- return ICBreakpointType.REGULAR;
- }
-
- public static ICDIMemorySpaceManagement getMemorySpaceManagement(){
- IAdaptable debugViewElement = DebugUITools.getDebugContext();
- ICDIMemorySpaceManagement memMgr = null;
-
- if ( debugViewElement != null ) {
- ICDebugTarget debugTarget = (ICDebugTarget)debugViewElement.getAdapter(ICDebugTarget.class);
-
- if ( debugTarget != null ){
- ICDITarget target = (ICDITarget)debugTarget.getAdapter(ICDITarget.class);
-
- if (target instanceof ICDIMemorySpaceManagement)
- memMgr = (ICDIMemorySpaceManagement)target;
- }
- }
-
- return memMgr;
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java
deleted file mode 100644
index 375c8f7f00f..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleTracepointAdapter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson 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:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.actions.breakpoints;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-import org.eclipse.cdt.debug.ui.breakpoints.AbstractToggleBreakpointAdapter;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Toggles a tracepoint in a C/C++ editor.
- */
-public class ToggleTracepointAdapter extends AbstractToggleBreakpointAdapter {
-
- @Override
- protected ICLineBreakpoint findLineBreakpoint( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
- return CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
- }
-
- @Override
- protected void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, int lineNumber) throws CoreException
- {
- if (interactive) {
- ICLineBreakpoint lineBp = CDIDebugModel.createBlankLineTracepoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setLineBreakpointAttributes(
- attributes, sourceHandle, getBreakpointType(), lineNumber, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(lineBp, part, resource, attributes);
- } else {
- CDIDebugModel.createLineTracepoint( sourceHandle, resource, getBreakpointType(), lineNumber, true, 0, "", true );//$NON-NLS-1$
- }
- }
-
- @Override
- protected ICFunctionBreakpoint findFunctionBreakpoint( String sourceHandle, IResource resource, String functionName ) throws CoreException {
- return CDIDebugModel.functionBreakpointExists( sourceHandle, resource, functionName );
- }
-
- @Override
- protected void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, String functionName, int charStart, int charEnd, int lineNumber ) throws CoreException
- {
- if (interactive) {
- ICFunctionBreakpoint bp = CDIDebugModel.createBlankFunctionTracepoint();
- Map<String, Object> attributes = new HashMap<String, Object>();
- CDIDebugModel.setFunctionBreakpointAttributes( attributes, sourceHandle, getBreakpointType(), functionName,
- charStart, charEnd, lineNumber, true, 0, "" ); //$NON-NLS-1$
- openBreakpointPropertiesDialog(bp, part, resource, attributes);
- } else {
- CDIDebugModel.createFunctionTracepoint(sourceHandle, resource, getBreakpointType(), functionName, charStart,
- charEnd, lineNumber, true, 0, "", true); //$NON-NLS-1$
- }
- }
-
- @Override
- protected ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression ) throws CoreException {
- return null;
- }
-
- @Override
- public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
- return false;
- }
-
- protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
- int charStart, int charEnd, int lineNumber, String expression) throws CoreException
- {
- }
-
- protected int getBreakpointType() {
- return ICBreakpointType.REGULAR;
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java
deleted file mode 100644
index e6742c6bbc3..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class BreakpointsMessages {
-
- private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.breakpoints.BreakpointsMessages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
-
- private BreakpointsMessages() {
- }
-
- public static String getString( String key ) {
- try {
- return RESOURCE_BUNDLE.getString( key );
- }
- catch( MissingResourceException e ) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
deleted file mode 100644
index ecc61aa6bf0..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-###############################################################################
-# Copyright (c) 2003, 2009 QNX Software 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:
-# QNX Software Systems - initial API and implementation
-# Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
-# IBM Corporation
-###############################################################################
-
-CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
-CBreakpointPropertyPage.function_valueNotAvailable_label=Not available
-CBreakpointPropertyPage.function_label=Function name:
-CBreakpointPropertyPage.function_value_errorMessage=Enter a function expression:
-CBreakpointPropertyPage.breakpointType_function_label=C/C++ Function Breakpoint
-CBreakpointPropertyPage.address_valueNotAvailable_label=Not available
-CBreakpointPropertyPage.address_label=Address:
-CBreakpointPropertyPage.breakpointType_address_label=C/C++ Address Breakpoint
-CBreakpointPropertyPage.sourceHandle_label=File:
-CBreakpointPropertyPage.breakpointType_line_label=C/C++ Line Breakpoint
-CBreakpointPropertyPage.lineNumber_label=Line number:
-CBreakpointPropertyPage.breakpointType_event_label=C/C++ Event Breakpoint
-CBreakpointPropertyPage.project_label=Project:
-CBreakpointPropertyPage.breakpointType_watchpoint_label=C/C++ Watchpoint
-CBreakpointPropertyPage.breakpointType_watchpoint_read_label=C/C++ Read Watchpoint
-CBreakpointPropertyPage.breakpointType_watchpoint_access_label=C/C++ Access Watchpoint
-CBreakpointPropertyPage.watchpointType_read_label=Read
-CBreakpointPropertyPage.watchpointType_write_label=Write
-CBreakpointPropertyPage.watchpoint_expression_label=Expression to watch:
-CBreakpointPropertyPage.watchpoint_expression_errorMessage=Enter the expression to watch:
-CBreakpointPropertyPage.condition_label=&Condition:
-CBreakpointPropertyPage.condition_invalidValue_message=Invalid condition.
-CBreakpointPropertyPage.ignoreCount_label=&Ignore count:
-CBreakpointPropertyPage.breakpointType_label=Class:
-CBreakpointPropertyPage.enabled_label=Enabled
-
-ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java
deleted file mode 100644
index c558db83b63..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- * QNX Software Systems - Refactored to use platform implementation
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.jface.preference.IPersistentPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * A preference store that presents the state of the properties of a C/C++ breakpoint.
- */
-public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
-
- // This map is the current properties/values being maintained/manipulated
- private HashMap<String, Object> fProperties = new HashMap<String, Object>();
-
- // Original set of values. So we can see what has really changed on the save and
- // perform appropriate change operations. We only really want to operate on changed
- // values, to avoid generating churn.
- private HashMap<String, Object> fOriginalValues = new HashMap<String, Object>();
- private boolean fIsDirty = false;
- private boolean fIsCanceled = false;
- private ListenerList fListeners;
- private final CBreakpointContext fContext;
-
- // TODO: remove after fixing add event breapoint dialog.
- public CBreakpointPreferenceStore() {
- this (null, null);
- }
-
- public CBreakpointPreferenceStore(CBreakpointContext context, Map<String, Object> attributes) {
- fListeners = new ListenerList(org.eclipse.core.runtime.ListenerList.IDENTITY);
- fContext = context;
-
- fOriginalValues.clear();
- fProperties.clear();
- if (context != null) {
- IMarker marker = context.getBreakpoint().getMarker();
- if (marker != null) {
- Map<String, Object> bpAttrs = Collections.emptyMap();
- try {
- bpAttrs = marker.getAttributes();
- fOriginalValues.putAll(bpAttrs);
- fProperties.putAll(bpAttrs);
- } catch (CoreException e) {
- DebugPlugin.log(e);
- }
- }
- }
- if (attributes != null) {
- fProperties.putAll(attributes);
- fIsDirty = true;
- }
- }
-
- public Map<String, Object> getAttributes() {
- return fProperties;
- }
-
- public void setCanceled(boolean canceled) {
- fIsCanceled = canceled;
- }
-
- public void save() throws IOException {
- if (!fIsCanceled && fContext != null && fContext.getBreakpoint() != null) {
- ICBreakpoint bp = fContext.getBreakpoint();
- if (bp.getMarker() != null && fIsDirty) {
- saveToExistingMarker(bp, bp.getMarker());
- }
- else if (fContext.getResource() != null){
- saveToNewMarker(bp, fContext.getResource());
- } else {
- throw new IOException("Unable to create breakpoint: no resource specified."); //$NON-NLS-1$
- }
- }
-
- }
-
- private void saveToExistingMarker(final ICBreakpoint breakpoint, final IMarker marker) throws IOException {
- final List<String> changedProperties = new ArrayList<String>( 5 );
- Set<String> valueNames = fProperties.keySet();
- for ( String name : valueNames ) {
- if ( fProperties.containsKey( name ) ) {
- Object originalObject = fOriginalValues.get( name );
- Object currentObject = fProperties.get( name );
- if ( originalObject == null ) {
- changedProperties.add( name );
- }
- else if ( ! originalObject.equals( currentObject ) ) {
- changedProperties.add( name );
- }
- }
- }
- if ( ! changedProperties.isEmpty() ) {
- IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- public void run( IProgressMonitor monitor ) throws CoreException {
- Iterator<String> changed = changedProperties.iterator();
- while( changed.hasNext() ) {
- String property = changed.next();
- if ( property.equals( ICBreakpoint.ENABLED ) ) {
- breakpoint.setEnabled( getBoolean( ICBreakpoint.ENABLED ) );
- }
- else if ( property.equals( ICBreakpoint.IGNORE_COUNT ) ) {
- breakpoint.setIgnoreCount( getInt( ICBreakpoint.IGNORE_COUNT ) );
- }
- else if ( property.equals( ICBreakpoint.CONDITION ) ) {
- breakpoint.setCondition( getString( ICBreakpoint.CONDITION ) );
- }
- else if ( property.equals( IMarker.LINE_NUMBER ) ) {
- // already workspace runnable, setting markers are safe
- breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getInt(IMarker.LINE_NUMBER));
- breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getInt(IMarker.LINE_NUMBER));
- } else {
- // this allow set attributes contributed by other plugins
- Object value = fProperties.get(property);
- if ( value != null ) {
- marker.setAttribute(property, value);
- }
- }
- }
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run( wr, null );
- }
- catch( CoreException ce ) {
- throw new IOException("Cannot save properties to breakpoint.", ce); //$NON-NLS-1$
- }
- }
- }
-
- private void saveToNewMarker(final ICBreakpoint breakpoint, final IResource resource) throws IOException {
- try {
- CDIDebugModel.createBreakpointMarker(breakpoint, resource, fProperties, true);
- }
- catch( CoreException ce ) {
- throw new IOException("Cannot save properties to new breakpoint.", ce); //$NON-NLS-1$
- }
- }
-
- ///////////////////////////////////////////////////////////////////////
- // IPreferenceStore
-
- public boolean needsSaving() {
- return fIsDirty && !fIsCanceled;
- }
-
- public boolean contains(String name) {
- return fProperties.containsKey(name);
- }
-
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.add(listener);
- }
-
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fListeners.remove(listener);
- }
-
- public void firePropertyChangeEvent(String name,
- Object oldValue,
- Object newValue)
- {
- Object[] listeners = fListeners.getListeners();
- // Do we need to fire an event.
- if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
- PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
- for (int i = 0; i < listeners.length; ++i) {
- IPropertyChangeListener l = (IPropertyChangeListener) listeners[i];
- l.propertyChange(pe);
- }
- }
- }
-
- public boolean getBoolean(String name) {
- boolean retVal = false;
- Object o = fProperties.get(name);
- if (o instanceof Boolean) {
- retVal = ((Boolean)o).booleanValue();
- }
- return retVal;
- }
-
- public int getInt(String name) {
- int retVal = 0;
- Object o = fProperties.get(name);
- if (o instanceof Integer) {
- retVal = ((Integer)o).intValue();
- }
- return retVal;
- }
-
- public String getString(String name) {
- String retVal = null;
- Object o = fProperties.get(name);
- if (o instanceof String) {
- retVal = (String)o;
- }
- return retVal;
- }
-
- public double getDouble(String name) { return 0; }
- public float getFloat(String name) { return 0; }
- public long getLong(String name) { return 0; }
-
- public boolean isDefault(String name) { return false; }
-
- public boolean getDefaultBoolean(String name) { return false; }
- public double getDefaultDouble(String name) { return 0; }
- public float getDefaultFloat(String name) { return 0; }
- public int getDefaultInt(String name) { return 0; }
- public long getDefaultLong(String name) { return 0; }
- public String getDefaultString(String name) { return null; }
-
- public void putValue(String name, String value) {
- Object oldValue = fProperties.get(name);
- if ( oldValue == null || !oldValue.equals(value) ) {
- fProperties.put(name, value);
- setDirty(true);
- }
- }
-
- public void setDefault(String name, double value) {}
- public void setDefault(String name, float value) {}
- public void setDefault(String name, int value) {}
- public void setDefault(String name, long value) {}
- public void setDefault(String name, String defaultObject) {}
- public void setDefault(String name, boolean value) {}
- public void setToDefault(String name) {}
-
- public void setValue(String name, boolean value) {
- boolean oldValue = getBoolean(name);
- if (oldValue != value) {
- fProperties.put( name, new Boolean(value) );
- setDirty(true);
- firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value) );
- }
- }
-
- public void setValue(String name, int value) {
- int oldValue = getInt(name);
- if (oldValue != value) {
- fProperties.put( name, new Integer(value) );
- setDirty(true);
- firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value) );
- }
- }
-
- public void setValue(String name, String value) {
- Object oldValue = fProperties.get(name);
- if ( (oldValue == null && value != null) ||
- (oldValue != null && !oldValue.equals(value)) )
- {
- fProperties.put(name, value);
- setDirty(true);
- firePropertyChangeEvent(name, oldValue, value);
- }
- }
-
- public void setValue(String name, float value) {}
- public void setValue(String name, double value) {}
- public void setValue(String name, long value) {}
-
- // IPreferenceStore
- ///////////////////////////////////////////////////////////////////////
-
- private void setDirty(boolean isDirty) {
- fIsDirty = isDirty;
- }
-}
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
deleted file mode 100644
index 587abcbfa04..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
+++ /dev/null
@@ -1,498 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 QNX Software 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:
- * QNX Software Systems - Initial API and implementation
- * Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
- * QNX Software Systems - Catchpoints support https://bugs.eclipse.org/bugs/show_bug.cgi?id=226689
- *******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
-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.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.model.ILineBreakpoint;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * The preference page used to present the properties of a breakpoint as preferences. A CBreakpointPreferenceStore is used to interface between this page and
- * the breakpoint.
- */
-public class CBreakpointPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
-
- class BreakpointIntegerFieldEditor extends IntegerFieldEditor {
-
- public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent ) {
- super( name, labelText, parent );
- setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.0" ) ); //$NON-NLS-1$
- }
-
- /**
- * @see IntegerFieldEditor#checkState()
- */
- @Override
- protected boolean checkState() {
- Text control = getTextControl();
- if ( !control.isEnabled() ) {
- clearErrorMessage();
- return true;
- }
- return super.checkState();
- }
-
- /**
- * Overrode here to be package visible.
- */
- @Override
- protected void refreshValidState() {
- super.refreshValidState();
- }
-
- /**
- * Only store if the text control is enabled
- *
- * @see FieldEditor#doStore()
- */
- @Override
- protected void doStore() {
- Text text = getTextControl();
- if ( text.isEnabled() ) {
- super.doStore();
- }
- }
-
- /**
- * Clears the error message from the message line if the error message is the error message from this field editor.
- */
- @Override
- protected void clearErrorMessage() {
- if ( getPage() != null ) {
- String message = getPage().getErrorMessage();
- if ( message != null ) {
- if ( getErrorMessage().equals( message ) ) {
- super.clearErrorMessage();
- }
- }
- else {
- super.clearErrorMessage();
- }
- }
- }
- }
-
- class BreakpointStringFieldEditor extends StringFieldEditor {
-
- public BreakpointStringFieldEditor( String name, String labelText, Composite parent ) {
- super( name, labelText, parent );
- }
-
- /**
- * @see StringFieldEditor#checkState()
- */
- @Override
- protected boolean checkState() {
- Text control = getTextControl();
- if ( !control.isEnabled() ) {
- clearErrorMessage();
- return true;
- }
- return super.checkState();
- }
-
- @Override
- protected void doStore() {
- Text text = getTextControl();
- if ( text.isEnabled() ) {
- super.doStore();
- }
- }
- protected void doLoad() {
- String value = getPreferenceStore().getString(getPreferenceName());
- setStringValue(value);
- }
-
- /**
- * @see FieldEditor#refreshValidState()
- */
- @Override
- protected void refreshValidState() {
- super.refreshValidState();
- }
-
- /**
- * Clears the error message from the message line if the error message is the error message from this field editor.
- */
- @Override
- protected void clearErrorMessage() {
- if ( getPage() != null ) {
- String message = getPage().getErrorMessage();
- if ( message != null ) {
- if ( getErrorMessage().equals( message ) ) {
- super.clearErrorMessage();
- }
- }
- else {
- super.clearErrorMessage();
- }
- }
- }
- }
-
- class LabelFieldEditor extends ReadOnlyFieldEditor {
- private String fValue;
-
- public LabelFieldEditor( Composite parent, String title, String value ) {
- super(title, title, parent);
- fValue = value;
- }
-
- @Override
- protected void doLoad() {
- if (textField != null) {
- textField.setText(fValue);
- }
- }
- @Override
- protected void doLoadDefault() {
- // nothing
- }
-
- }
-
- private BooleanFieldEditor fEnabled;
-
- private BreakpointStringFieldEditor fCondition;
-
- private Text fIgnoreCountTextControl;
-
- private BreakpointIntegerFieldEditor fIgnoreCount;
-
- private IAdaptable fElement;
-
- /**
- * The preference store used to interface between the breakpoint and the
- * breakpoint preference page. This preference store is initialized only
- * when the preference store cannot be retrieved from the preference
- * dialog's element.
- * @see #getPreferenceStore()
- */
- private CBreakpointPreferenceStore fCBreakpointPreferenceStore;
-
- /**
- * Constructor for CBreakpointPropertyPage.
- *
- * @param breakpoint
- */
- public CBreakpointPropertyPage() {
- super( GRID );
- noDefaultAndApplyButton();
-// Control control = getControl();
-// fCBreakpointPreferenceStore = new CBreakpointPreferenceStore();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- @Override
- protected void createFieldEditors() {
- ICBreakpoint breakpoint = getBreakpoint();
- createMainLabel(breakpoint);
- createContributedFieldEditors(breakpoint);
- createTypeSpecificLabelFieldEditors( breakpoint );
- createEnabledField( getFieldEditorParent() );
- createConditionEditor( getFieldEditorParent() );
- createIgnoreCountEditor( getFieldEditorParent() );
- }
-
- private void createMainLabel(ICBreakpoint breakpoint) {
- String label = getBreakpointMainLabel(breakpoint);
- addField( createLabelEditor(
- getFieldEditorParent(),
- BreakpointsMessages.getString( "CBreakpointPropertyPage.breakpointType_label" ), //$NON-NLS-1$
- label) );
- }
-
- /**
- * Method createTypeSpecificLabelFieldEditors.
- *
- * @param breakpoint
- */
- private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint ) {
-
- if ( breakpoint instanceof ICFunctionBreakpoint ) {
- createFunctionEditor(getFieldEditorParent());
- }
- else if ( breakpoint instanceof ICAddressBreakpoint ) {
- String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.address_label" ); //$NON-NLS-1$
-
- String address = getPreferenceStore().getString(ICLineBreakpoint.ADDRESS);
- if (address == null || address.trim().length() == 0) {
- address = BreakpointsMessages.getString( "CBreakpointPropertyPage.address_valueNotAvailable_label" ); //$NON-NLS-1$
- }
- addField( createLabelEditor( getFieldEditorParent(), title, address ) );
- }
- else if ( breakpoint instanceof ICWatchpoint ) {
- IResource resource = getResource();
- if (resource != null) {
- IProject project = resource.getProject();
- if ( project != null ) {
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.project_label" ), project.getName() ) ); //$NON-NLS-1$
- }
- }
- String filename = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
- if (filename != null && !"".equals(filename)) { //$NON-NLS-1$
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.sourceHandle_label" ), filename ) ); //$NON-NLS-1$
- }
- createWatchExpressionEditor(getFieldEditorParent());
- createWatchTypeEditors(getFieldEditorParent());
-
- }
- else if ( breakpoint instanceof ILineBreakpoint ) {
- String fileName = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
- if ( fileName != null ) {
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.sourceHandle_label" ), fileName ) ); //$NON-NLS-1$
- }
- int lNumber = getPreferenceStore().getInt(IMarker.LINE_NUMBER);
- if (lNumber > 0) {
- getPreferenceStore().setValue( IMarker.LINE_NUMBER, lNumber);
- createLineNumberEditor(getFieldEditorParent());
- }
- }
- }
-
- private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
- if (breakpoint instanceof ICWatchpoint && breakpoint.getMarker() != null) {
- // For an existing breakpoint, calculate watchpoint label based
- // on read/write type.
- boolean isReadType = getPreferenceStore().getBoolean(ICWatchpoint.READ);
- boolean isWriteType = getPreferenceStore().getBoolean(ICWatchpoint.WRITE);
- if (isReadType && !isWriteType) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_read_label"); //$NON-NLS-1$
- } else if (!isReadType && isWriteType) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
- } else {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_breakpointType_watchpoint_access_label"); //$NON-NLS-1$
- }
- }
-
- IWorkbenchAdapter labelProvider = (IWorkbenchAdapter)getElement().getAdapter(IWorkbenchAdapter.class);
- if (labelProvider != null) {
- return labelProvider.getLabel(getElement());
- }
- // default main label is the label of marker type for the breakpoint
- return CDIDebugModel.calculateMarkerType(breakpoint);
- }
-
- protected void createFunctionEditor( Composite parent ) {
-
- ICBreakpoint breakpoint = getBreakpoint();
- String title = BreakpointsMessages.getString("CBreakpointPropertyPage.function_label"); //$NON-NLS-1$
- if (breakpoint == null || breakpoint.getMarker() == null) {
- BreakpointStringFieldEditor expressionEditor = new BreakpointStringFieldEditor(
- ICLineBreakpoint.FUNCTION, title, parent);
- expressionEditor.setErrorMessage(BreakpointsMessages.getString("CBreakpointPropertyPage.function_value_errorMessage")); //$NON-NLS-1$
- expressionEditor.setEmptyStringAllowed(false);
- addField(expressionEditor);
- } else {
- String function = getPreferenceStore().getString(ICLineBreakpoint.FUNCTION);
- if ( function == null ) {
- function = BreakpointsMessages.getString( "CBreakpointPropertyPage.function_valueNotAvailable_label" ); //$NON-NLS-1$
- }
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.function_label" ), function ) ); //$NON-NLS-1$
- }
- }
-
- protected void createLineNumberEditor( Composite parent ) {
- String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.lineNumber_label" ); //$NON-NLS-1$
- BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( IMarker.LINE_NUMBER ,title, parent);
- labelFieldEditor.setValidRange( 1, Integer.MAX_VALUE );
- addField( labelFieldEditor );
- }
-
- protected void createWatchExpressionEditor( Composite parent ) {
- ICBreakpoint breakpoint = getBreakpoint();
- if (breakpoint == null || breakpoint.getMarker() == null) {
- BreakpointStringFieldEditor expressionEditor =new BreakpointStringFieldEditor(
- ICWatchpoint.EXPRESSION,
- BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_expression_label"), //$NON-NLS-1$
- parent);
- expressionEditor.setErrorMessage(BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_expression_errorMessage")); //$NON-NLS-1$
- expressionEditor.setEmptyStringAllowed(false);
- addField(expressionEditor);
- } else {
- addField(createLabelEditor(
- parent,
- BreakpointsMessages.getString("CBreakpointPropertyPage.watchpoint_expression_label"), //$NON-NLS-1$
- getPreferenceStore().getString(ICWatchpoint.EXPRESSION) ));
- }
- }
-
- protected void createWatchTypeEditors( Composite parent ) {
- // Edit read/write options only when creating the breakpoint.
- ICBreakpoint breakpoint = getBreakpoint();
- if (breakpoint != null && breakpoint.getMarker() == null) {
- addField( new BooleanFieldEditor(
- ICWatchpoint.READ,
- BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_read_label"), //$NON-NLS-1$
- parent) );
- addField( new BooleanFieldEditor(
- ICWatchpoint.WRITE,
- BreakpointsMessages.getString("CBreakpointPropertyPage.watchpointType_write_label"), //$NON-NLS-1$
- parent) );
- }
- }
-
- protected void createEnabledField( Composite parent ) {
- fEnabled = new BooleanFieldEditor( ICBreakpoint.ENABLED, BreakpointsMessages.getString( "CBreakpointPropertyPage.enabled_label" ), parent ); //$NON-NLS-1$
- addField( fEnabled );
- }
-
- protected void createConditionEditor( Composite parent ) {
- fCondition = new BreakpointStringFieldEditor( ICBreakpoint.CONDITION, BreakpointsMessages.getString( "CBreakpointPropertyPage.condition_label" ), parent ); //$NON-NLS-1$
- fCondition.setEmptyStringAllowed( true );
- fCondition.setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.condition_invalidValue_message" ) ); //$NON-NLS-1$
- addField( fCondition );
- }
-
- protected void createIgnoreCountEditor( Composite parent ) {
- fIgnoreCount = new BreakpointIntegerFieldEditor( ICBreakpoint.IGNORE_COUNT, BreakpointsMessages.getString( "CBreakpointPropertyPage.ignoreCount_label" ), parent ); //$NON-NLS-1$
- fIgnoreCount.setValidRange( 0, Integer.MAX_VALUE );
- fIgnoreCountTextControl = fIgnoreCount.getTextControl( parent );
- fIgnoreCountTextControl.setEnabled( getPreferenceStore().getInt(ICBreakpoint.IGNORE_COUNT) >= 0 );
- addField( fIgnoreCount );
- }
-
- protected FieldEditor createLabelEditor( Composite parent, String title, String value ) {
- return new LabelFieldEditor( parent, title, value );
- }
-
- protected ICBreakpoint getBreakpoint() {
- IAdaptable element = getElement();
- if (element instanceof ICBreakpoint) {
- return (ICBreakpoint)element;
- } else if (element instanceof ICBreakpointContext) {
- return ((ICBreakpointContext)element).getBreakpoint();
- } else {
- return (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
- }
- }
-
- protected IResource getResource() {
- IAdaptable element = getElement();
- if (element instanceof ICBreakpoint) {
- IMarker marker = ((ICBreakpoint)element).getMarker();
- if (marker != null) {
- return marker.getResource();
- }
- } else if (element instanceof ICBreakpointContext) {
- return ((ICBreakpointContext)element).getResource();
- }
- return null;
- }
-
- public IPreferenceStore getPreferenceStore() {
- IAdaptable element = getElement();
- 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
- public boolean performCancel() {
- IPreferenceStore store = getPreferenceStore();
- if (store instanceof CBreakpointPreferenceStore) {
- ((CBreakpointPreferenceStore)store).setCanceled(true);
- }
- return super.performCancel();
- }
-
- @Override
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- if (store instanceof CBreakpointPreferenceStore) {
- ((CBreakpointPreferenceStore)store).setCanceled(false);
- }
- return super.performOk();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- @Override
- public IAdaptable getElement() {
- return fElement;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public void setElement( IAdaptable element ) {
- fElement = element;
- }
-
- /**
- * Creates field editors contributed using breakpointUIContribution extension point
- * @param breakpoint
- */
- private void createContributedFieldEditors(ICBreakpoint breakpoint) {
- Composite parent = getFieldEditorParent();
- try {
- ICBreakpointsUIContribution[] cons;
- CBreakpointUIContributionFactory factory = CBreakpointUIContributionFactory.getInstance();
- IPreferenceStore prefStore = getPreferenceStore();
- if (prefStore instanceof CBreakpointPreferenceStore) {
- cons = factory.getBreakpointUIContributions(
- breakpoint, ((CBreakpointPreferenceStore) prefStore).getAttributes());
- } else {
- cons = factory.getBreakpointUIContributions(breakpoint);
- }
-
- for (ICBreakpointsUIContribution con : cons) {
- FieldEditor fieldEditor = con.getFieldEditor(con.getId(), con.getLabel()+":", parent); //$NON-NLS-1$
- if (fieldEditor != null) {
- addField(fieldEditor);
- }
- }
- } catch (CoreException ce) {
- CDebugUIPlugin.log(ce);
- }
-
- }
-
-}
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
deleted file mode 100644
index a2f1824acb8..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CreateBreakpointTester.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.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;
-
-/**
- *
- */
-public class CreateBreakpointTester extends PropertyTester {
-
- private final static String PROP_CREATE_BREAKPOINT_ADAPT = "createBreakpointAdapt"; //$NON-NLS-1$
-
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (PROP_CREATE_BREAKPOINT_ADAPT.equals(property) &&
- receiver instanceof ICBreakpointContext &&
- expectedValue instanceof String)
- {
- try {
- Class<?> expectedClass = Class.forName((String)expectedValue);
- return expectedClass.isAssignableFrom(
- ((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$
- }
- }
- return false;
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java
index 5be9925b9b4..a7760a44005 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/dialogs/AddEventBreakpointDialog.java
@@ -18,7 +18,8 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpointType;
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPreferenceStore;
+import org.eclipse.cdt.debug.internal.core.breakpoints.CEventBreakpoint;
+import org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointPreferenceStore;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution;
@@ -74,10 +75,10 @@ public class AddEventBreakpointDialog extends Dialog implements ModifyListener,
protected void createFieldEditors() {
Composite parent = getFieldEditorParent();
try {
- Map<String, Object> map = new HashMap<String, Object>();
+ Map map = new HashMap();
map.put(ICEventBreakpoint.EVENT_TYPE_ID, eventType);
ICBreakpointsUIContribution cons[] = CBreakpointUIContributionFactory.getInstance()
- .getBreakpointUIContributions(modelId, ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER, map);
+ .getBreakpointUIContributions(modelId, CEventBreakpoint.getMarkerType(), map);
for (ICBreakpointsUIContribution con : cons) {
if (con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) continue;
@@ -115,7 +116,7 @@ public class AddEventBreakpointDialog extends Dialog implements ModifyListener,
private void loadEventTypes() {
ICBreakpointsUIContribution[] cons = factory.getBreakpointUIContributions(debugModelId,
- ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER, null);
+ CEventBreakpoint.getMarkerType(), null);
for (int i = 0; i < cons.length; i++) {
ICBreakpointsUIContribution con = cons[i];
if (con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) {
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
index bcc888c780d..00f7a7e1d3d 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java
@@ -13,8 +13,8 @@ package org.eclipse.cdt.debug.internal.ui.disassembly.editor;
import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.CBreakpointPropertiesRulerAction;
-import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
+import org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerAction;
+import org.eclipse.cdt.debug.internal.ui.actions.EnableDisableBreakpointRulerAction;
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane;
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java
index a74f4707bbe..7879cd8ccc4 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointFilteringPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointFilteringPage.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.propertypages;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
@@ -48,7 +48,7 @@ public class CBreakpointFilteringPage extends PropertyPage {
ICBreakpoint bp = getBreakpoint();
if (bp != null) {
try {
- return bp.getExtension(
+ return (ICBreakpointFilterExtension)bp.getExtension(
CDIDebugModel.getPluginIdentifier(), ICBreakpointFilterExtension.class);
} catch (CoreException e) {}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java
new file mode 100644
index 00000000000..e873bd5bde4
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPreferenceStore.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ * QNX Software Systems - Refactored to use platform implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.propertypages;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceStore;
+
+/**
+ * A preference store that presents the state of the properties of a C/C++ breakpoint.
+ */
+public class CBreakpointPreferenceStore extends PreferenceStore implements IPreferenceStore {
+
+ protected final static String ENABLED = "ENABLED"; //$NON-NLS-1$
+
+ protected final static String CONDITION = "CONDITION"; //$NON-NLS-1$
+
+ protected final static String IGNORE_COUNT = "IGNORE_COUNT"; //$NON-NLS-1$
+
+ protected final static String LINE = "LINE"; //$NON-NLS-1$
+
+ /**
+ * Constructor for CBreakpointPreferenceStore.
+ */
+ public CBreakpointPreferenceStore() {
+
+ }
+
+ /**
+ * Override to not save.
+ * This store used for temporary breakpoint setting in dialogs
+ * and does not require permanent storage.
+ */
+ @Override
+ public boolean needsSaving() {
+ return false;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java
new file mode 100644
index 00000000000..006f98937e8
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java
@@ -0,0 +1,525 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ * Nokia - https://bugs.eclipse.org/bugs/show_bug.cgi?id=145606
+ * QNX Software Systems - Catchpoints support https://bugs.eclipse.org/bugs/show_bug.cgi?id=226689
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.propertypages;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICLineBreakpoint2;
+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.ICBreakpointsUIContribution;
+import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPropertyPage;
+
+/**
+ * The preference page used to present the properties of a breakpoint as preferences. A CBreakpointPreferenceStore is used to interface between this page and
+ * the breakpoint.
+ */
+public class CBreakpointPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
+
+ class BreakpointIntegerFieldEditor extends IntegerFieldEditor {
+
+ public BreakpointIntegerFieldEditor( String name, String labelText, Composite parent ) {
+ super( name, labelText, parent );
+ setErrorMessage( PropertyPageMessages.getString( "CBreakpointPropertyPage.0" ) ); //$NON-NLS-1$
+ }
+
+ /**
+ * @see IntegerFieldEditor#checkState()
+ */
+ @Override
+ protected boolean checkState() {
+ Text control = getTextControl();
+ if ( !control.isEnabled() ) {
+ clearErrorMessage();
+ return true;
+ }
+ return super.checkState();
+ }
+
+ /**
+ * Overrode here to be package visible.
+ */
+ @Override
+ protected void refreshValidState() {
+ super.refreshValidState();
+ }
+
+ /**
+ * Only store if the text control is enabled
+ *
+ * @see FieldEditor#doStore()
+ */
+ @Override
+ protected void doStore() {
+ Text text = getTextControl();
+ if ( text.isEnabled() ) {
+ super.doStore();
+ }
+ }
+
+ /**
+ * Clears the error message from the message line if the error message is the error message from this field editor.
+ */
+ @Override
+ protected void clearErrorMessage() {
+ if ( getPage() != null ) {
+ String message = getPage().getErrorMessage();
+ if ( message != null ) {
+ if ( getErrorMessage().equals( message ) ) {
+ super.clearErrorMessage();
+ }
+ }
+ else {
+ super.clearErrorMessage();
+ }
+ }
+ }
+ }
+
+ class BreakpointStringFieldEditor extends StringFieldEditor {
+
+ public BreakpointStringFieldEditor( String name, String labelText, Composite parent ) {
+ super( name, labelText, parent );
+ }
+
+ /**
+ * @see StringFieldEditor#checkState()
+ */
+ @Override
+ protected boolean checkState() {
+ Text control = getTextControl();
+ if ( !control.isEnabled() ) {
+ clearErrorMessage();
+ return true;
+ }
+ return super.checkState();
+ }
+
+ @Override
+ protected void doStore() {
+ Text text = getTextControl();
+ if ( text.isEnabled() ) {
+ super.doStore();
+ }
+ }
+
+ /**
+ * @see FieldEditor#refreshValidState()
+ */
+ @Override
+ protected void refreshValidState() {
+ super.refreshValidState();
+ }
+
+ /**
+ * Clears the error message from the message line if the error message is the error message from this field editor.
+ */
+ @Override
+ protected void clearErrorMessage() {
+ if ( getPage() != null ) {
+ String message = getPage().getErrorMessage();
+ if ( message != null ) {
+ if ( getErrorMessage().equals( message ) ) {
+ super.clearErrorMessage();
+ }
+ }
+ else {
+ super.clearErrorMessage();
+ }
+ }
+ }
+ }
+
+ class LabelFieldEditor extends ReadOnlyFieldEditor {
+ private String fValue;
+
+ public LabelFieldEditor( Composite parent, String title, String value ) {
+ super(title, title, parent);
+ fValue = value;
+ }
+
+ @Override
+ protected void doLoad() {
+ if (textField != null) {
+ textField.setText(fValue);
+ }
+ }
+ @Override
+ protected void doLoadDefault() {
+ // nothing
+ }
+
+ }
+
+ private BooleanFieldEditor fEnabled;
+
+ private BreakpointStringFieldEditor fCondition;
+
+ private Text fIgnoreCountTextControl;
+
+ private BreakpointIntegerFieldEditor fIgnoreCount;
+
+ private IAdaptable fElement;
+
+ /**
+ * The "fake" preference store used to interface between
+ * the breakpoint and the breakpoint preference page.
+ */
+ private CBreakpointPreferenceStore fCBreakpointPreferenceStore;
+
+ /**
+ * Constructor for CBreakpointPropertyPage.
+ *
+ * @param breakpoint
+ */
+ public CBreakpointPropertyPage() {
+ super( GRID );
+ noDefaultAndApplyButton();
+ fCBreakpointPreferenceStore = new CBreakpointPreferenceStore();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ ICBreakpoint breakpoint = getBreakpoint();
+ createMainLabel(breakpoint);
+ createContributetedFieldEditors(breakpoint);
+ createTypeSpecificLabelFieldEditors( breakpoint );
+ createEnabledField( getFieldEditorParent() );
+ IPreferenceStore store = getPreferenceStore();
+ try {
+ String condition = breakpoint.getCondition();
+ if ( condition == null ) {
+ condition = ""; //$NON-NLS-1$
+ }
+ store.setValue( CBreakpointPreferenceStore.CONDITION, condition );
+ createConditionEditor( getFieldEditorParent() );
+ store.setValue( CBreakpointPreferenceStore.ENABLED, breakpoint.isEnabled() );
+ int ignoreCount = breakpoint.getIgnoreCount();
+ store.setValue( CBreakpointPreferenceStore.IGNORE_COUNT, (ignoreCount >= 0) ? ignoreCount : 0 );
+ createIgnoreCountEditor( getFieldEditorParent() );
+ }
+ catch( CoreException ce ) {
+ CDebugUIPlugin.log( ce );
+ }
+ }
+
+ private void createMainLabel(ICBreakpoint breakpoint) {
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), //$NON-NLS-1$
+ getBreakpointMainLabel(breakpoint) ) );
+ }
+
+ /**
+ * Method createTypeSpecificLabelFieldEditors.
+ *
+ * @param breakpoint
+ */
+ private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint ) {
+
+ if ( breakpoint instanceof ICFunctionBreakpoint ) {
+ ICFunctionBreakpoint fbrkpt = (ICFunctionBreakpoint)breakpoint;
+ String function = PropertyPageMessages.getString( "CBreakpointPropertyPage.1" ); //$NON-NLS-1$
+ try {
+ function = fbrkpt.getFunction();
+ }
+ catch( CoreException e ) {
+ }
+ catch( NumberFormatException e ) {
+ }
+ if ( function != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.2" ), function ) ); //$NON-NLS-1$
+ }
+ }
+ else if ( breakpoint instanceof ICAddressBreakpoint ) {
+ ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
+ String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
+ try {
+ address = abrkpt.getAddress();
+ }
+ catch( CoreException e ) {
+ }
+ if ( address != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$
+ }
+ }
+ else if ( breakpoint instanceof ICWatchpoint ) {
+ ICWatchpoint watchpoint = (ICWatchpoint)breakpoint;
+ String expression = ""; //$NON-NLS-1$
+ try {
+ expression = watchpoint.getExpression();
+ }
+ catch( CoreException ce ) {
+ CDebugUIPlugin.log( ce );
+ }
+ IProject project = breakpoint.getMarker().getResource().getProject();
+ if ( project != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.10" ), project.getName() ) ); //$NON-NLS-1$
+ }
+ IResource resource = breakpoint.getMarker().getResource();
+ if ( resource instanceof IFile ) {
+ String filename = resource.getLocation().toOSString();
+ if ( filename != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.20" ), filename ) ); //$NON-NLS-1$
+ }
+ }
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$
+ }
+ else if ( breakpoint instanceof ILineBreakpoint ) {
+ String fileName = null;
+ try {
+ fileName = breakpoint.getSourceHandle();
+ }
+ catch( CoreException e ) {
+ }
+ if ( fileName != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.7" ), fileName ) ); //$NON-NLS-1$
+ }
+ ILineBreakpoint lBreakpoint = (ILineBreakpoint) breakpoint;
+
+ int lNumber = 0;
+ try {
+ lNumber = lBreakpoint.getLineNumber();
+ } catch (CoreException e) {
+ CDebugUIPlugin.log(e);
+ }
+
+ if (lNumber > 0) {
+ getPreferenceStore().setValue( CBreakpointPreferenceStore.LINE, lNumber);
+ createLineNumberEditor(getFieldEditorParent());
+ }
+ }
+ }
+
+ private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
+ if (breakpoint instanceof ICFunctionBreakpoint)
+ return PropertyPageMessages.getString("CBreakpointPropertyPage.3"); //$NON-NLS-1$
+ if (breakpoint instanceof ICAddressBreakpoint)
+ return PropertyPageMessages.getString("CBreakpointPropertyPage.4"); //$NON-NLS-1$
+ if (breakpoint instanceof ICLineBreakpoint)
+ return PropertyPageMessages.getString("CBreakpointPropertyPage.8"); //$NON-NLS-1$
+ if (breakpoint instanceof ICEventBreakpoint)
+ return PropertyPageMessages.getString("CBreakpointPropertyPage.21"); //$NON-NLS-1$
+ if (breakpoint instanceof ICWatchpoint) {
+ ICWatchpoint watchpoint = (ICWatchpoint) breakpoint;
+ String type = ""; //$NON-NLS-1$
+ try {
+ if (watchpoint.isReadType() && !watchpoint.isWriteType())
+ type = PropertyPageMessages.getString("CBreakpointPropertyPage.11"); //$NON-NLS-1$
+ else if (!watchpoint.isReadType() && watchpoint.isWriteType())
+ type = PropertyPageMessages.getString("CBreakpointPropertyPage.12"); //$NON-NLS-1$
+ else
+ type = PropertyPageMessages.getString("CBreakpointPropertyPage.13"); //$NON-NLS-1$
+
+ } catch (CoreException ce) {
+ CDebugUIPlugin.log(ce);
+ }
+ return type;
+ }
+ // default main label is the label of marker type for the breakpoint
+ String type = ""; //$NON-NLS-1$
+ try {
+ type = breakpoint.getMarker().getType(); // TODO: how to get label?
+ } catch (CoreException ce) {
+ CDebugUIPlugin.log(ce);
+ }
+ return type;
+ }
+ protected void createLineNumberEditor( Composite parent ) {
+ String title = PropertyPageMessages.getString( "CBreakpointPropertyPage.9" ); //$NON-NLS-1$
+ BreakpointIntegerFieldEditor labelFieldEditor =new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.LINE ,title, parent);
+ labelFieldEditor.setValidRange( 1, Integer.MAX_VALUE );
+ addField( labelFieldEditor );
+ }
+
+
+ protected void createEnabledField( Composite parent ) {
+ fEnabled = new BooleanFieldEditor( CBreakpointPreferenceStore.ENABLED, PropertyPageMessages.getString( "CBreakpointPropertyPage.19" ), parent ); //$NON-NLS-1$
+ addField( fEnabled );
+ }
+
+ protected void createConditionEditor( Composite parent ) {
+ fCondition = new BreakpointStringFieldEditor( CBreakpointPreferenceStore.CONDITION, PropertyPageMessages.getString( "CBreakpointPropertyPage.15" ), parent ); //$NON-NLS-1$
+ fCondition.setEmptyStringAllowed( true );
+ fCondition.setErrorMessage( PropertyPageMessages.getString( "CBreakpointPropertyPage.16" ) ); //$NON-NLS-1$
+ addField( fCondition );
+ }
+
+ protected void createIgnoreCountEditor( Composite parent ) {
+ fIgnoreCount = new BreakpointIntegerFieldEditor( CBreakpointPreferenceStore.IGNORE_COUNT, PropertyPageMessages.getString( "CBreakpointPropertyPage.17" ), parent ); //$NON-NLS-1$
+ fIgnoreCount.setValidRange( 0, Integer.MAX_VALUE );
+ fIgnoreCountTextControl = fIgnoreCount.getTextControl( parent );
+ try {
+ fIgnoreCountTextControl.setEnabled( getBreakpoint().getIgnoreCount() >= 0 );
+ }
+ catch( CoreException ce ) {
+ CDebugUIPlugin.log( ce );
+ }
+ addField( fIgnoreCount );
+ }
+
+ protected FieldEditor createLabelEditor( Composite parent, String title, String value ) {
+ return new LabelFieldEditor( parent, title, value );
+ }
+
+ protected ICBreakpoint getBreakpoint() {
+ IAdaptable element = getElement();
+ return ( element instanceof ICBreakpoint ) ? (ICBreakpoint)element : (ICBreakpoint)element.getAdapter(ICBreakpoint.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
+ */
+ @Override
+ public IAdaptable getElement() {
+ return fElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public void setElement( IAdaptable element ) {
+ fElement = element;
+ }
+
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ return fCBreakpointPreferenceStore;
+ }
+
+ @Override
+ public boolean performOk() {
+ final List changedProperties = new ArrayList( 5 );
+ getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() {
+
+ /**
+ * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange( PropertyChangeEvent event ) {
+ changedProperties.add( event.getProperty() );
+ }
+ } );
+ boolean result = super.performOk();
+ setBreakpointProperties( changedProperties );
+ return result;
+ }
+
+ protected void setBreakpointProperties( final List changedProperties ) {
+ IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+
+ @Override
+ public void run( IProgressMonitor monitor ) throws CoreException {
+ ICBreakpoint breakpoint = getBreakpoint();
+ Iterator changed = changedProperties.iterator();
+ while( changed.hasNext() ) {
+ String property = (String)changed.next();
+ if ( property.equals( CBreakpointPreferenceStore.ENABLED ) ) {
+ breakpoint.setEnabled( getPreferenceStore().getBoolean( CBreakpointPreferenceStore.ENABLED ) );
+ }
+ else if ( property.equals( CBreakpointPreferenceStore.IGNORE_COUNT ) ) {
+ breakpoint.setIgnoreCount( getPreferenceStore().getInt( CBreakpointPreferenceStore.IGNORE_COUNT ) );
+ }
+ else if ( property.equals( CBreakpointPreferenceStore.CONDITION ) ) {
+ breakpoint.setCondition( getPreferenceStore().getString( CBreakpointPreferenceStore.CONDITION ) );
+ }
+ else if ( property.equals( CBreakpointPreferenceStore.LINE ) ) {
+ // already workspace runnable, setting markers are safe
+ breakpoint.getMarker().setAttribute(IMarker.LINE_NUMBER, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
+ breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getPreferenceStore().getInt(CBreakpointPreferenceStore.LINE));
+ } else {
+ // this allow set attributes contributed by other plugins
+ String value = getPropertyAsString(property);
+ breakpoint.getMarker().setAttribute(property, value);
+ }
+ }
+ }
+ };
+ try {
+ ResourcesPlugin.getWorkspace().run( wr, null );
+ }
+ catch( CoreException ce ) {
+ CDebugUIPlugin.log( ce );
+ }
+ }
+
+ /**
+ * Creates field editors contributed using breakpointUIContribution extension point
+ * @param breakpoint
+ */
+ private void createContributetedFieldEditors(ICBreakpoint breakpoint) {
+ Composite parent = getFieldEditorParent();
+ try {
+ ICBreakpointsUIContribution cons[] = CBreakpointUIContributionFactory.getInstance()
+ .getBreakpointUIContributions(breakpoint);
+ for (ICBreakpointsUIContribution con : cons) {
+
+ FieldEditor fieldEditor = con.getFieldEditor(con.getId(), con.getLabel()+":", parent); //$NON-NLS-1$
+ if (fieldEditor != null)
+ addField(fieldEditor);
+ Object o = breakpoint.getMarker().getAttribute(con.getId());
+ String value = o==null?"":o.toString(); //$NON-NLS-1$
+ getPreferenceStore().setValue(con.getId(), value);
+ }
+ } catch (CoreException ce) {
+ CDebugUIPlugin.log(ce);
+ }
+
+ }
+
+ /**
+ * Return string value of given property or null.
+ */
+ protected String getPropertyAsString(String property) {
+ // currently only supports String and Integer
+ IPreferenceStore store = getPreferenceStore();
+
+ if (store.contains(property)) {
+ String value = store.getString(property);
+ return value;
+ } else return null;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties
index 4861ba4ac0d..309d5581f45 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/PropertyPageMessages.properties
@@ -11,6 +11,29 @@
# IBM Corporation
###############################################################################
+CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
+CBreakpointPropertyPage.1=Not available
+CBreakpointPropertyPage.2=Function name:
+CBreakpointPropertyPage.3=C/C++ function breakpoint
+CBreakpointPropertyPage.4=Not available
+CBreakpointPropertyPage.5=Address:
+CBreakpointPropertyPage.6=C/C++ address breakpoint
+CBreakpointPropertyPage.7=File:
+CBreakpointPropertyPage.8=C/C++ line breakpoint
+CBreakpointPropertyPage.9=Line number:
+CBreakpointPropertyPage.10=Project:
+CBreakpointPropertyPage.11=C/C++ read watchpoint
+CBreakpointPropertyPage.12=C/C++ watchpoint
+CBreakpointPropertyPage.13=C/C++ access watchpoint
+CBreakpointPropertyPage.14=Expression to watch:
+CBreakpointPropertyPage.15=&Condition:
+CBreakpointPropertyPage.16=Invalid condition.
+CBreakpointPropertyPage.17=&Ignore count:
+CBreakpointPropertyPage.18=Class:
+CBreakpointPropertyPage.19=Enabled
+CBreakpointPropertyPage.20=File:
+CBreakpointPropertyPage.21=C/C++ Event Breakpoint
+ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
SignalPropertyPage.0=Description: {0}.
SignalPropertyPage.1=Pass this signal to the program.
SignalPropertyPage.2=Suspend the program when this signal happens.
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java
index cb341c364b8..b02390ca10f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/ThreadFilterEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/propertypages/ThreadFilterEditor.java
@@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.debug.internal.ui.breakpoints;
+package org.eclipse.cdt.debug.internal.ui.propertypages;
import java.util.ArrayList;
import java.util.List;
@@ -149,7 +149,7 @@ public class ThreadFilterEditor {
}
}
if ( parent instanceof ILaunchManager ) {
- List<Object> children = new ArrayList<Object>();
+ List children = new ArrayList();
ILaunch[] launches = ((ILaunchManager)parent).getLaunches();
IDebugTarget[] targets;
ICDebugTarget target;
@@ -251,7 +251,7 @@ public class ThreadFilterEditor {
private void createThreadViewer( Composite parent ) {
Label label = new Label( parent, SWT.NONE );
- label.setText( BreakpointsMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$
+ label.setText( PropertyPageMessages.getString( "ThreadFilterEditor.0" ) ); //$NON-NLS-1$
label.setFont( parent.getFont() );
label.setLayoutData( new GridData() );
GridData data = new GridData( GridData.FILL_BOTH );
@@ -338,11 +338,11 @@ public class ThreadFilterEditor {
private ICThread[] getTargetThreadFilters( ICDebugTarget target ) {
Object[] threads = ((ITreeContentProvider)getThreadViewer().getContentProvider()).getChildren( target );
- ArrayList<ICThread> list = new ArrayList<ICThread>( threads.length );
+ ArrayList list = new ArrayList( threads.length );
for ( int i = 0; i < threads.length; ++i ) {
if ( getThreadViewer().getChecked( threads[i] ) )
- list.add( (ICThread)threads[i] );
+ list.add( threads[i] );
}
- return list.toArray( new ICThread[list.size()] );
+ return (ICThread[])list.toArray( new ICThread[list.size()] );
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
index 559574ece95..bf211af2577 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
@@ -17,6 +17,7 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
+import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebuggerPageAdapter;
@@ -24,7 +25,6 @@ import org.eclipse.cdt.debug.internal.ui.CRegisterManagerProxies;
import org.eclipse.cdt.debug.internal.ui.ColorManager;
import org.eclipse.cdt.debug.internal.ui.EvaluationContextManager;
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointUpdater;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyBackendCdiFactory;
import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditorManager;
import org.eclipse.cdt.debug.internal.ui.pinclone.ViewIDCounterManager;
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java
deleted file mode 100644
index 22dd8d73e79..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java
+++ /dev/null
@@ -1,752 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Mentor Graphics 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:
- * Mentor Graphics - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.cdt.debug.ui.breakpoints;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.IDeclaration;
-import org.eclipse.cdt.core.model.IFunction;
-import org.eclipse.cdt.core.model.IFunctionDeclaration;
-import org.eclipse.cdt.core.model.IMethod;
-import org.eclipse.cdt.core.model.ISourceRange;
-import org.eclipse.cdt.core.model.ITranslationUnit;
-import org.eclipse.cdt.core.model.IVariable;
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
-import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
-import org.eclipse.cdt.debug.internal.ui.actions.ActionMessages;
-import org.eclipse.cdt.debug.internal.ui.actions.breakpoints.EnableDisableBreakpointRulerAction;
-import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
-import org.eclipse.cdt.ui.CDTUITools;
-import org.eclipse.core.filesystem.URIUtil;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension2;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.editors.text.ILocationProvider;
-import org.eclipse.ui.texteditor.IEditorStatusLine;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
-
-/**
- * Base class for toggle adapter to create/remove CDT breakpoints. Clients may
- * extend this class to gather additional data prior to creating the breakpoints.
- *
- * @since 7.2
- */
-abstract public class AbstractToggleBreakpointAdapter
- implements IToggleBreakpointsTargetExtension2, IToggleBreakpointsTargetCExtension
-{
-
-
- @Override
- public boolean canToggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) {
- return canToggleBreakpoints(part, selection);
- }
-
- @Override
- public void toggleBreakpointsWithEvent(IWorkbenchPart part, ISelection selection, Event event) throws CoreException {
- if(event != null && (event.stateMask & SWT.MOD2) > 0) {
- if (toggleBreakpointEnable(part)) {
- return;
- }
- }
- else {
- boolean interactive = event != null && (event.stateMask & SWT.MOD1) > 0;
- updateBreakpoints(true, interactive, part, selection);
- }
- }
-
- @Override
- public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- updateLineBreakpoints(true, false, part, selection);
- }
-
- @Override
- public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) {
- return (selection instanceof ITextSelection);
- }
-
- @Override
- public void toggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IFunction || element instanceof IMethod) {
- updateMethodBreakpoints(true, false, part, (IDeclaration)element);
- }
- }
-
- @Override
- public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
- ICElement element = getCElementFromSelection( part, selection );
- return (element instanceof IFunction || element instanceof IMethod);
- }
-
- @Override
- public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- IVariable variable = getVariableFromSelection( part, selection );
- if ( variable != null ) {
- updateVariableWatchpoint(true, false, part, variable);
- }
- }
-
- @Override
- public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
- return getVariableFromSelection( part, selection ) != null;
- }
-
- @Override
- public boolean canToggleBreakpoints( IWorkbenchPart part, ISelection selection ) {
- return ( canToggleLineBreakpoints( part, selection )
- || canToggleWatchpoints( part, selection )
- || canToggleMethodBreakpoints( part, selection ) );
- }
-
- @Override
- public void toggleBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
- updateBreakpoints(true, false, part, selection);
- }
-
- @Override
- public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) {
- return canToggleLineBreakpoints( part, selection );
- }
-
- @Override
- public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
- updateLineBreakpoints(false, true, part, selection);
- }
-
- @Override
- public boolean canCreateWatchpointsInteractive(IWorkbenchPart part, ISelection selection) {
- // Gather all input from user if needed.
- return true;
- }
-
- @Override
- public void createWatchpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
- ICElement element = getCElementFromSelection( part, selection );
- if (element instanceof IVariable) {
- updateVariableWatchpoint(false, true, part, (IVariable)element);
- } else {
- String text = ""; //$NON-NLS-1$
- if (selection instanceof ITextSelection) {
- text = ((ITextSelection)selection).getText();
- }
- createWatchpoint(true, part, null, ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, text);
- }
- }
-
- @Override
- public boolean canCreateFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection) {
- return true;
- }
-
- @Override
- public void createFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IFunction || element instanceof IMethod ) {
- updateMethodBreakpoints(false, true, part, (IDeclaration)element);
- } else {
- String text = ""; //$NON-NLS-1$
- if (selection instanceof ITextSelection) {
- text = ((ITextSelection)selection).getText();
- }
- createFunctionBreakpoint(true, part, null, ResourcesPlugin.getWorkspace().getRoot(), text, -1, -1, -1);
- }
- }
-
- /**
- * Updates the breakpoint for given part and selection.
- * Depending on the flags and on whether a breakpoint exists, this method
- * executes the toggle action.
- *
- * @param toggle Whether the toggle action is requested. If
- * true and the breakpoint currently exists, it will cause the
- * toggle action to either remove breakpoint or edit its properties.
- * Otherwise a new breakpoint will be created.
- * @param interactive If true the toggle adapter should open a dialog before
- * creating a breakpoint, or open a properties dialog on an existing
- * breakpoint.
- * @param part Workbench part where the toggle action is to be executed.
- * @param selection Current selection on which the toggle action is to be
- * executed.
- * @throws CoreException Any error in creating or editing the breakpoint.
- */
- private void updateBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part, ISelection selection ) throws CoreException {
- if ( canToggleLineBreakpoints( part, selection ) ) {
- updateLineBreakpoints(toggle, interactive, part, selection);
- }
- else {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IFunction || element instanceof IMethod ) {
- updateMethodBreakpoints(toggle, interactive, part, (IDeclaration)element);
- }
- else if ( element instanceof IVariable ) {
- updateVariableWatchpoint(toggle, interactive, part, (IVariable)element);
- }
- }
- }
-
- private void updateLineBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part, ISelection selection)
- throws CoreException {
- String errorMessage = null;
- if (part instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) part;
- IEditorInput input = textEditor.getEditorInput();
- if (input == null) {
- errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Empty_editor_1"); //$NON-NLS-1$
- } else {
- IDocument document = textEditor.getDocumentProvider().getDocument(input);
- if (document == null) {
- errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Missing_document_1"); //$NON-NLS-1$
- } else {
- IResource resource = getResource(textEditor);
- if (resource == null) {
- errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Missing_resource_1"); //$NON-NLS-1$
- } else {
- int lineNumber = ((ITextSelection) selection).getStartLine() + 1;
- if (lineNumber == -1) {
- errorMessage = ActionMessages.getString("ToggleBreakpointAdapter.Invalid_line_1"); //$NON-NLS-1$
- } else {
- String sourceHandle = getSourceHandle(input);
- if (interactive && !toggle) {
- createLineBreakpoint(true, part, sourceHandle, resource, lineNumber);
- } else {
- ICLineBreakpoint breakpoint = findLineBreakpoint(sourceHandle, resource, lineNumber);
- if (breakpoint != null) {
- if (interactive) {
- CDebugUIUtils.editBreakpointProperties(part, breakpoint);
- } else {
- DebugPlugin.getDefault().getBreakpointManager()
- .removeBreakpoint(breakpoint, true);
- }
- } else {
- createLineBreakpoint(interactive, part, sourceHandle, resource, lineNumber);
- }
- }
- return;
- }
- }
- }
- }
- } else {
- errorMessage = ActionMessages.getString("RunToLineAdapter.Operation_is_not_supported_1"); //$NON-NLS-1$
- }
- throw new CoreException(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(),
- IInternalCDebugUIConstants.INTERNAL_ERROR, errorMessage, null));
- }
-
- private void updateMethodBreakpoints(boolean toggle, boolean interactive, IWorkbenchPart part,
- IDeclaration declaration) throws CoreException {
- String sourceHandle = getSourceHandle(declaration);
- IResource resource = getElementResource(declaration);
- String functionName = (declaration instanceof IFunction) ? getFunctionName((IFunction) declaration)
- : getMethodName((IMethod) declaration);
- ICFunctionBreakpoint breakpoint = findFunctionBreakpoint(sourceHandle, resource, functionName);
- if (toggle && breakpoint != null) {
- if (interactive) {
- CDebugUIUtils.editBreakpointProperties(part, breakpoint);
- } else {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(breakpoint, true);
- }
- } else {
- int lineNumber = -1;
- int charStart = -1;
- int charEnd = -1;
- try {
- ISourceRange sourceRange = declaration.getSourceRange();
- if (sourceRange != null) {
- charStart = sourceRange.getStartPos();
- charEnd = charStart + sourceRange.getLength();
- if (charEnd <= 0) {
- charStart = -1;
- charEnd = -1;
- }
- lineNumber = sourceRange.getStartLine();
- }
- } catch (CModelException e) {
- DebugPlugin.log(e);
- }
- createFunctionBreakpoint(interactive, part, sourceHandle, resource, functionName, charStart, charEnd,
- lineNumber);
- }
- }
-
- /**
- * Updates a watchpoint. Depending on the flags and on whether a breakpoint
- * exists, this method executes the toggle action.
- *
- * @param toggle
- * Whether the toggle action is requested. If true and the
- * breakpoint currently exists, it will cause the toggle action
- * to either remove breakpoint or edit its properties. Otherwise
- * a new breakpoint will be created.
- * @param interactive
- * If true the toggle adapter should open a dialog before
- * creating a breakpoint, or open a properties dialog on an
- * existing breakpoint.
- * @param part
- * Workbench part where the toggle action is to be executed.
- * @param selection
- * Variable on which to execute the toggle action.
- * @throws CoreException
- * Any error in creating or editing the breakpoint.
- */
- private void updateVariableWatchpoint(boolean toggle, boolean interactive, IWorkbenchPart part, IVariable variable)
- throws CoreException {
- String sourceHandle = getSourceHandle(variable);
- IResource resource = getElementResource(variable);
- String expression = getVariableName(variable);
- ICWatchpoint watchpoint = findWatchpoint(sourceHandle, resource, expression);
- if (toggle && watchpoint != null) {
- if (interactive) {
- CDebugUIUtils.editBreakpointProperties(part, watchpoint);
- } else {
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(watchpoint, true);
- }
- } else {
- int lineNumber = -1;
- int charStart = -1;
- int charEnd = -1;
- try {
- ISourceRange sourceRange = variable.getSourceRange();
- if (sourceRange != null) {
- charStart = sourceRange.getStartPos();
- charEnd = charStart + sourceRange.getLength();
- if (charEnd <= 0) {
- charStart = -1;
- charEnd = -1;
- }
- lineNumber = sourceRange.getStartLine();
- }
- } catch (CModelException e) {
- CDebugUIPlugin.log(e);
- }
- createWatchpoint(interactive, part, sourceHandle, resource, charStart, charEnd, lineNumber, expression);
- }
- }
-
- /**
- * Returns the C model element at the given selection.
- * @param part Workbench part where the selection is.
- * @param selection Selection in part.
- * @return C model element if found.
- */
- protected ICElement getCElementFromSelection( IWorkbenchPart part, ISelection selection ) {
- if ( selection instanceof ITextSelection ) {
- ITextSelection textSelection = (ITextSelection)selection;
- String text = textSelection.getText();
- if ( text != null ) {
- if ( part instanceof ITextEditor ) {
- ICElement editorElement = CDTUITools.getEditorInputCElement( ((ITextEditor)part).getEditorInput() );
- if ( editorElement instanceof ITranslationUnit ) {
- ITranslationUnit tu = (ITranslationUnit)editorElement;
- try {
- if ( tu.isStructureKnown() && tu.isConsistent() ) {
- return tu.getElementAtOffset( textSelection.getOffset() );
- }
- }
- catch( CModelException exc ) {
- // ignored on purpose
- }
- }
- }
- else {
- IResource resource = getResource( part );
- if ( resource instanceof IFile ) {
- ITranslationUnit tu = getTranslationUnit( (IFile)resource );
- if ( tu != null ) {
- try {
- ICElement element = tu.getElement( text.trim() );
- if ( element == null ) {
- element = tu.getElementAtLine( textSelection.getStartLine() );
- }
- return element;
- }
- catch( CModelException e ) {
- }
- }
- }
- }
- }
- }
- else if ( selection instanceof IStructuredSelection ) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if ( ss.size() == 1 ) {
- Object object = ss.getFirstElement();
- if ( object instanceof ICElement ) {
- return (ICElement)object;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the variable object at the given selection.
- * Returns the C model element at the given selection.
- * @param part Workbench part where the selection is.
- * @param selection Selection in part.
- * @return C model variable, if found.
- */
- protected IVariable getVariableFromSelection( IWorkbenchPart part, ISelection selection ) {
- ICElement element = getCElementFromSelection( part, selection );
- if ( element instanceof IVariable ) {
- return (IVariable)element;
- }
- return null;
- }
-
- /**
- * Reports the given error message to the user.
- * @param message Message to report.
- * @param part Workbench part where action was invoked.
- */
- protected void report( String message, IWorkbenchPart part ) {
- IEditorStatusLine statusLine = (IEditorStatusLine)part.getAdapter( IEditorStatusLine.class );
- if ( statusLine != null ) {
- if ( message != null ) {
- statusLine.setMessage( true, message, null );
- }
- else {
- statusLine.setMessage( true, null, null );
- }
- }
- if ( message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null ) {
- CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
- }
- }
-
- /**
- * Returns the resource being edited in the given workbench part.
- * @param part Workbench part to checm.
- * @return Resource being edited.
- */
- protected static IResource getResource( IWorkbenchPart part ) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if ( part instanceof IEditorPart ) {
- IEditorInput editorInput = ((IEditorPart)part).getEditorInput();
- IResource resource = null;
- if ( editorInput instanceof IFileEditorInput ) {
- resource = ((IFileEditorInput)editorInput).getFile();
- }
- else if ( editorInput instanceof ExternalEditorInput ) {
- resource = ((ExternalEditorInput)editorInput).getMarkerResource();
- }
- if ( resource != null )
- return resource;
- /* This file is not in a project, let default case handle it */
- ILocationProvider provider = (ILocationProvider)editorInput.getAdapter( ILocationProvider.class );
- if ( provider != null ) {
- IPath location = provider.getPath( editorInput );
- if ( location != null ) {
- IFile[] files = root.findFilesForLocationURI( URIUtil.toURI( location ) );
- if ( files.length > 0 && files[0].isAccessible())
- return files[0];
- }
- }
- }
- return root;
- }
-
- private String getSourceHandle( IEditorInput input ) throws CoreException {
- return CDebugUIUtils.getEditorFilePath( input );
- }
-
- protected String getSourceHandle( IDeclaration declaration ) {
- ITranslationUnit tu = declaration.getTranslationUnit();
- if ( tu != null ) {
- IPath location = tu.getLocation();
- if ( location != null ) {
- return location.toOSString();
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- protected IResource getElementResource( IDeclaration declaration ) {
- return declaration.getUnderlyingResource();
- }
-
- private String getFunctionName( IFunction function ) {
- String functionName = function.getElementName();
- StringBuffer name = new StringBuffer( functionName );
- ITranslationUnit tu = function.getTranslationUnit();
- if ( tu != null && tu.isCXXLanguage() ) {
- appendParameters( name, function );
- }
- return name.toString();
- }
-
- private String getMethodName( IMethod method ) {
- StringBuffer name = new StringBuffer();
- String methodName = method.getElementName();
- ICElement parent = method.getParent();
- while( parent != null
- && (parent.getElementType() == ICElement.C_NAMESPACE || parent.getElementType() == ICElement.C_CLASS
- || parent.getElementType() == ICElement.C_STRUCT || parent.getElementType() == ICElement.C_UNION) ) {
- name.append( parent.getElementName() ).append( "::" ); //$NON-NLS-1$
- parent = parent.getParent();
- }
- name.append( methodName );
- appendParameters( name, method );
- return name.toString();
- }
-
- private void appendParameters( StringBuffer sb, IFunctionDeclaration fd ) {
- String[] params = fd.getParameterTypes();
- sb.append( '(' );
- for( int i = 0; i < params.length; ++i ) {
- sb.append( params[i] );
- if ( i != params.length - 1 )
- sb.append( ',' );
- }
- sb.append( ')' );
- }
-
- private String getVariableName( IVariable variable ) {
- return variable.getElementName();
- }
-
- private ITranslationUnit getTranslationUnit( IFile file ) {
- Object element = CoreModel.getDefault().create( file );
- if ( element instanceof ITranslationUnit ) {
- return (ITranslationUnit)element;
- }
- return null;
- }
-
- private boolean toggleBreakpointEnable(IWorkbenchPart part) {
- ITextEditor textEditor = getTextEditor(part);
- if(textEditor != null) {
- IVerticalRulerInfo info = (IVerticalRulerInfo) textEditor.getAdapter(IVerticalRulerInfo.class);
- if(info != null) {
- EnableDisableBreakpointRulerAction enableAction = new EnableDisableBreakpointRulerAction(part, info);
- enableAction.update();
- enableAction.run();
- }
- }
- return false;
- }
-
- /**
- * Returns the text editor associated with the given part or <code>null</code>
- * if none. In case of a multi-page editor, this method should be used to retrieve
- * the correct editor to perform the breakpoint operation on.
- *
- * @param part workbench part
- * @return text editor part or <code>null</code>
- */
- protected ITextEditor getTextEditor(IWorkbenchPart part) {
- if (part instanceof ITextEditor) {
- return (ITextEditor) part;
- }
- return (ITextEditor) part.getAdapter(ITextEditor.class);
- }
-
- /**
- * Resolves the {@link IBreakpoint} from the given editor and ruler information. Returns <code>null</code>
- * if no breakpoint exists or the operation fails.
- *
- * @param editor the editor
- * @param info the current ruler information
- * @return the {@link IBreakpoint} from the current editor position or <code>null</code>
- */
- protected IBreakpoint getBreakpointFromEditor(ITextEditor editor, IVerticalRulerInfo info) {
- IAnnotationModel annotationModel = editor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
- IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- if (annotationModel != null) {
- @SuppressWarnings("unchecked")
- Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof SimpleMarkerAnnotation) {
- SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
- IMarker marker = markerAnnotation.getMarker();
- try {
- if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
- Position position = annotationModel.getPosition(markerAnnotation);
- int line = document.getLineOfOffset(position.getOffset());
- if (line == info.getLineOfLastMouseButtonActivity()) {
- IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
- if (breakpoint != null) {
- return breakpoint;
- }
- }
- }
- } catch (CoreException e) {
- } catch (BadLocationException e) {
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Opens the properties dialog for the given breakpoint. This method can be
- * used on an existing breakpoint or on a blank breakpoint which doesn't
- * have an associated marker yet.
- *
- * @param bp
- * The breakpoint to edit. This breakpoint may not have an
- * associated marker yet.
- * @param part
- * Workbench part where the action was invoked.
- * @param resource
- * Workbench resource to create the breakpoint on.
- * @param attributes
- * Breakpoint attributes to show in properties dialog. If the
- * breakpoint already exists, this attribute map can be used to
- * override the attributes currently in the breakpoint. Can be
- * <code>null</code>.
- */
- protected void openBreakpointPropertiesDialog(ICBreakpoint bp, IWorkbenchPart part, IResource resource,
- Map<String, Object> attributes) {
- ISelection debugContext = DebugUITools.getDebugContextManager()
- .getContextService(part.getSite().getWorkbenchWindow()).getActiveContext(part.getSite().getId());
- CBreakpointContext bpContext = new CBreakpointContext(bp, debugContext, resource, attributes);
-
- PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(part.getSite().getShell(), bpContext, null,
- null, null);
- if (dialog != null) {
- dialog.open();
- }
- }
-
- /**
- * Finds the line breakpoint at the given location.
- *
- * @param sourceHandle
- * Source handle for the line breakpoint.
- * @param resource
- * Resource of the line breakpoint.
- * @param lineNumber
- * Line number.
- * @return Line breakpoint with given parameters, if found.
- * @throws CoreException
- * Exception thrown while reading breakpoints' properties.
- */
- protected abstract ICLineBreakpoint findLineBreakpoint(String sourceHandle, IResource resource, int lineNumber)
- throws CoreException;
-
- /**
- * Creates a line breakpoint at the given location.
- * @param interactive true if action should open a dialog to let user edit
- * breakpoint properties prior to creation.
- * @param part Workbench part where action was invoked.
- * @param source Handle Source handle for the new breakpoint.
- * @param resource Resource to create breakpoint on.
- * @param lineNumber Line number for new breakpoint.
- * @throws CoreException Exception while creating breakpoint.
- */
- protected abstract void createLineBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, int lineNumber) throws CoreException;
-
- /**
- * Finds the function breakpoint at the given location.
- *
- * @param sourceHandle
- * Source handle for the line breakpoint.
- * @param resource
- * Resource of the line breakpoint.
- * @param functionName
- * Function for the breakpoint.
- * @return Function breakpoint with given parameters, if found.
- * @throws CoreException
- * Exception thrown while reading breakpoints' properties.
- */
- protected abstract ICFunctionBreakpoint findFunctionBreakpoint(String sourceHandle, IResource resource,
- String functionName) throws CoreException;
-
- /**
- * Creates a function breakpoint at the given location.
- * @param interactive true if action should open a dialog to let user edit
- * breakpoint properties prior to creation.
- * @param part Workbench part where action was invoked.
- * @param source Handle Source handle for the new breakpoint.
- * @param resource Resource to create breakpoint on.
- * @param charStart Beginning of range where function is located. Can be
- * -1 if not known.
- * @param charStart End of range where function is located. Can be
- * -1 if not known.
- * @param lineNumber Line number where the function is located.
- * @throws CoreException Exception while creating breakpoint.
- */
- protected abstract void createFunctionBreakpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, String functionName, int charStart, int charEnd, int lineNumber) throws CoreException;
-
- /**
- * Finds the watchpoint with given expression.
- *
- * @param sourceHandle Source handle for the line breakpoint.
- * @param resource Resource of the line breakpoint.
- * @param expression Expression of the breakpoint.
- * @return Watchpoing with given parameters, if found.
- * @throws CoreException Exception thrown while reading breakpoints'
- */
- protected abstract ICWatchpoint findWatchpoint( String sourceHandle, IResource resource, String expression )
- throws CoreException;
-
- /**
- * Creates a watchpoint at the given location.
- * @param interactive true if action should open a dialog to let user edit
- * breakpoint properties prior to creation.
- * @param part Workbench part where action was invoked.
- * @param source Handle Source handle for the new breakpoint.
- * @param resource Resource to create breakpoint on.
- * @param charStart Beginning of range where variable is located. Can be
- * -1 if not known.
- * @param charStart End of range where variable is located. Can be
- * -1 if not known.
- * @param lineNumber Line number where the variable is located.
- * @throws CoreException Exception while creating breakpoint.
- */
- protected abstract void createWatchpoint(boolean interactive, IWorkbenchPart part, String sourceHandle,
- IResource resource, int charStart, int charEnd, int lineNumber, String expression) throws CoreException;
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java
deleted file mode 100644
index 16883079cf1..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointPropertyDialogAction.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * 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 java.util.Iterator;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.ui.contexts.IDebugContextProvider;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Action for opening a Property Pages Dialog on the C breakpoint object
- * in the currently selected element.
- * <p>
- * Generally speaking, this action is useful in pop-up menus because it allows
- * the user to browse and change properties of selected elements. When
- * performed, the action will bring up a Property Pages Dialog containing
- * property pages registered with the workbench for elements of the selected
- * type.
- * </p>
- * <p>
- * Although the action is capable of calculating if there are any applicable
- * pages for the current selection, this calculation is costly because it
- * require searching the workbench registry. Where performance is critical, the
- * action can simply be added to the pop-up menu. In the event of no applicable
- * pages, the action will just open an appropriate message dialog.
- * </p>
- * @noextend This class is not intended to be subclassed by clients.
- * @since 7.2
- */
-public class CBreakpointPropertyDialogAction extends SelectionProviderAction {
-
- /**
- * Provides the shell in which to open the property dialog.
- */
- private IShellProvider fShellProvider;
-
- private IDebugContextProvider fDebugContextProvider;
-
- /**
- * The id of the page to open up on.
- */
- private String fInitialPageId = "org.eclipse.cdt.debug.ui.propertypages.breakpoint.common"; //$NON-NLS-1$
-
- public CBreakpointPropertyDialogAction(IShellProvider shell, ISelectionProvider selectionProvider, IDebugContextProvider debugContextProvider) {
- super(selectionProvider, WorkbenchMessages.PropertyDialog_text);
- Assert.isNotNull(shell);
- fDebugContextProvider = debugContextProvider;
- fShellProvider = shell;
- setToolTipText(WorkbenchMessages.PropertyDialog_toolTip);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
- IWorkbenchHelpContextIds.PROPERTY_DIALOG_ACTION);
- }
-
- protected ISelection getDebugContext() {
- return fDebugContextProvider.getActiveContext();
- }
-
- /**
- * Returns whether this action is actually applicable to the current
- * selection. If this action is disabled, it will return <code>false</code>
- * without further calculation. If it is enabled, it will check with the
- * workbench's property page manager to see if there are any property pages
- * registered for the selected element's type.
- * <p>
- * This method is generally too expensive to use when updating the enabled
- * state of the action on each selection change.
- * </p>
- *
- * @return <code>true</code> if the selection is not empty and there are
- * property pages for the selected element, and <code>false</code>
- * otherwise
- */
- public boolean isCBreakpointSelection() {
- if (!isEnabled()) {
- return false;
- }
- return isApplicableForSelection(getStructuredSelection(), getDebugContext());
- }
-
- /**
- * Returns whether this action is applicable to the current selection. This
- * checks that the selection is not empty, and checks with the workbench's
- * property page manager to see if there are any property pages registered
- * for the selected element's type.
- * <p>
- * This method is generally too expensive to use when updating the enabled
- * state of the action on each selection change.
- * </p>
- *
- * @param selection
- * The selection to test
- * @return <code>true</code> if the selection is of not empty and there are
- * property pages for the selected element, and <code>false</code>
- * otherwise
- */
- public boolean isApplicableForSelection(IStructuredSelection selection, ISelection debugContext) {
- return isCBreakpointSelection(selection);
- }
-
- /**
- * Returns whether the given selection contains only elements of type ICBreakpoint
- * @param selection
- * @return
- */
- private boolean isCBreakpointSelection(IStructuredSelection selection) {
- if (selection.isEmpty()) return false;
-
- for (Iterator<?> itr = selection.iterator(); itr.hasNext();) {
- if ( !(itr.next() instanceof ICBreakpoint) ) {
- return false;
- }
- }
- return true;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- CBreakpointContext bpContext = getCBreakpointContext();
- if (bpContext != null) {
- PreferenceDialog dialog = createDialog(bpContext);
-
- if (dialog != null) {
- dialog.open();
- }
- }
- }
-
- private CBreakpointContext getCBreakpointContext() {
- IStructuredSelection ss = getStructuredSelection();
- if (ss.size() >= 1 && ss.getFirstElement() instanceof ICBreakpoint) {
- return new CBreakpointContext((ICBreakpoint)ss.getFirstElement(), fDebugContextProvider.getActiveContext());
- }
- return null;
- }
-
- /**
- * Create the dialog for the receiver. If no pages are found, an informative
- * message dialog is presented instead.
- *
- * @return PreferenceDialog or <code>null</code> if no applicable pages
- * are found.
- */
- protected PreferenceDialog createDialog(CBreakpointContext bpContext) {
- IStructuredSelection ss = getStructuredSelection();
- if (ss.isEmpty())
- return null;
-
- return PreferencesUtil.createPropertyDialogOn(fShellProvider.getShell(), bpContext, fInitialPageId, null, null);
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(!selection.isEmpty());
- }
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
index 9631e55c387..fb5ad942b0a 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 QNX Software Systems and others.
+ * Copyright (c) 2008 QNX Software 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
@@ -13,10 +13,8 @@
package org.eclipse.cdt.debug.ui.breakpoints;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Map;
-import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.internal.resources.Workspace;
import org.eclipse.core.resources.IMarker;
@@ -42,60 +40,23 @@ public class CBreakpointUIContributionFactory {
}
/**
- * Calculates the breakpoint contributions for the given breakpoint.
*
- * @param breakpoint Breakpoint to find UI contributions for.
+ * @param breakpoint
* @return non-null array of ICBreakpointsUIContribution
- * @throws CoreException if cannot get marker attributes from bearkpoint
+ * @throws CoreException
+ * @throws CoreException if cannot get marker attributes from berakpoint
*/
+
public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint) throws CoreException {
String debugModelId = breakpoint.getModelIdentifier();
IMarker bmarker = breakpoint.getMarker();
- Map<String, Object> attributes = Collections.emptyMap();
- String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
- if (bmarker != null) {
- Map<String, Object> _attributes = bmarker.getAttributes();
- attributes = _attributes;
- markerType = bmarker.getType();
- }
+ Map attributes = bmarker.getAttributes();
+ String markerType = bmarker.getType();
return getBreakpointUIContributions(debugModelId, markerType, attributes);
}
- /**
- * Calculates the breakpoint contributions for the given breakpoint.
- *
- * @param breakpoint Breakpoint to find UI contributions for.
- * @param attributes Attributes of the breakpoint
- * @return non-null array of ICBreakpointsUIContribution
- * @throws CoreException if cannot get marker attributes from bearkpoint
- * @since 7.2
- */
- public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint,
- Map<String, Object> attributes)
- throws CoreException
- {
- String debugModelId = breakpoint.getModelIdentifier();
- IMarker bmarker = breakpoint.getMarker();
- String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
- if (bmarker != null) {
- markerType = bmarker.getType();
- }
- return getBreakpointUIContributions(debugModelId, markerType, attributes);
- }
-
- /**
- * Calculates the breakpoint UI contributions for the given breakpoint.
- *
- * @param breakpoint Breakpoint to find UI contributions for.
- * @param markerType Marker type of the breakpoint.
- * @param attributes Attributes of the breakpoint
- * @return non-null array of ICBreakpointsUIContribution
- * @throws CoreException
- * @throws CoreException if cannot get marker attributes from berakpoint
- */
public ICBreakpointsUIContribution[] getBreakpointUIContributions(String debugModelId, String markerType,
- Map<String, Object> attributes)
- {
+ Map attributes) {
ArrayList<ICBreakpointsUIContribution> list = new ArrayList<ICBreakpointsUIContribution>();
for (ICBreakpointsUIContribution con : contributions) {
try {
@@ -224,9 +185,9 @@ public class CBreakpointUIContributionFactory {
String elementValue = configurationElement.getAttribute(name);
if (elementValue == null)
CDebugUIPlugin.log(new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(),
- DebugPlugin.INTERNAL_ERROR, "Extension " //$NON-NLS-1$
+ DebugPlugin.INTERNAL_ERROR, "Extension "
+ configurationElement.getDeclaringExtension().getUniqueIdentifier()
- + " missing required attribute: " + name, null)); //$NON-NLS-1$
+ + " missing required attribute: " + name, null));
return elementValue;
}
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
deleted file mode 100644
index 8527732e80b..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointContext.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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();
-
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java
index a0a5aaf2c9a..311b325fe56 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/ICBreakpointsUIContribution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 QNX Software Systems and others.
+ * Copyright (c) 2008 QNX Software 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
@@ -82,5 +82,5 @@ public interface ICBreakpointsUIContribution {
* @param map - contains pairs of attribute=value for other breakpoint attributes
* @return
*/
- public boolean isApplicable(Map<String, Object> map);
+ public boolean isApplicable(Map map);
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java
deleted file mode 100644
index ed7fa04d634..00000000000
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * 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.core.runtime.CoreException;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Second extension interface for {@link org.eclipse.debug.ui.actions.IToggleBreakpointsTarget}.
- * This interface provides the ability open edit a breakpoint's properties and
- * to create a breakpoint in the given context with additional user input
- * (such as using a dialog or a wizard).
- * <p>
- * Clients implementing <code>IToggleBreakpointsTarget</code> may optionally
- * implement this interface.
- * </p>
- * @since 7.2
- * @see org.eclipse.debug.ui.actions.ToggleBreakpointAction
- */
-public interface IToggleBreakpointsTargetCExtension extends IToggleBreakpointsTargetExtension {
-
- /**
- * Returns whether the toggle target can create a line breakpoint at the
- * given location. If the implementation does not support creating the
- * breakpoint interactively then it should return <code>false</code>.
- * <p>
- * The selection varies depending on the given part. For example,
- * a text selection is provided for text editors, and a structured
- * selection is provided for tree views, and may be a multi-selection.
- * </p>
- * @param part the part on which the action has been invoked
- * @param selection selection on which line breakpoints should be toggled
- * @return Returns <code>true</code> if toggle target is able interactively
- * create a breakpoint(s) at the given location.
- */
- public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection);
-
- /**
- * Creates new line breakpoints interactively. The implementation should
- * allows the user to edit all of the breakpoint's settings prior to
- * creating the breakpoint. Unlike the
- * {@link #toggleLineBreakpoints(IWorkbenchPart, ISelection)}
- * method, this method does not remove the existing breakpoint at given
- * location. It always creates a new breakpoint
- * <p>
- * The selection varies depending on the given part. For example,
- * a text selection is provided for text editors, and a structured
- * selection is provided for tree views, and may be a multi-selection.
- * </p>
- * @param part the part on which the action has been invoked
- * @param selection selection on which line breakpoints should be toggled
- * @throws CoreException if unable to perform the action
- */
- public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
-
- /**
- * Returns whether the toggle target can create a watchpoint at the
- * given location. If the implementation does not support creating the
- * breakpoint interactively then it should return <code>false</code>.
- * <p>
- * The selection varies depending on the given part. For example,
- * a text selection is provided for text editors, and a structured
- * selection is provided for tree views, and may be a multi-selection.
- * </p>
- * @param part the part on which the action has been invoked
- * @param selection selection on which line breakpoints should be toggled
- * @return Returns <code>true</code> if toggle target is able interactively
- * create a breakpoint(s) at the given location.
- */
- public boolean canCreateWatchpointsInteractive(IWorkbenchPart part, ISelection selection);
-
- /**
- * Creates new watchpoint interactively. The implementation should
- * allows the user to edit all of the breakpoint's settings prior to
- * creating the breakpoint. Unlike the
- * {@link #toggleLineBreakpoints(IWorkbenchPart, ISelection)}
- * method, this method does not remove the existing breakpoint at given
- * location. It always creates a new breakpoint
- * <p>
- * The selection varies depending on the given part. For example,
- * a text selection is provided for text editors, and a structured
- * selection is provided for tree views, and may be a multi-selection.
- * </p>
- * @param part the part on which the action has been invoked
- * @param selection selection on which line breakpoints should be toggled
- * @throws CoreException if unable to perform the action
- */
- public void createWatchpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
-
- /**
- * Returns whether the toggle target can create a function breakpoint at the
- * given location. If the implementation does not support creating the
- * breakpoint interactively then it should return <code>false</code>.
- * <p>
- * The selection varies depending on the given part. For example,
- * a text selection is provided for text editors, and a structured
- * selection is provided for tree views, and may be a multi-selection.
- * </p>
- * @param part the part on which the action has been invoked
- * @param selection selection on which line breakpoints should be toggled
- * @return Returns <code>true</code> if toggle target is able interactively
- * create a breakpoint(s) at the given location.
- */
- public boolean canCreateFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection);
-
- /**
- * Creates new function breakpoint interactively. The implementation should
- * allows the user to edit all of the breakpoint's settings prior to
- * creating the breakpoint. Unlike the
- * {@link #toggleLineBreakpoints(IWorkbenchPart, ISelection)}
- * method, this method does not remove the existing breakpoint at given
- * location. It always creates a new breakpoint
- * <p>
- * The selection varies depending on the given part. For example,
- * a text selection is provided for text editors, and a structured
- * selection is provided for tree views, and may be a multi-selection.
- * </p>
- * @param part the part on which the action has been invoked
- * @param selection selection on which line breakpoints should be toggled
- * @throws CoreException if unable to perform the action
- */
- public void createFunctionBreakpointInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
-}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java
index 85ffee374e6..5b6f2615ec3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/preferences/ReadOnlyFieldEditor.java
@@ -75,22 +75,11 @@ public class ReadOnlyFieldEditor extends FieldEditor implements ICBreakpointsUIC
if (textField != null) {
String value = getPreferenceStore().getString(getPreferenceName());
if (contribution!=null) {
- if ("integer".equals (contribution.getType())) { //$NON-NLS-1$
- value = Integer.toString( getPreferenceStore().getInt(getPreferenceName()) );
- } else if ("boolean".equals (contribution.getType()) ) {//$NON-NLS-1$
- value = Boolean.toString( getPreferenceStore().getBoolean(getPreferenceName()) );
- } else if ("float".equals (contribution.getType()) ) {//$NON-NLS-1$
- value = Float.toString( getPreferenceStore().getFloat(getPreferenceName()) );
- } else if ("double".equals (contribution.getType()) ) {//$NON-NLS-1$
- value = Double.toString( getPreferenceStore().getDouble(getPreferenceName()) );
- }
String tryValue = contribution.getLabelForValue(value);
if (tryValue!=null)
value = tryValue;
}
- if (value != null) {
- textField.setText(value);
- }
+ textField.setText(value);
}
}

Back to the top