mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Added support for breakpoint actions to the disassembly editor.
This commit is contained in:
parent
e9ac88667a
commit
887a1ea83e
1 changed files with 22 additions and 21 deletions
|
@ -73,7 +73,28 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
|
||||||
*/
|
*/
|
||||||
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
|
||||||
String errorMessage = null;
|
String errorMessage = null;
|
||||||
if ( part instanceof ITextEditor ) {
|
// Check for DisassemblyEditor first because it implements ITextEditor
|
||||||
|
if ( part instanceof DisassemblyEditor && selection instanceof ITextSelection ) {
|
||||||
|
DisassemblyEditor editor = (DisassemblyEditor)part;
|
||||||
|
int lineNumber = ((ITextSelection)selection).getStartLine();
|
||||||
|
if ( lineNumber != -1 ) {
|
||||||
|
IEditorInput input = editor.getEditorInput();
|
||||||
|
if ( input != null ) {
|
||||||
|
VirtualDocument document = (VirtualDocument)editor.getDocumentProvider().getDocument( input );
|
||||||
|
if ( document != null ) {
|
||||||
|
IPresentationContext presentationContext = document.getPresentationContext();
|
||||||
|
Object element = document.getElementAtLine( lineNumber );
|
||||||
|
if ( element != null ) {
|
||||||
|
IElementToggleBreakpointAdapter adapter = getToggleBreakpointAdapter( element );
|
||||||
|
if ( adapter != null ) {
|
||||||
|
adapter.toggleLineBreakpoints( presentationContext, element );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( part instanceof ITextEditor ) {
|
||||||
ITextEditor textEditor = (ITextEditor)part;
|
ITextEditor textEditor = (ITextEditor)part;
|
||||||
IEditorInput input = textEditor.getEditorInput();
|
IEditorInput input = textEditor.getEditorInput();
|
||||||
if ( input == null ) {
|
if ( input == null ) {
|
||||||
|
@ -155,26 +176,6 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if ( part instanceof DisassemblyEditor && selection instanceof ITextSelection ) {
|
|
||||||
DisassemblyEditor editor = (DisassemblyEditor)part;
|
|
||||||
int lineNumber = ((ITextSelection)selection).getStartLine();
|
|
||||||
if ( lineNumber != -1 ) {
|
|
||||||
IEditorInput input = editor.getEditorInput();
|
|
||||||
if ( input != null ) {
|
|
||||||
VirtualDocument document = (VirtualDocument)editor.getDocumentProvider().getDocument( input );
|
|
||||||
if ( document != null ) {
|
|
||||||
IPresentationContext presentationContext = document.getPresentationContext();
|
|
||||||
Object element = document.getElementAtLine( lineNumber );
|
|
||||||
if ( element != null ) {
|
|
||||||
IElementToggleBreakpointAdapter adapter = getToggleBreakpointAdapter( element );
|
|
||||||
if ( adapter != null ) {
|
|
||||||
adapter.toggleLineBreakpoints( presentationContext, element );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
|
errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue