Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 159459 Details for
Bug 248606
[menu][breakpoints][cdi] Add support for toggling watchpoints in the variables and expressions views.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Solution
patch_248606 (text/plain), 14.38 KB, created by
John Cortell
on 2010-02-18 12:30:17 EST
(
hide
)
Description:
Solution
Filename:
MIME Type:
Creator:
John Cortell
Created:
2010-02-18 12:30:17 EST
Size:
14.38 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/plugin.xml,v >retrieving revision 1.228 >diff -u -r1.228 plugin.xml >--- plugin.xml 1 Feb 2010 16:23:32 -0000 1.228 >+++ plugin.xml 18 Feb 2010 17:29:00 -0000 >@@ -724,6 +724,19 @@ > </action> > </objectContribution> > <objectContribution >+ objectClass="org.eclipse.cdt.debug.internal.core.IWatchpointTarget" >+ id="org.eclipse.cdt.debug.ui.WatchpointActions"> >+ <action >+ class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >+ enablesFor="1" >+ icon="icons/elcl16/watchpoint_co.gif" >+ id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >+ label="%AddWatchpoint.label" >+ menubarPath="additions" >+ tooltip="%AddWatchpoint.tooltip"> >+ </action> >+ </objectContribution> >+ <objectContribution > objectClass="org.eclipse.cdt.core.model.IVariable" > id="org.eclipse.cdt.debug.ui.WatchpointActions"> > <action >@@ -808,20 +821,6 @@ > class="org.eclipse.cdt.debug.core.model.ICVariable"> > </selection> > </action> >- <action >- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >- enablesFor="1" >- icon="icons/elcl16/watchpoint_co.gif" >- id="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate" >- label="%AddWatchpoint.label" >- menubarPath="additions" >- tooltip="%AddWatchpoint.tooltip"> >- <enablement> >- <pluginState >- value="activated" >- id="org.eclipse.cdt.debug.ui"/> >- </enablement> >- </action> > </viewerContribution> > <viewerContribution > targetID="org.eclipse.debug.ui.RegisterView" >Index: src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java,v >retrieving revision 1.3 >diff -u -r1.3 AddWatchpointOnVariableActionDelegate.java >--- src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java 11 Jun 2008 15:48:38 -0000 1.3 >+++ src/org/eclipse/cdt/debug/internal/ui/actions/AddWatchpointOnVariableActionDelegate.java 18 Feb 2010 17:29:00 -0000 >@@ -11,66 +11,92 @@ > package org.eclipse.cdt.debug.internal.ui.actions; > > >-import org.eclipse.cdt.debug.internal.core.model.CVariable; >-import org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointDialog; >+import org.eclipse.cdt.debug.internal.core.IWatchpointTarget; > import org.eclipse.cdt.debug.ui.CDebugUIPlugin; >-import org.eclipse.debug.core.DebugException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.TreeSelection; > import org.eclipse.jface.window.Window; >-import org.eclipse.ui.IActionDelegate; > import org.eclipse.ui.IObjectActionDelegate; > import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.progress.WorkbenchJob; > >- >-public class AddWatchpointOnVariableActionDelegate extends AddWatchpointActionDelegate { >+/** >+ * Invoked when user right clicks on an element in the Variables or Expressions >+ * view and selects 'Add Watchpoint (C/C++)' >+ */ >+public class AddWatchpointOnVariableActionDelegate extends AddWatchpointActionDelegate implements IObjectActionDelegate { > > /** >- * Constructor for Action1. >+ * The target variable/expression >+ */ >+ private IWatchpointTarget fVar; >+ >+ /** >+ * Constructor > */ > public AddWatchpointOnVariableActionDelegate() { > super(); > } > >- /** >- * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart) >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) > */ >- public void setActivePart(IAction action, IWorkbenchPart targetPart) {} >+ public void setActivePart(IAction action, IWorkbenchPart targetPart) { >+ // Don't care. Our logic is agnostic to the view we're invoked from. >+ } > >- /** >- * @see IActionDelegate#run(IAction) >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointActionDelegate#run(org.eclipse.jface.action.IAction) > */ > public void run(IAction action) { >- IStructuredSelection selection = getSelection(); >- >- if (selection == null || selection.isEmpty()) { >+ if (fVar == null) { > return; > } > >- Object obj = ((TreeSelection)selection).getFirstElement(); >- if (obj != null && obj instanceof CVariable) { >- CVariable var = (CVariable)obj; >- >- String expr = ""; >- >- try { >- expr = var.getExpressionString(); >- } catch (DebugException e) {} >- >- AddWatchpointDialog dlg = new AddWatchpointDialog(CDebugUIPlugin.getActiveWorkbenchShell(), >- getMemorySpaceManagement()); //$NON-NLS-1$ >- dlg.setExpression(expr); >- dlg.initializeRange(false, Integer.toString(var.sizeof())); >- if (dlg.open() == Window.OK) { >- addWatchpoint(dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange()); >- } >+ final String expr = fVar.getExpression(); >+ if (expr == null) { >+ assert false : "how are we getting an empty expression?"; //$NON-NLS-1$ >+ return; > } >+ >+ // Getting the size of the variable/expression is an asynchronous >+ // operation...or at least the API is (the CDI implementation reacts >+ // synchronously) >+ final IWatchpointTarget.GetSizeRequest request = new IWatchpointTarget.GetSizeRequest() { >+ public void done() { >+ // Now that we have the size, put up a dialog to create the watchpoint >+ final int size = getSize(); >+ assert size > 0 : "unexpected variale/expression size"; //$NON-NLS-1$ >+ WorkbenchJob job = new WorkbenchJob("open watchpoint dialog") { //$NON-NLS-1$ >+ @Override >+ public IStatus runInUIThread(IProgressMonitor monitor) { >+ AddWatchpointDialog dlg = new AddWatchpointDialog(CDebugUIPlugin.getActiveWorkbenchShell(), >+ getMemorySpaceManagement()); >+ dlg.setExpression(expr); >+ dlg.initializeRange(false, Integer.toString(size)); >+ if (dlg.open() == Window.OK) { >+ addWatchpoint(dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange()); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job.setSystem(true); >+ job.schedule(); >+ } >+ }; >+ fVar.getSize(request); > } >- >+ > /** >- * @see IActionDelegate#selectionChanged(IAction, ISelection) >+ * Record the target variable/expression. >+ * >+ * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, >+ * org.eclipse.jface.viewers.ISelection) > */ > public void selectionChanged(IAction action, ISelection selection) { > if (selection == null || selection.isEmpty()) { >@@ -79,16 +105,20 @@ > } > if (selection instanceof TreeSelection) { > Object obj = ((TreeSelection)selection).getFirstElement(); >- if (obj != null && obj instanceof CVariable) { >- action.setEnabled(true); >- } else { >- action.setEnabled(false); >+ action.setEnabled(obj instanceof IWatchpointTarget); >+ if (obj instanceof IWatchpointTarget) { >+ fVar = (IWatchpointTarget)obj; >+ return; > } >+ assert false : "action installed in unexpected type of object"; //$NON-NLS-1$ > } >+ else if (selection instanceof StructuredSelection) { >+ // Not sure why, but sometimes we get an extraneous empty StructuredSelection. Seems harmless enough >+ assert ((StructuredSelection)selection).getFirstElement() == null : "action installed in unexpected type of view/part"; //$NON-NLS-1$ >+ } >+ else { >+ assert false : "action installed in unexpected type of view/part"; //$NON-NLS-1$ >+ } >+ action.setEnabled(false); > } >- >- private IStructuredSelection getSelection() { >- return (IStructuredSelection)getView().getViewSite().getSelectionProvider().getSelection(); >- } >- > } >Index: src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java,v >retrieving revision 1.1 >diff -u -r1.1 IDisassemblyRetrieval.java >--- src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java 15 Feb 2010 15:34:31 -0000 1.1 >+++ src/org/eclipse/cdt/debug/internal/ui/disassembly/dsf/IDisassemblyRetrieval.java 18 Feb 2010 17:29:00 -0000 >@@ -14,57 +14,16 @@ > import java.math.BigInteger; > > import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.debug.core.IRequest; >+import org.eclipse.cdt.debug.internal.core.CRequest; > import org.eclipse.debug.core.model.IStackFrame; > > /** > */ > public interface IDisassemblyRetrieval { >- /** >- */ >- public static class Request implements IRequest { >- private IStatus fStatus; >- private boolean fCanceled; >- /* >- * @see org.eclipse.debug.core.IRequest#cancel() >- */ >- public void cancel() { >- fCanceled= true; >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#done() >- */ >- public void done() { >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#getStatus() >- */ >- public IStatus getStatus() { >- return fStatus; >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#isCanceled() >- */ >- public boolean isCanceled() { >- return fCanceled; >- } >- >- /* >- * @see org.eclipse.debug.core.IRequest#setStatus(org.eclipse.core.runtime.IStatus) >- */ >- public void setStatus(IStatus status) { >- fStatus= status; >- } >- >- } > > /** > */ >- public static class AddressRequest extends Request { >+ public static class AddressRequest extends CRequest { > private BigInteger fAddress; > /** > * @return the address >@@ -81,7 +40,7 @@ > } > } > >- public static class DisassemblyRequest extends Request { >+ public static class DisassemblyRequest extends CRequest { > IDisassemblyBlock fDisassemblyBlock; > > /** >#P org.eclipse.cdt.dsf.ui >Index: src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java,v >retrieving revision 1.12 >diff -u -r1.12 VariableVMNode.java >--- src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java 11 Feb 2010 19:28:18 -0000 1.12 >+++ src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/VariableVMNode.java 18 Feb 2010 17:29:01 -0000 >@@ -17,6 +17,7 @@ > import java.util.Map; > import java.util.concurrent.RejectedExecutionException; > >+import org.eclipse.cdt.debug.internal.core.IWatchpointTarget; > import org.eclipse.cdt.debug.internal.ui.CDebugImages; > import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor; > import org.eclipse.cdt.dsf.concurrent.CountingRequestMonitor; >@@ -134,7 +135,7 @@ > */ > private final IElementLabelProvider fLabelProvider; > >- public class VariableExpressionVMC extends DMVMContext implements IFormattedValueVMContext { >+ public class VariableExpressionVMC extends DMVMContext implements IFormattedValueVMContext, IWatchpointTarget { > > private IExpression fExpression; > >@@ -146,8 +147,8 @@ > fExpression = expression; > } > >- @Override >- @SuppressWarnings("rawtype") >+ @SuppressWarnings("rawtypes") >+ @Override > public Object getAdapter(Class adapter) { > if (fExpression != null && adapter.isAssignableFrom(fExpression.getClass())) { > return fExpression; >@@ -172,6 +173,47 @@ > public int hashCode() { > return super.hashCode() + (fExpression != null ? fExpression.hashCode() : 0); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getExpression() >+ */ >+ public String getExpression() { >+ final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(), IExpressionDMContext.class); >+ if (exprDmc != null) { >+ return exprDmc.getExpression(); >+ } >+ >+ return ""; //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.cdt.debug.internal.core.IWatchpointTarget#getSize() >+ */ >+ public void getSize(final IWatchpointTarget.GetSizeRequest request) { >+ final IExpressionDMContext exprDmc = DMContexts.getAncestorOfType(getDMContext(), IExpressionDMContext.class); >+ if (exprDmc != null) { >+ getSession().getExecutor().execute(new Runnable() { >+ public void run() { >+ final IExpressions expressionService = getServicesTracker().getService(IExpressions.class); >+ if (expressionService != null) { >+ final DataRequestMonitor<IExpressionDMAddress> drm = new DataRequestMonitor<IExpressionDMAddress>(getSession().getExecutor(), null) { >+ @Override >+ public void handleSuccess() { >+ request.setSize(getData().getSize()); >+ request.done(); >+ } >+ }; >+ >+ expressionService.getExpressionAddressData(exprDmc, drm); >+ } >+ } >+ }); >+ } >+ else { >+ request.setSize(-1); >+ request.done(); >+ } >+ } > } > > protected class VariableExpressionFactory implements IWatchExpressionFactoryAdapter2 {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 248606
:
159245
|
159459
|
159500
|
159725
|
159821