Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-03-16 18:45:09 -0400
committerPawel Piech2012-03-18 23:54:10 -0400
commitdd069579ac0131db85c7673c43556ecbb9b7432b (patch)
tree30296f3fb3dfcecedc45eee9a1278a6dd1903d46 /debug/org.eclipse.cdt.debug.ui/src/org
parentbfdf65cacdce33a493017a43fdb5ecd3613ff13f (diff)
downloadorg.eclipse.cdt-dd069579ac0131db85c7673c43556ecbb9b7432b.tar.gz
org.eclipse.cdt-dd069579ac0131db85c7673c43556ecbb9b7432b.tar.xz
org.eclipse.cdt-dd069579ac0131db85c7673c43556ecbb9b7432b.zip
Bug 360588 - [breakpoints] Allow user to edit all its properties
prior to creating the breakpoint. - Added support for double-click action modifiers in the Disassembly view. - Added an "Add Breakpoint..." action to the Disassembly view as well. - Converted the Breakpoints view's "Add Watchpoint (C/C++)" action to use a full breakpoint properties dialog when creating a watchpoint. - Added an "Add Function Breakpoint (C/C++)" action to the Breakpoints view. The action opens the full properties dialog and allows user to enter the function name.
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/actions/ActionMessages.properties5
-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/AddWatchpointActionDelegate.java10
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointDialog.java1
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CToggleMethodBreakpointActionDelegate.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/ToggleBreakpointAdapter.java19
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties41
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java54
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPreferenceStore.java18
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java191
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/AbstractToggleBreakpointAdapter.java43
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/IToggleBreakpointsTargetCExtension.java84
13 files changed, 395 insertions, 156 deletions
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 27e88771be..eb47e4a36b 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,11 +37,10 @@ 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
+EnableDisableBreakpointRulerAction.Enable_Breakpoint_1=&Enable Breakpoint\tShift+Double Click
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
-ToggleBreakpointRulerAction.Toggle_Breakpoint_1=Toggle &Breakpoint
+EnableDisableBreakpointRulerAction.Disable_Breakpoint_1=&Disable Breakpoint\tShift+Double Click
ToggleWatchpointActionDelegate.Operation_failed_1=Operation failed.
ToggleBreakpointRulerAction.Error_1=Error
ToggleBreakpointRulerAction.Operation_failed_1=Operation failed
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
new file mode 100644
index 0000000000..b6b50b235b
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddFunctionBreakpointActionDelegate.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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/AddWatchpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java
index 5f6fb2b8c3..9fab794464 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/breakpoints/AddWatchpointActionDelegate.java
@@ -76,16 +76,10 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
}
try {
- cToggleTarget.createWatchpoingsInteractive(fView, fSelection);
+ cToggleTarget.createWatchpointsInteractive(fView, fSelection);
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ 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) {
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/breakpoints/AddWatchpointDialog.java
index 684a1c819d..8144e4d4cd 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/breakpoints/AddWatchpointDialog.java
@@ -45,6 +45,7 @@ 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/CAddBreakpointInteractiveRulerAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/CAddBreakpointInteractiveRulerAction.java
index 521ba83a04..a7923b204c 100644
--- 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
@@ -97,8 +97,8 @@ public class CAddBreakpointInteractiveRulerAction extends Action implements IUpd
DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fPart, selection);
if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) toggleTarget;
- if (extension.canCreateBreakpointsInteractive(fPart, selection)) {
- extension.createBreakpointsInteractive(fPart, selection);
+ if (extension.canCreateLineBreakpointsInteractive(fPart, selection)) {
+ extension.createLineBreakpointsInteractive(fPart, selection);
}
}
} catch (BadLocationException e) {
@@ -177,7 +177,7 @@ public class CAddBreakpointInteractiveRulerAction extends Action implements IUpd
}
if (adapter instanceof IToggleBreakpointsTargetCExtension) {
IToggleBreakpointsTargetCExtension extension = (IToggleBreakpointsTargetCExtension) adapter;
- if (extension.canCreateBreakpointsInteractive(fPart, selection)) {
+ if (extension.canCreateLineBreakpointsInteractive(fPart, selection)) {
setEnabled(true);
return;
}
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
index 99576e3fd0..85c8d91469 100644
--- 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
@@ -37,9 +37,9 @@ public class CToggleMethodBreakpointActionDelegate extends CToggleBreakpointObje
{
if ((event.stateMask & SWT.MOD1) != 0 &&
target instanceof IToggleBreakpointsTargetCExtension &&
- ((IToggleBreakpointsTargetCExtension)target).canCreateBreakpointsInteractive(part, selection))
+ ((IToggleBreakpointsTargetCExtension)target).canCreateLineBreakpointsInteractive(part, selection))
{
- ((IToggleBreakpointsTargetCExtension)target).createBreakpointsInteractive(part, selection);
+ ((IToggleBreakpointsTargetCExtension)target).createLineBreakpointsInteractive(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
index ebee061e03..41201f5149 100644
--- 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
@@ -91,20 +91,11 @@ public class ToggleBreakpointAdapter extends AbstractToggleBreakpointAdapter {
protected void createWatchpoint( boolean interactive, IWorkbenchPart part, String sourceHandle, IResource resource,
int charStart, int charEnd, int lineNumber, String expression) throws CoreException
{
-// AddWatchpointDialog dlg = new AddWatchpointDialog(part.getSite().getShell(), getMemorySpaceManagement() );
-// dlg.setExpression( expression );
-// if ( dlg.open() != Window.OK )
-// return;
-// expression = dlg.getExpression();
-// CDIDebugModel.createWatchpoint(sourceHandle, resource, charStart, charEnd, lineNumber, dlg.getWriteAccess(),
-// dlg.getReadAccess(), expression, dlg.getMemorySpace(), dlg.getRange(), true, 0, "", true); //$NON-NLS-1$
- if (interactive) {
- 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$
- openBreakpointPropertiesDialog(bp, part, resource, attributes);
- }
+ 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() {
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
index daea7c8da8..ecc61aa6bf 100644
--- 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
@@ -12,26 +12,29 @@
###############################################################################
CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
-CBreakpointPropertyPage.1=Not available
+CBreakpointPropertyPage.function_valueNotAvailable_label=Not available
CBreakpointPropertyPage.function_label=Function name:
-CBreakpointPropertyPage.3=C/C++ function breakpoint
-CBreakpointPropertyPage.4=Not available
+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.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
+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/CBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
index d1d359322e..bc179355e3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
@@ -13,8 +13,14 @@ package org.eclipse.cdt.debug.internal.ui.breakpoints;
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;
@@ -26,10 +32,12 @@ 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
@@ -148,6 +156,43 @@ 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.
@@ -155,10 +200,12 @@ class CBreakpointContextActionFilter implements IActionFilter {
class CBreakpointContextAdapterFactory implements IAdapterFactory {
private static final Class<?>[] fgAdapterList = new Class[] {
- IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class, IPreferenceStore.class
+ IBreakpoint.class, ICBreakpoint.class, ICTracepoint.class, IActionFilter.class, IPreferenceStore.class,
+ IWorkbenchAdapter.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) {
@@ -178,6 +225,11 @@ class CBreakpointContextAdapterFactory implements IAdapterFactory {
if (IActionFilter.class.equals(adapterType)) {
return fgActionFilter;
}
+
+ if (IWorkbenchAdapter.class.equals(adapterType)) {
+ return fgWorkbenchAdapter;
+ }
+
return null;
}
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
index dc250b872d..c558db83b6 100644
--- 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
@@ -40,14 +40,6 @@ import org.eclipse.jface.util.PropertyChangeEvent;
*/
public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
-// 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$
-
// This map is the current properties/values being maintained/manipulated
private HashMap<String, Object> fProperties = new HashMap<String, Object>();
@@ -149,7 +141,7 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
breakpoint.getMarker().setAttribute(ICLineBreakpoint2.REQUESTED_LINE, getInt(IMarker.LINE_NUMBER));
} else {
// this allow set attributes contributed by other plugins
- String value = getPropertyAsString(property);
+ Object value = fProperties.get(property);
if ( value != null ) {
marker.setAttribute(property, value);
}
@@ -175,14 +167,6 @@ public class CBreakpointPreferenceStore implements IPersistentPreferenceStore {
}
}
- private String getPropertyAsString(String property) {
- if (fProperties.containsKey(property)) {
- return getString(property);
- } else {
- return null;
- }
- }
-
///////////////////////////////////////////////////////////////////////
// IPreferenceStore
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
index b6c9e377e5..587abcbfa0 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
@@ -15,7 +15,6 @@ 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.ICEventBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
@@ -26,6 +25,7 @@ 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;
@@ -38,6 +38,7 @@ 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
@@ -232,8 +233,11 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
}
private void createMainLabel(ICBreakpoint breakpoint) {
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.18" ), //$NON-NLS-1$
- getBreakpointMainLabel(breakpoint) ) );
+ String label = getBreakpointMainLabel(breakpoint);
+ addField( createLabelEditor(
+ getFieldEditorParent(),
+ BreakpointsMessages.getString( "CBreakpointPropertyPage.breakpointType_label" ), //$NON-NLS-1$
+ label) );
}
/**
@@ -244,52 +248,37 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
private void createTypeSpecificLabelFieldEditors( ICBreakpoint breakpoint ) {
if ( breakpoint instanceof ICFunctionBreakpoint ) {
- ICFunctionBreakpoint fbrkpt = (ICFunctionBreakpoint)breakpoint;
- String function = BreakpointsMessages.getString( "CBreakpointPropertyPage.1" ); //$NON-NLS-1$
- try {
- function = fbrkpt.getFunction();
- }
- catch( CoreException e ) {
- }
- catch( NumberFormatException e ) {
- }
- if ( function != null ) {
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.function_label" ), function ) ); //$NON-NLS-1$
- }
+ createFunctionEditor(getFieldEditorParent());
}
else if ( breakpoint instanceof ICAddressBreakpoint ) {
- ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
- String address = BreakpointsMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
- try {
- address = abrkpt.getAddress();
- }
- catch( CoreException e ) {
- }
- if ( address != null ) {
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.address_label" ), address ) ); //$NON-NLS-1$
- }
+ 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 ) {
- ICWatchpoint watchpoint = (ICWatchpoint)breakpoint;
- String expression = getPreferenceStore().getString(ICWatchpoint.EXPRESSION);
-
- IMarker marker = breakpoint.getMarker();
- if (marker != null) {
- IProject project = marker.getResource().getProject();
+ IResource resource = getResource();
+ if (resource != null) {
+ IProject project = resource.getProject();
if ( project != null ) {
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.10" ), project.getName() ) ); //$NON-NLS-1$
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.project_label" ), project.getName() ) ); //$NON-NLS-1$
}
}
String filename = getPreferenceStore().getString(ICBreakpoint.SOURCE_HANDLE);
- if (!"".equals(filename)) { //$NON-NLS-1$
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.20" ), filename ) ); //$NON-NLS-1$
+ if (filename != null && !"".equals(filename)) { //$NON-NLS-1$
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.sourceHandle_label" ), filename ) ); //$NON-NLS-1$
}
- addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$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.7" ), fileName ) ); //$NON-NLS-1$
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.sourceHandle_label" ), fileName ) ); //$NON-NLS-1$
}
int lNumber = getPreferenceStore().getInt(IMarker.LINE_NUMBER);
if (lNumber > 0) {
@@ -300,58 +289,101 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
}
private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
- if (breakpoint instanceof ICFunctionBreakpoint)
- return BreakpointsMessages.getString("CBreakpointPropertyPage.3"); //$NON-NLS-1$
- if (breakpoint instanceof ICAddressBreakpoint)
- return BreakpointsMessages.getString("CBreakpointPropertyPage.4"); //$NON-NLS-1$
- if (breakpoint instanceof ICLineBreakpoint)
- return BreakpointsMessages.getString("CBreakpointPropertyPage.8"); //$NON-NLS-1$
- if (breakpoint instanceof ICEventBreakpoint)
- return BreakpointsMessages.getString("CBreakpointPropertyPage.21"); //$NON-NLS-1$
- if (breakpoint instanceof ICWatchpoint) {
- String type = ""; //$NON-NLS-1$
- boolean isReadType = getPreferenceStore().getBoolean(ICWatchpoint.READ);
- boolean isWriteType = getPreferenceStore().getBoolean(ICWatchpoint.WRITE);
- if (isReadType && !isWriteType)
- type = BreakpointsMessages.getString("CBreakpointPropertyPage.11"); //$NON-NLS-1$
- else if (!isReadType && isWriteType)
- type = BreakpointsMessages.getString("CBreakpointPropertyPage.12"); //$NON-NLS-1$
- else
- type = BreakpointsMessages.getString("CBreakpointPropertyPage.13"); //$NON-NLS-1$
-
- return type;
- }
- // default main label is the label of marker type for the breakpoint
- return CDIDebugModel.calculateMarkerType(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.9" ); //$NON-NLS-1$
+ 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 createAddressEditor( Composite parent ) {
- String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.addressLabel" ); //$NON-NLS-1$
- StringFieldEditor fe =new StringFieldEditor( ICLineBreakpoint.ADDRESS ,title, parent);
- fe.setEmptyStringAllowed(false);
- addField( fe );
- }
+
+ 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.19" ), parent ); //$NON-NLS-1$
+ 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.15" ), parent ); //$NON-NLS-1$
+ fCondition = new BreakpointStringFieldEditor( ICBreakpoint.CONDITION, BreakpointsMessages.getString( "CBreakpointPropertyPage.condition_label" ), parent ); //$NON-NLS-1$
fCondition.setEmptyStringAllowed( true );
- fCondition.setErrorMessage( BreakpointsMessages.getString( "CBreakpointPropertyPage.16" ) ); //$NON-NLS-1$
+ 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.17" ), parent ); //$NON-NLS-1$
+ 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 );
@@ -366,12 +398,25 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
IAdaptable element = getElement();
if (element instanceof ICBreakpoint) {
return (ICBreakpoint)element;
- } else if (element instanceof CBreakpointContext) {
- return ((CBreakpointContext)element).getBreakpoint();
+ } 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();
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
index 0c79dc3945..22dd8d73e7 100644
--- 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
@@ -151,25 +151,54 @@ abstract public class AbstractToggleBreakpointAdapter
}
@Override
- public boolean canCreateBreakpointsInteractive(IWorkbenchPart part, ISelection selection) {
- return canToggleBreakpoints( part, selection );
+ public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) {
+ return canToggleLineBreakpoints( part, selection );
}
@Override
- public void createBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
- updateBreakpoints(false, true, part, selection);
+ public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
+ updateLineBreakpoints(false, true, part, selection);
}
@Override
- public boolean canCreateWatchpoingsInteractive(IWorkbenchPart part, ISelection selection) {
+ public boolean canCreateWatchpointsInteractive(IWorkbenchPart part, ISelection selection) {
+ // Gather all input from user if needed.
return true;
}
@Override
- public void createWatchpoingsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException {
- createWatchpoint(true, part, null, ResourcesPlugin.getWorkspace().getRoot(), -1, -1, -1, "");
+ 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
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
index 3963ae4fb2..ed7fa04d63 100644
--- 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
@@ -30,7 +30,7 @@ import org.eclipse.ui.IWorkbenchPart;
public interface IToggleBreakpointsTargetCExtension extends IToggleBreakpointsTargetExtension {
/**
- * Returns whether the toggle target can create a a breakpoint at the
+ * 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>
@@ -43,12 +43,15 @@ public interface IToggleBreakpointsTargetCExtension extends IToggleBreakpointsTa
* @return Returns <code>true</code> if toggle target is able interactively
* create a breakpoint(s) at the given location.
*/
- public boolean canCreateBreakpointsInteractive(IWorkbenchPart part, ISelection selection);
+ public boolean canCreateLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection);
/**
- * Creates new breakpoints interactively. The implementation should allows
- * the user to edit all of the breakpoint's settings prior to creating the
- * breakpoint.
+ * 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
@@ -58,10 +61,73 @@ public interface IToggleBreakpointsTargetCExtension extends IToggleBreakpointsTa
* @param selection selection on which line breakpoints should be toggled
* @throws CoreException if unable to perform the action
*/
- public void createBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
+ public void createLineBreakpointsInteractive(IWorkbenchPart part, ISelection selection) throws CoreException;
- public boolean canCreateWatchpoingsInteractive(IWorkbenchPart part, ISelection selection);
-
- public void createWatchpoingsInteractive(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;
}

Back to the top