From 2d40e6fea78039e96747ce1c2d8397cecd1a1ecd Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Thu, 17 Dec 2009 13:19:04 +0000 Subject: [PATCH] Bug 293634 - [breakpoints] ToggleBreakpointAdapter blocks UI thread waiting on the index (follow up) --- .../ui/actions/ToggleBreakpointAdapter.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) 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 index 7d6f26304f9..b8f2fbf7aaa 100644 --- 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 @@ -51,7 +51,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; -import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget; +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; @@ -68,7 +68,7 @@ import org.eclipse.ui.texteditor.ITextEditor; /** * Toggles a line breakpoint in a C/C++ editor. */ -public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { +public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtension { /* (non-Javadoc) * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) @@ -539,4 +539,26 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget { } return adapter; } + + /* + * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#canToggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) + */ + public boolean canToggleBreakpoints(IWorkbenchPart part, ISelection selection) { + return canToggleLineBreakpoints(part, selection); + } + + /* + * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension#toggleBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) + */ + public void toggleBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException { + ICElement element = getCElementFromSelection(part, selection); + if (element instanceof IFunction || element instanceof IMethod) { + toggleMethodBreakpoints0((IDeclaration)element); + } else if (element instanceof IVariable) { + toggleVariableWatchpoint(part, (IVariable) element); + } else { + toggleLineBreakpoints(part, selection); + } + } + }