mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
[273924] - [breakpoints] Use IToggleBreakpointsTargetFactory for CDT breakpoints
This commit is contained in:
parent
6423917e54
commit
202474d90a
10 changed files with 153 additions and 497 deletions
|
@ -420,9 +420,9 @@
|
||||||
<action
|
<action
|
||||||
label="%AddBreakpoint.label"
|
label="%AddBreakpoint.label"
|
||||||
helpContextId="manage_breakpoint_action_context"
|
helpContextId="manage_breakpoint_action_context"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
|
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
|
||||||
menubarPath="debug"
|
menubarPath="debug"
|
||||||
id="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate">
|
id="org.eclipse.debug.ui.actions.RulerToggleBreakpointAction">
|
||||||
</action>
|
</action>
|
||||||
</viewerContribution>
|
</viewerContribution>
|
||||||
<viewerContribution
|
<viewerContribution
|
||||||
|
@ -525,9 +525,9 @@
|
||||||
<action
|
<action
|
||||||
label="%AddBreakpoint.label"
|
label="%AddBreakpoint.label"
|
||||||
helpContextId="manage_breakpoint_action_context"
|
helpContextId="manage_breakpoint_action_context"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
|
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
|
||||||
menubarPath="debug"
|
menubarPath="debug"
|
||||||
id="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate">
|
id="org.eclipse.debug.ui.actions.RulerToggleBreakpointAction">
|
||||||
</action>
|
</action>
|
||||||
</viewerContribution>
|
</viewerContribution>
|
||||||
<viewerContribution
|
<viewerContribution
|
||||||
|
@ -689,10 +689,10 @@
|
||||||
icon="icons/elcl16/function_brkpt_co.gif"
|
icon="icons/elcl16/function_brkpt_co.gif"
|
||||||
helpContextId="manage_function_breakpoint_action_context"
|
helpContextId="manage_function_breakpoint_action_context"
|
||||||
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
|
class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
|
||||||
menubarPath="additions"
|
menubarPath="additions"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate">
|
id="org.eclipse.cdt.debug.ui.actions.function.ToggleMethodBreakpointAction">
|
||||||
</action>
|
</action>
|
||||||
</objectContribution>
|
</objectContribution>
|
||||||
<objectContribution
|
<objectContribution
|
||||||
|
@ -703,10 +703,10 @@
|
||||||
icon="icons/elcl16/function_brkpt_co.gif"
|
icon="icons/elcl16/function_brkpt_co.gif"
|
||||||
helpContextId="manage_function_breakpoint_action_context"
|
helpContextId="manage_function_breakpoint_action_context"
|
||||||
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
tooltip="%ManageFunctionBreakpointAction.tooltip"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
|
class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
|
||||||
menubarPath="additions"
|
menubarPath="additions"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate">
|
id="org.eclipse.cdt.debug.ui.actions.method.ToggleMethodBreakpointAction">
|
||||||
</action>
|
</action>
|
||||||
</objectContribution>
|
</objectContribution>
|
||||||
<objectContribution
|
<objectContribution
|
||||||
|
@ -717,10 +717,10 @@
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
label="%ToggleWatchpointAction.label"
|
label="%ToggleWatchpointAction.label"
|
||||||
icon="icons/elcl16/watchpoint_co.gif"
|
icon="icons/elcl16/watchpoint_co.gif"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleWatchpointActionDelegate"
|
class="org.eclipse.debug.ui.actions.ToggleWatchpointActionDelegate"
|
||||||
tooltip="%ToggleWatchpointAction.tooltip"
|
tooltip="%ToggleWatchpointAction.tooltip"
|
||||||
menubarPath="additions"
|
menubarPath="additions"
|
||||||
id="org.eclipse.cdt.debug.internal.ui.actions.ToggleWatchpointActionDelegate"/>
|
id="org.eclipse.cdt.debug.ui.actions.ToggleWatchpointAction"/>
|
||||||
</objectContribution>
|
</objectContribution>
|
||||||
<viewerContribution
|
<viewerContribution
|
||||||
targetID="org.eclipse.debug.ui.VariableView"
|
targetID="org.eclipse.debug.ui.VariableView"
|
||||||
|
@ -1193,9 +1193,9 @@
|
||||||
id="org.eclipse.cdt.debug.ui.CEditor.BreakpointRulerActions">
|
id="org.eclipse.cdt.debug.ui.CEditor.BreakpointRulerActions">
|
||||||
<action
|
<action
|
||||||
label="%Dummy.label"
|
label="%Dummy.label"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
|
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
|
||||||
actionID="RulerDoubleClick"
|
actionID="RulerDoubleClick"
|
||||||
id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction">
|
id="org.eclipse.cdt.debug.ui.CEditor.RulerTobbleBreakpointAction">
|
||||||
</action>
|
</action>
|
||||||
</editorContribution>
|
</editorContribution>
|
||||||
<editorContribution
|
<editorContribution
|
||||||
|
@ -1203,9 +1203,9 @@
|
||||||
id="org.eclipse.cdt.ui.editor.asm.AsmEditor.BreakpointRulerActions">
|
id="org.eclipse.cdt.ui.editor.asm.AsmEditor.BreakpointRulerActions">
|
||||||
<action
|
<action
|
||||||
label="%Dummy.label"
|
label="%Dummy.label"
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointRulerActionDelegate"
|
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
|
||||||
actionID="RulerDoubleClick"
|
actionID="RulerDoubleClick"
|
||||||
id="org.eclipse.cdt.debug.ui.CEditor.ManageBreakpointRulerAction">
|
id="org.eclipse.cdt.debug.ui.CEditor.RulerTobbleBreakpointAction">
|
||||||
</action>
|
</action>
|
||||||
</editorContribution>
|
</editorContribution>
|
||||||
</extension>
|
</extension>
|
||||||
|
@ -1410,9 +1410,6 @@
|
||||||
<factory
|
<factory
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.internal.ui.editor.CEditor">
|
adaptableType="org.eclipse.cdt.internal.ui.editor.CEditor">
|
||||||
<adapter
|
|
||||||
type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
|
|
||||||
</adapter>
|
|
||||||
<adapter
|
<adapter
|
||||||
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
|
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
|
||||||
</adapter>
|
</adapter>
|
||||||
|
@ -1422,9 +1419,6 @@
|
||||||
<factory
|
<factory
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor">
|
adaptableType="org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor">
|
||||||
<adapter
|
|
||||||
type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
|
|
||||||
</adapter>
|
|
||||||
<adapter
|
<adapter
|
||||||
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
|
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
|
||||||
</adapter>
|
</adapter>
|
||||||
|
@ -1434,22 +1428,12 @@
|
||||||
<factory
|
<factory
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView">
|
adaptableType="org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView">
|
||||||
<adapter
|
|
||||||
type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
|
|
||||||
</adapter>
|
|
||||||
<adapter
|
<adapter
|
||||||
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
|
type="org.eclipse.debug.ui.actions.IRunToLineTarget">
|
||||||
</adapter>
|
</adapter>
|
||||||
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget"/>
|
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IResumeAtLineTarget"/>
|
||||||
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget"/>
|
<adapter type="org.eclipse.cdt.debug.internal.ui.actions.IMoveToLineTarget"/>
|
||||||
</factory>
|
</factory>
|
||||||
<factory
|
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.RetargettableActionAdapterFactory"
|
|
||||||
adaptableType="org.eclipse.ui.views.contentoutline.ContentOutline">
|
|
||||||
<adapter
|
|
||||||
type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget">
|
|
||||||
</adapter>
|
|
||||||
</factory>
|
|
||||||
<factory
|
<factory
|
||||||
class="org.eclipse.cdt.debug.internal.ui.CBreakpointWorkbenchAdapterFactory"
|
class="org.eclipse.cdt.debug.internal.ui.CBreakpointWorkbenchAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
adaptableType="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||||
|
@ -1904,4 +1888,29 @@
|
||||||
</breakpointLabels>
|
</breakpointLabels>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
<extension point="org.eclipse.debug.ui.toggleBreakpointsTargetFactories">
|
||||||
|
<toggleTargetFactory
|
||||||
|
id="org.eclipse.cdt.debug.ui.ToggleCBreakpointsTargetFactory"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleCBreakpointsTargetFactory">
|
||||||
|
<enablement>
|
||||||
|
<!-- Enable the breakpoint toggle for CDT's editors and model elements -->
|
||||||
|
<or>
|
||||||
|
<instanceof value="org.eclipse.cdt.internal.ui.editor.CEditor"/>
|
||||||
|
<instanceof value="org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor"/>
|
||||||
|
<instanceof value="org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView"/>
|
||||||
|
<with variable="selection">
|
||||||
|
<count value="1"/>
|
||||||
|
<iterate>
|
||||||
|
<or>
|
||||||
|
<instanceof value="org.eclipse.cdt.core.model.IFunction"/>
|
||||||
|
<instanceof value="org.eclipse.cdt.core.model.IMethod"/>
|
||||||
|
<instanceof value="org.eclipse.cdt.core.model.IVariable"/>
|
||||||
|
</or>
|
||||||
|
</iterate>
|
||||||
|
</with>
|
||||||
|
</or>
|
||||||
|
</enablement>
|
||||||
|
</toggleTargetFactory>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -125,3 +125,5 @@ AddRegisterGroupActionDelegate.1=Error(s) occurred adding register group.
|
||||||
EditRegisterGroupActionDelegate.0=Unable to edit register group.
|
EditRegisterGroupActionDelegate.0=Unable to edit register group.
|
||||||
AddEventBreakpointActionDelegate.0=Error adding Event Breakpoint
|
AddEventBreakpointActionDelegate.0=Error adding Event Breakpoint
|
||||||
AddEventBreakpointActionDelegate.2=Action is not supported by installed debuggers
|
AddEventBreakpointActionDelegate.2=Action is not supported by installed debuggers
|
||||||
|
ToggleCBreakpointsTargetFactory.CBreakpointDescription=Standard C/C++ breakpoint type.
|
||||||
|
ToggleCBreakpointsTargetFactory.CBreakpointName=C/C++ Breakpoints
|
||||||
|
|
|
@ -1,45 +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.actions;
|
|
||||||
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
|
||||||
import org.eclipse.ui.IEditorPart;
|
|
||||||
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
|
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
|
||||||
|
|
||||||
public class ManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
|
|
||||||
|
|
||||||
private ToggleBreakpointRulerAction fTargetAction;
|
|
||||||
private IEditorPart fActiveEditor;
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
|
|
||||||
*/
|
|
||||||
public IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo ) {
|
|
||||||
fTargetAction = new ToggleBreakpointRulerAction( editor, rulerInfo );
|
|
||||||
return fTargetAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (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 ( fActiveEditor != null ) {
|
|
||||||
if ( fTargetAction != null ) {
|
|
||||||
fTargetAction.dispose();
|
|
||||||
fTargetAction = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fActiveEditor = targetEditor;
|
|
||||||
super.setActiveEditor( callerAction, targetEditor );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,115 +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 183291
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.ui.IEditorPart;
|
|
||||||
import org.eclipse.ui.IObjectActionDelegate;
|
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
|
||||||
import org.eclipse.ui.actions.ActionDelegate;
|
|
||||||
import org.eclipse.ui.part.IContributedContentsView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The delegate of the "Toggle Function Breakpoint" action.
|
|
||||||
*/
|
|
||||||
public class ManageFunctionBreakpointActionDelegate extends ActionDelegate implements IObjectActionDelegate {
|
|
||||||
|
|
||||||
private ToggleBreakpointAdapter fBreakpointAdapter;
|
|
||||||
|
|
||||||
private IWorkbenchPart fTargetPart;
|
|
||||||
|
|
||||||
private ISelection fSelection;
|
|
||||||
|
|
||||||
public ManageFunctionBreakpointActionDelegate() {
|
|
||||||
fBreakpointAdapter = new ToggleBreakpointAdapter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*(non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
|
|
||||||
*/
|
|
||||||
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
|
|
||||||
fTargetPart = targetPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*(non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
|
||||||
*/
|
|
||||||
public void run( IAction action ) {
|
|
||||||
try {
|
|
||||||
getBreakpointAdapter().toggleMethodBreakpoints( getTargetPart(), getSelection() );
|
|
||||||
}
|
|
||||||
catch( CoreException e ) {
|
|
||||||
ErrorDialog.openError( getTargetPart().getSite().getShell(),
|
|
||||||
ActionMessages.getString( "ManageFunctionBreakpointActionDelegate.Error_1" ), //$NON-NLS-1$
|
|
||||||
ActionMessages.getString( "ManageFunctionBreakpointActionDelegate.Operation_failed_1" ), //$NON-NLS-1$
|
|
||||||
e.getStatus() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*(non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged( IAction action, ISelection selection ) {
|
|
||||||
setSelection( selection );
|
|
||||||
action.setEnabled( getBreakpointAdapter().canToggleMethodBreakpoints( getTargetPart(), getSelection() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
private IWorkbenchPart getTargetPart() {
|
|
||||||
return fTargetPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ISelection getSelection() {
|
|
||||||
return fSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IToggleBreakpointsTarget getBreakpointAdapter() {
|
|
||||||
IToggleBreakpointsTarget targetAdapter = null;
|
|
||||||
if (fTargetPart != null) {
|
|
||||||
IResource resource = (IResource) fTargetPart.getAdapter(IResource.class);
|
|
||||||
if (resource == null && fTargetPart instanceof IEditorPart) {
|
|
||||||
resource = (IResource) ((IEditorPart)fTargetPart).getEditorInput().getAdapter(IResource.class);
|
|
||||||
}
|
|
||||||
if (resource == null) {
|
|
||||||
// in case of outline view
|
|
||||||
IContributedContentsView contentsView = (IContributedContentsView) fTargetPart.getAdapter(IContributedContentsView.class);
|
|
||||||
if (contentsView != null) {
|
|
||||||
IWorkbenchPart contributingPart = contentsView.getContributingPart();
|
|
||||||
if (contributingPart != null) {
|
|
||||||
resource = (IResource) contributingPart.getAdapter(IResource.class);
|
|
||||||
if (resource == null && contributingPart instanceof IEditorPart) {
|
|
||||||
resource = (IResource) ((IEditorPart)contributingPart).getEditorInput().getAdapter(IResource.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (resource != null) {
|
|
||||||
targetAdapter = (IToggleBreakpointsTarget)resource.getAdapter(IToggleBreakpointsTarget.class);
|
|
||||||
}
|
|
||||||
if (targetAdapter == null) {
|
|
||||||
targetAdapter = (IToggleBreakpointsTarget)fTargetPart.getAdapter(IToggleBreakpointsTarget.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (targetAdapter == null) {
|
|
||||||
targetAdapter = fBreakpointAdapter;
|
|
||||||
}
|
|
||||||
return targetAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSelection( ISelection selection ) {
|
|
||||||
fSelection = selection;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
import org.eclipse.debug.ui.actions.IRunToLineTarget;
|
import org.eclipse.debug.ui.actions.IRunToLineTarget;
|
||||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates adapters for retargettable actions in debug platform.
|
* Creates adapters for retargettable actions in debug platform.
|
||||||
|
@ -25,9 +24,6 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory {
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||||
*/
|
*/
|
||||||
public Object getAdapter( Object adaptableObject, Class adapterType ) {
|
public Object getAdapter( Object adaptableObject, Class adapterType ) {
|
||||||
if ( adapterType == IToggleBreakpointsTarget.class ) {
|
|
||||||
return new ToggleBreakpointAdapter();
|
|
||||||
}
|
|
||||||
if ( adapterType == IRunToLineTarget.class ) {
|
if ( adapterType == IRunToLineTarget.class ) {
|
||||||
return new RunToLineAdapter();
|
return new RunToLineAdapter();
|
||||||
}
|
}
|
||||||
|
@ -44,6 +40,6 @@ public class RetargettableActionAdapterFactory implements IAdapterFactory {
|
||||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
||||||
*/
|
*/
|
||||||
public Class[] getAdapterList() {
|
public Class[] getAdapterList() {
|
||||||
return new Class[]{ IRunToLineTarget.class, IToggleBreakpointsTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
|
return new Class[]{ IRunToLineTarget.class, IResumeAtLineTarget.class, IMoveToLineTarget.class };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,168 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004, 2007 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 183291
|
|
||||||
*******************************************************************************/
|
|
||||||
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.views.disassembly.DisassemblyView;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
|
||||||
import org.eclipse.core.runtime.IAdapterManager;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
|
||||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
|
||||||
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.TextSelection;
|
|
||||||
import org.eclipse.jface.text.source.IVerticalRulerInfo;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.ui.IEditorPart;
|
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
|
||||||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
|
||||||
|
|
||||||
public class ToggleBreakpointRulerAction extends Action {
|
|
||||||
|
|
||||||
static class EmptySelection implements ISelection {
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IVerticalRulerInfo fRuler;
|
|
||||||
private IWorkbenchPart fTargetPart;
|
|
||||||
private IToggleBreakpointsTarget fTargetAdapter;
|
|
||||||
private static final ISelection EMPTY_SELECTION = new EmptySelection();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for ToggleBreakpointRulerAction.
|
|
||||||
*
|
|
||||||
* @param ruler
|
|
||||||
* @param editor
|
|
||||||
*/
|
|
||||||
public ToggleBreakpointRulerAction( IWorkbenchPart part, IVerticalRulerInfo ruler ) {
|
|
||||||
super( ActionMessages.getString( "ToggleBreakpointRulerAction.Toggle_Breakpoint_1" ) ); //$NON-NLS-1$
|
|
||||||
fRuler = ruler;
|
|
||||||
setTargetPart( part );
|
|
||||||
part.getSite().getWorkbenchWindow().getWorkbench().getHelpSystem().setHelp( this, ICDebugHelpContextIds.TOGGLE_BREAKPOINT_ACTION );
|
|
||||||
setId( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disposes this action
|
|
||||||
*/
|
|
||||||
public void dispose() {
|
|
||||||
setTargetPart( null );
|
|
||||||
fRuler = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Action#run()
|
|
||||||
*/
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
fTargetAdapter.toggleLineBreakpoints( getTargetPart(), getTargetSelection() );
|
|
||||||
}
|
|
||||||
catch( CoreException e ) {
|
|
||||||
ErrorDialog.openError( getTargetPart().getSite().getShell(),
|
|
||||||
ActionMessages.getString( "ToggleBreakpointRulerAction.Error_1" ), //$NON-NLS-1$
|
|
||||||
ActionMessages.getString( "ToggleBreakpointRulerAction.Operation_failed_1" ), //$NON-NLS-1$
|
|
||||||
e.getStatus() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns this action's vertical ruler info.
|
|
||||||
*
|
|
||||||
* @return this action's vertical ruler
|
|
||||||
*/
|
|
||||||
protected IVerticalRulerInfo getVerticalRulerInfo() {
|
|
||||||
return fRuler;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IWorkbenchPart getTargetPart() {
|
|
||||||
return this.fTargetPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setTargetPart( IWorkbenchPart targetPart ) {
|
|
||||||
this.fTargetPart = targetPart;
|
|
||||||
if (fTargetPart != null) {
|
|
||||||
IResource resource = (IResource) fTargetPart.getAdapter(IResource.class);
|
|
||||||
if (resource == null && fTargetPart instanceof IEditorPart) {
|
|
||||||
resource = (IResource) ((IEditorPart)fTargetPart).getEditorInput().getAdapter(IResource.class);
|
|
||||||
}
|
|
||||||
if (resource != null) {
|
|
||||||
fTargetAdapter = getAdapter(resource);
|
|
||||||
}
|
|
||||||
if (fTargetAdapter == null) {
|
|
||||||
fTargetAdapter = getAdapter(fTargetPart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fTargetAdapter == null) {
|
|
||||||
fTargetAdapter = new ToggleBreakpointAdapter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IToggleBreakpointsTarget getAdapter(IAdaptable adaptable) {
|
|
||||||
IToggleBreakpointsTarget adapter= (IToggleBreakpointsTarget)adaptable.getAdapter(IToggleBreakpointsTarget.class);
|
|
||||||
if (adapter == null) {
|
|
||||||
IAdapterManager adapterManager= Platform.getAdapterManager();
|
|
||||||
if (adapterManager.hasAdapter(adaptable, IToggleBreakpointsTarget.class.getName())) {
|
|
||||||
adapter= (IToggleBreakpointsTarget)adapterManager.loadAdapter(adaptable, IToggleBreakpointsTarget.class.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current selection in the active part, possibly
|
|
||||||
* and empty selection, but never <code>null</code>.
|
|
||||||
*
|
|
||||||
* @return the selection in the active part, possibly empty
|
|
||||||
*/
|
|
||||||
private ISelection getTargetSelection() {
|
|
||||||
IDocument doc = getDocument();
|
|
||||||
if ( doc != null ) {
|
|
||||||
int line = getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
|
|
||||||
try {
|
|
||||||
IRegion region = doc.getLineInformation( line );
|
|
||||||
return new TextSelection( doc, region.getOffset(), region.getLength() );
|
|
||||||
}
|
|
||||||
catch( BadLocationException e ) {
|
|
||||||
DebugPlugin.log( e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EMPTY_SELECTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() );
|
|
||||||
}
|
|
||||||
else if ( targetPart instanceof DisassemblyView ) {
|
|
||||||
DisassemblyView dv = (DisassemblyView)targetPart;
|
|
||||||
IDocumentProvider provider = dv.getDocumentProvider();
|
|
||||||
if ( provider != null )
|
|
||||||
return provider.getDocument( dv.getInput() );
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2007 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.actions;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
import org.eclipse.debug.core.model.IDebugModelProvider;
|
||||||
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
|
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
||||||
|
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetFactory;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ToggleCBreakpointsTargetFactory implements IToggleBreakpointsTargetFactory {
|
||||||
|
|
||||||
|
public static String TOGGLE_C_BREAKPOINT_TARGET_ID = CDebugUIPlugin.getUniqueIdentifier() + ".toggleCBreakpointTarget"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static Set<String> TOGGLE_TARGET_IDS = new HashSet<String>(1);
|
||||||
|
static {
|
||||||
|
TOGGLE_TARGET_IDS.add(TOGGLE_C_BREAKPOINT_TARGET_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ToggleBreakpointAdapter fCToggleBreakpointTarget = new ToggleBreakpointAdapter();
|
||||||
|
|
||||||
|
public IToggleBreakpointsTarget createToggleTarget(String targetID) {
|
||||||
|
if (TOGGLE_C_BREAKPOINT_TARGET_ID.equals(targetID)) {
|
||||||
|
return fCToggleBreakpointTarget;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultToggleTarget(IWorkbenchPart part, ISelection selection) {
|
||||||
|
// Return the debug context as a default if the currently selected context
|
||||||
|
// is a CDT element. Otherwise return null.
|
||||||
|
Object element = getDebugContext(part).getFirstElement();
|
||||||
|
if (element instanceof IAdaptable) {
|
||||||
|
IDebugModelProvider modelProvider =
|
||||||
|
(IDebugModelProvider)((IAdaptable)element).getAdapter(IDebugModelProvider.class);
|
||||||
|
if (modelProvider != null) {
|
||||||
|
String[] models = modelProvider.getModelIdentifiers();
|
||||||
|
if (Arrays.asList(models).contains(CDIDebugModel.getPluginIdentifier())) {
|
||||||
|
return TOGGLE_C_BREAKPOINT_TARGET_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToggleTargetDescription(String targetID) {
|
||||||
|
return ActionMessages.getString("ToggleCBreakpointsTargetFactory.CBreakpointDescription"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToggleTargetName(String targetID) {
|
||||||
|
return ActionMessages.getString("ToggleCBreakpointsTargetFactory.CBreakpointName"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Set getToggleTargets(IWorkbenchPart part, ISelection selection) {
|
||||||
|
return TOGGLE_TARGET_IDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IStructuredSelection getDebugContext(IWorkbenchPart part) {
|
||||||
|
ISelection selection = DebugUITools.getDebugContextManager().
|
||||||
|
getContextService(part.getSite().getWorkbenchWindow()).getActiveContext();
|
||||||
|
if (selection instanceof IStructuredSelection) {
|
||||||
|
return (IStructuredSelection)selection;
|
||||||
|
}
|
||||||
|
return StructuredSelection.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,130 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004, 2007 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 183291
|
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
|
||||||
import org.eclipse.core.runtime.IAdapterManager;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
|
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.ui.IEditorPart;
|
|
||||||
import org.eclipse.ui.IObjectActionDelegate;
|
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
|
||||||
import org.eclipse.ui.actions.ActionDelegate;
|
|
||||||
import org.eclipse.ui.part.IContributedContentsView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The delegate of the "Toggle Watchpoint" action.
|
|
||||||
*/
|
|
||||||
public class ToggleWatchpointActionDelegate extends ActionDelegate implements IObjectActionDelegate {
|
|
||||||
|
|
||||||
private ToggleBreakpointAdapter fBreakpointAdapter;
|
|
||||||
|
|
||||||
private IWorkbenchPart fTargetPart;
|
|
||||||
|
|
||||||
private ISelection fSelection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for ToggleWatchpointActionDelegate.
|
|
||||||
*/
|
|
||||||
public ToggleWatchpointActionDelegate() {
|
|
||||||
fBreakpointAdapter = new ToggleBreakpointAdapter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
|
|
||||||
*/
|
|
||||||
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
|
|
||||||
fTargetPart = targetPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
|
||||||
*/
|
|
||||||
public void run( IAction action ) {
|
|
||||||
try {
|
|
||||||
getBreakpointAdapter().toggleWatchpoints( getTargetPart(), getSelection() );
|
|
||||||
}
|
|
||||||
catch( CoreException e ) {
|
|
||||||
ErrorDialog.openError( getTargetPart().getSite().getShell(),
|
|
||||||
ActionMessages.getString( "ToggleWatchpointActionDelegate.Error_1" ), //$NON-NLS-1$
|
|
||||||
ActionMessages.getString( "ToggleWatchpointActionDelegate.Operation_failed_1" ), //$NON-NLS-1$
|
|
||||||
e.getStatus() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged( IAction action, ISelection selection ) {
|
|
||||||
setSelection( selection );
|
|
||||||
action.setEnabled( getBreakpointAdapter().canToggleWatchpoints( getTargetPart(), getSelection() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
private IWorkbenchPart getTargetPart() {
|
|
||||||
return fTargetPart;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ISelection getSelection() {
|
|
||||||
return fSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IToggleBreakpointsTarget getBreakpointAdapter() {
|
|
||||||
IToggleBreakpointsTarget targetAdapter = null;
|
|
||||||
if (fTargetPart != null) {
|
|
||||||
IResource resource = (IResource) fTargetPart.getAdapter(IResource.class);
|
|
||||||
if (resource == null && fTargetPart instanceof IEditorPart) {
|
|
||||||
resource = (IResource) ((IEditorPart)fTargetPart).getEditorInput().getAdapter(IResource.class);
|
|
||||||
}
|
|
||||||
if (resource == null) {
|
|
||||||
// in case of outline view
|
|
||||||
IContributedContentsView contentsView = (IContributedContentsView) fTargetPart.getAdapter(IContributedContentsView.class);
|
|
||||||
if (contentsView != null) {
|
|
||||||
IWorkbenchPart contributingPart = contentsView.getContributingPart();
|
|
||||||
resource = (IResource) contributingPart.getAdapter(IResource.class);
|
|
||||||
if (resource == null && contributingPart instanceof IEditorPart) {
|
|
||||||
resource = (IResource) ((IEditorPart)contributingPart).getEditorInput().getAdapter(IResource.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (resource != null) {
|
|
||||||
targetAdapter = getAdapter(resource);
|
|
||||||
}
|
|
||||||
if (targetAdapter == null) {
|
|
||||||
targetAdapter = getAdapter(fTargetPart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (targetAdapter == null) {
|
|
||||||
targetAdapter = fBreakpointAdapter;
|
|
||||||
}
|
|
||||||
return targetAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IToggleBreakpointsTarget getAdapter(IAdaptable adaptable) {
|
|
||||||
IToggleBreakpointsTarget adapter= (IToggleBreakpointsTarget)adaptable.getAdapter(IToggleBreakpointsTarget.class);
|
|
||||||
if (adapter == null) {
|
|
||||||
IAdapterManager adapterManager= Platform.getAdapterManager();
|
|
||||||
if (adapterManager.hasAdapter(adaptable, IToggleBreakpointsTarget.class.getName())) {
|
|
||||||
adapter= (IToggleBreakpointsTarget)adapterManager.loadAdapter(adaptable, IToggleBreakpointsTarget.class.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSelection( ISelection selection ) {
|
|
||||||
fSelection = selection;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider;
|
||||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerAction;
|
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.actions.EnableDisableBreakpointRulerAction;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.ToggleBreakpointRulerAction;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider;
|
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.DisassemblyPane;
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider;
|
||||||
|
@ -26,9 +25,11 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
|
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
|
||||||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IRegion;
|
import org.eclipse.jface.text.IRegion;
|
||||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||||
import org.eclipse.jface.text.source.IVerticalRuler;
|
import org.eclipse.jface.text.source.IVerticalRuler;
|
||||||
|
@ -338,7 +339,7 @@ public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusa
|
||||||
|
|
||||||
protected void createActions() {
|
protected void createActions() {
|
||||||
IVerticalRuler ruler = fDisassemblyPane.getVerticalRuler();
|
IVerticalRuler ruler = fDisassemblyPane.getVerticalRuler();
|
||||||
IAction action= new ToggleBreakpointRulerAction( this, ruler );
|
IAction action= new ToggleBreakpointAction( this, null, ruler );
|
||||||
setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action );
|
setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action );
|
||||||
action= new EnableDisableBreakpointRulerAction( this, ruler );
|
action= new EnableDisableBreakpointRulerAction( this, ruler );
|
||||||
setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action );
|
setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action );
|
||||||
|
@ -352,4 +353,12 @@ public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusa
|
||||||
public void propertyChange( PropertyChangeEvent event ) {
|
public void propertyChange( PropertyChangeEvent event ) {
|
||||||
getViewer().refresh();
|
getViewer().refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getAdapter(Class adapter) {
|
||||||
|
if (IDocument.class.equals(adapter)) {
|
||||||
|
return getDocumentProvider().getDocument(getEditorInput());
|
||||||
|
}
|
||||||
|
return super.getAdapter(adapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.CBreakpointPropertiesRulerAction;
|
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.actions.EnableDisableBreakpointRulerAction;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.ToggleBreakpointRulerAction;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||||
|
@ -37,6 +36,7 @@ import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.model.IThread;
|
import org.eclipse.debug.core.model.IThread;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuListener;
|
import org.eclipse.jface.action.IMenuListener;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
@ -46,6 +46,7 @@ import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IRegion;
|
import org.eclipse.jface.text.IRegion;
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
import org.eclipse.jface.text.TextPresentation;
|
import org.eclipse.jface.text.TextPresentation;
|
||||||
|
@ -304,7 +305,7 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
|
||||||
protected void createActions() {
|
protected void createActions() {
|
||||||
IAction action;
|
IAction action;
|
||||||
IVerticalRuler ruler = getVerticalRuler();
|
IVerticalRuler ruler = getVerticalRuler();
|
||||||
action= new ToggleBreakpointRulerAction( this, ruler );
|
action= new ToggleBreakpointAction( this, null, ruler );
|
||||||
setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action );
|
setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action );
|
||||||
action= new EnableDisableBreakpointRulerAction( this, ruler );
|
action= new EnableDisableBreakpointRulerAction( this, ruler );
|
||||||
setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action );
|
setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action );
|
||||||
|
@ -962,4 +963,12 @@ public class DisassemblyView extends AbstractDebugEventHandlerView
|
||||||
}
|
}
|
||||||
super.partDeactivated( part );
|
super.partDeactivated( part );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getAdapter(Class adapter) {
|
||||||
|
if (IDocument.class.equals(adapter)) {
|
||||||
|
return getDocumentProvider().getDocument(getInput());
|
||||||
|
}
|
||||||
|
return super.getAdapter(adapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue