Skip to main content
summaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorPawel Piech2012-03-02 01:11:25 -0500
committerPawel Piech2012-03-18 23:53:39 -0400
commitbfdf65cacdce33a493017a43fdb5ecd3613ff13f (patch)
treead3ef337aa12b0680e0640c95ab3f53a38043251 /debug
parentd76485935eae38374d7e233a6a0ab383957b0f8e (diff)
downloadorg.eclipse.cdt-bfdf65cacdce33a493017a43fdb5ecd3613ff13f.tar.gz
org.eclipse.cdt-bfdf65cacdce33a493017a43fdb5ecd3613ff13f.tar.xz
org.eclipse.cdt-bfdf65cacdce33a493017a43fdb5ecd3613ff13f.zip
Bug 360588 - [breakpoints] Allow user to edit all its properties prior to creating the breakpoint
Added a default toggle target to add watchpoint action.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/breakpoints/AddWatchpointActionDelegate.java19
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java61
2 files changed, 35 insertions, 45 deletions
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 873b589803..5f6fb2b8c3 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
@@ -39,7 +39,7 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
private IViewPart fView;
private ISelection fSelection;
-
+ private ToggleBreakpointAdapter fDefaultToggleTarget = new ToggleBreakpointAdapter();
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
@@ -68,14 +68,19 @@ public class AddWatchpointActionDelegate extends ActionDelegate implements IView
@Override
public void run( IAction action ) {
IToggleBreakpointsTarget toggleTarget = DebugUITools.getToggleBreakpointsTargetManager().getToggleBreakpointsTarget(fView, fSelection);
+ IToggleBreakpointsTargetCExtension cToggleTarget = null;
if (toggleTarget instanceof IToggleBreakpointsTargetCExtension) {
- try {
- ((IToggleBreakpointsTargetCExtension)toggleTarget).createWatchpoingsInteractive(fView, fSelection);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ cToggleTarget = (IToggleBreakpointsTargetCExtension)toggleTarget;
+ } else {
+ cToggleTarget = fDefaultToggleTarget;
}
+
+ try {
+ cToggleTarget.createWatchpoingsInteractive(fView, fSelection);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
// AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(), getMemorySpaceManagement() );
// if ( dlg.open() == Window.OK ) {
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 94777da096..b6c9e377e5 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
@@ -12,6 +12,7 @@
*******************************************************************************/
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;
@@ -23,10 +24,8 @@ import org.eclipse.cdt.debug.ui.breakpoints.CBreakpointUIContributionFactory;
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext;
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointsUIContribution;
import org.eclipse.cdt.debug.ui.preferences.ReadOnlyFieldEditor;
-import org.eclipse.core.resources.IFile;
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;
@@ -272,23 +271,18 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
}
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(), BreakpointsMessages.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(), BreakpointsMessages.getString( "CBreakpointPropertyPage.20" ), filename ) ); //$NON-NLS-1$
- }
+ String expression = getPreferenceStore().getString(ICWatchpoint.EXPRESSION);
+
+ IMarker marker = breakpoint.getMarker();
+ if (marker != null) {
+ IProject project = marker.getResource().getProject();
+ if ( project != null ) {
+ addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.10" ), 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$
}
addField( createLabelEditor( getFieldEditorParent(), BreakpointsMessages.getString( "CBreakpointPropertyPage.14" ), expression ) ); //$NON-NLS-1$
}
@@ -315,29 +309,20 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
if (breakpoint instanceof ICEventBreakpoint)
return BreakpointsMessages.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 = BreakpointsMessages.getString("CBreakpointPropertyPage.11"); //$NON-NLS-1$
- else if (!watchpoint.isReadType() && watchpoint.isWriteType())
- type = BreakpointsMessages.getString("CBreakpointPropertyPage.12"); //$NON-NLS-1$
- else
- type = BreakpointsMessages.getString("CBreakpointPropertyPage.13"); //$NON-NLS-1$
-
- } catch (CoreException ce) {
- CDebugUIPlugin.log(ce);
- }
+ 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
- String type = ""; //$NON-NLS-1$
- try {
- type = breakpoint.getMarker().getType(); // TODO: how to get label?
- } catch (CoreException ce) {
- CDebugUIPlugin.log(ce);
- }
- return type;
+ return CDIDebugModel.calculateMarkerType(breakpoint);
}
protected void createLineNumberEditor( Composite parent ) {
String title = BreakpointsMessages.getString( "CBreakpointPropertyPage.9" ); //$NON-NLS-1$

Back to the top