From cde61d654485d0f9e8568a5c89d3609fdda08195 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Fri, 12 Mar 2010 20:15:32 +0000 Subject: [PATCH] [305533] Removed old disassembly view from codebase --- .../META-INF/MANIFEST.MF | 1 - debug/org.eclipse.cdt.debug.ui/plugin.xml | 98 -- .../cdt/debug/internal/ui/CDebugUIUtils.java | 2 +- .../AbstractBreakpointRulerAction.java | 18 +- .../ui/actions/MoveToLineAdapter.java | 46 - .../ui/actions/ResumeAtLineAdapter.java | 46 - .../internal/ui/actions/RunToLineAdapter.java | 46 - .../ui/actions/ToggleBreakpointAdapter.java | 66 +- .../DisassemblyAnnotationModel.java | 2 +- .../rendering}/DisassemblyEditorInput.java | 2 +- .../rendering/DisassemblyMemoryRendering.java | 1 - .../rendering}/DisassemblyMessages.java | 2 +- .../rendering/DisassemblyMessages.properties | 0 .../adapters/CDebugElementAdapterFactory.java | 6 - .../DisassemblyElementAnnotationProvider.java | 120 --- .../DisassemblyAnnotationHover.java | 145 --- .../DisassemblyDocumentProvider.java | 189 ---- ...sassemblyInstructionPointerAnnotation.java | 81 -- .../DisassemblyMessages.properties | 18 - .../ui/views/disassembly/DisassemblyView.java | 981 ------------------ .../DisassemblyViewEventHandler.java | 85 -- .../views/disassembly/DisassemblyViewer.java | 60 -- .../DisassemblyViewerConfiguration.java | 52 - .../GoToAddressActionDelegate.java | 134 --- .../disassembly/IDisassemblyListener.java | 32 - 25 files changed, 8 insertions(+), 2225 deletions(-) rename debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/{views/disassembly => disassembly/rendering}/DisassemblyAnnotationModel.java (99%) rename debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/{views/disassembly => disassembly/rendering}/DisassemblyEditorInput.java (99%) rename debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/{views/disassembly => disassembly/rendering}/DisassemblyMessages.java (94%) create mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementAnnotationProvider.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationHover.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyDocumentProvider.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyInstructionPointerAnnotation.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.properties delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewEventHandler.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewer.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewerConfiguration.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/GoToAddressActionDelegate.java delete mode 100644 debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/IDisassemblyListener.java diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF index 29915e4704b..e9dcb8bad85 100644 --- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF @@ -16,7 +16,6 @@ Export-Package: org.eclipse.cdt.debug.internal.ui.propertypages;x-internal:=true, org.eclipse.cdt.debug.internal.ui.sourcelookup;x-friends:="org.eclipse.cdt.dsf.ui", org.eclipse.cdt.debug.internal.ui.views;x-internal:=true, - org.eclipse.cdt.debug.internal.ui.views.disassembly;x-internal:=true, org.eclipse.cdt.debug.internal.ui.views.executables;x-internal:=true, org.eclipse.cdt.debug.internal.ui.views.modules;x-internal:=true, org.eclipse.cdt.debug.internal.ui.views.signals;x-internal:=true, diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 81473483b54..eb022da2d3e 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -834,41 +834,6 @@ - - - - - - - - - - - @@ -1057,23 +1022,6 @@ tooltip="%AddEventBreakpoint.tooltip"> - - - - - - @@ -1412,15 +1360,6 @@ - - - - - - @@ -1786,43 +1725,6 @@ - - - - - - - - - - - - iterator = annotationModel.getAnnotationIterator(); while (iterator.hasNext()) { Object object = iterator.next(); if (object instanceof SimpleMarkerAnnotation) { @@ -116,12 +116,6 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU 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; } @@ -133,12 +127,6 @@ public abstract class AbstractBreakpointRulerAction extends Action implements IU if ( provider != null ) return provider.getAnnotationModel( textEditor.getEditorInput() ); } - else if ( targetPart instanceof DisassemblyView ) { - DisassemblyView dv = (DisassemblyView)targetPart; - IDocumentProvider provider = dv.getDocumentProvider(); - if ( provider != null ) - return provider.getAnnotationModel( dv.getInput() ); - } return null; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java index 32d0ff38a01..04a8af63761 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/MoveToLineAdapter.java @@ -11,18 +11,14 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.actions; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.model.IMoveToAddress; import org.eclipse.cdt.debug.core.model.IMoveToLine; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.model.CDebugElement; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -95,35 +91,6 @@ public class MoveToLineAdapter implements IMoveToLineTarget { } } } - else if ( part instanceof DisassemblyView ) { - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - errorMessage = ActionMessages.getString( "MoveToLineAdapter.2" ); //$NON-NLS-1$ - } - else { - ITextSelection textSelection = (ITextSelection)selection; - int lineNumber = textSelection.getStartLine() + 1; - final IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - if ( address != null && target instanceof IAdaptable ) { - final IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter( IMoveToAddress.class ); - if ( moveToAddress != null && moveToAddress.canMoveToAddress( address ) ) { - Runnable r = new Runnable() { - - public void run() { - try { - moveToAddress.moveToAddress( address ); - } - catch( DebugException e ) { - failed( e ); - } - } - }; - runInBackground( r ); - } - } - return; - } - } else { errorMessage = ActionMessages.getString( "MoveToLineAdapter.3" ); //$NON-NLS-1$ } @@ -172,19 +139,6 @@ public class MoveToLineAdapter implements IMoveToLineTarget { int lineNumber = textSelection.getStartLine() + 1; return moveToLine.canMoveToLine(path.toPortableString(), lineNumber ); } - if ( part instanceof DisassemblyView ) { - IMoveToAddress moveToAddress = (IMoveToAddress)((IAdaptable)target).getAdapter( IMoveToAddress.class ); - if ( moveToAddress == null ) - return false; - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - return false; - } - ITextSelection textSelection = (ITextSelection)selection; - int lineNumber = textSelection.getStartLine() + 1; - IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - return moveToAddress.canMoveToAddress( address ); - } } return false; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java index 7c12420a1a3..0a41a1ba817 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineAdapter.java @@ -11,18 +11,14 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.actions; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.model.IResumeAtAddress; import org.eclipse.cdt.debug.core.model.IResumeAtLine; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.model.CDebugElement; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -94,35 +90,6 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget { } } } - else if ( part instanceof DisassemblyView ) { - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - errorMessage = ActionMessages.getString( "ResumeAtLineAdapter.2" ); //$NON-NLS-1$ - } - else { - ITextSelection textSelection = (ITextSelection)selection; - int lineNumber = textSelection.getStartLine() + 1; - final IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - if ( address != null && target instanceof IAdaptable ) { - final IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter( IResumeAtAddress.class ); - if ( resumeAtAddress != null && resumeAtAddress.canResumeAtAddress( address ) ) { - Runnable r = new Runnable() { - - public void run() { - try { - resumeAtAddress.resumeAtAddress( address ); - } - catch( DebugException e ) { - failed( e ); - } - } - }; - runInBackground( r ); - } - } - return; - } - } else { errorMessage = ActionMessages.getString( "ResumeAtLineAdapter.3" ); //$NON-NLS-1$ } @@ -170,19 +137,6 @@ public class ResumeAtLineAdapter implements IResumeAtLineTarget { int lineNumber = textSelection.getStartLine() + 1; return resumeAtLine.canResumeAtLine( path.toPortableString(), lineNumber ); } - if ( part instanceof DisassemblyView ) { - IResumeAtAddress resumeAtAddress = (IResumeAtAddress)((IAdaptable)target).getAdapter( IResumeAtAddress.class ); - if ( resumeAtAddress == null ) - return false; - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - return false; - } - ITextSelection textSelection = (ITextSelection)selection; - int lineNumber = textSelection.getStartLine() + 1; - IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - return resumeAtAddress.canResumeAtAddress( address ); - } } return false; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java index df774f324b2..678bb952925 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java @@ -11,18 +11,14 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.actions; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; -import org.eclipse.cdt.debug.core.model.IRunToAddress; import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.model.CDebugElement; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector; import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -98,35 +94,6 @@ public class RunToLineAdapter implements IRunToLineTarget { } } } - else if ( part instanceof DisassemblyView ) { - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - errorMessage = ActionMessages.getString( "RunToLineAdapter.Empty_editor_1" ); //$NON-NLS-1$ - } - else { - ITextSelection textSelection = (ITextSelection)selection; - int lineNumber = textSelection.getStartLine() + 1; - final IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - if ( address != null && target instanceof IAdaptable ) { - final IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class ); - if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) { - Runnable r = new Runnable() { - - public void run() { - try { - runToAddress.runToAddress( address, DebugUITools.getPreferenceStore().getBoolean( IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE ) ); - } - catch( DebugException e ) { - failed( e ); - } - } - }; - runInBackground( r ); - } - } - return; - } - } else { errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$ } @@ -174,19 +141,6 @@ public class RunToLineAdapter implements IRunToLineTarget { int lineNumber = textSelection.getStartLine() + 1; return runToLine.canRunToLine( path.toPortableString(), lineNumber ); } - if ( part instanceof DisassemblyView ) { - IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class ); - if ( runToAddress == null ) - return false; - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - return false; - } - ITextSelection textSelection = (ITextSelection)selection; - int lineNumber = textSelection.getStartLine() + 1; - IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - return runToAddress.canRunToAddress( address ); - } } return false; } 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 2f889f5d3b7..a7651dc51e8 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 @@ -13,7 +13,6 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.ui.actions; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.ICElement; @@ -33,8 +32,6 @@ import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils; import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; import org.eclipse.cdt.debug.internal.ui.disassembly.editor.DisassemblyEditor; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.disassembly.IElementToggleBreakpointAdapter; import org.eclipse.cdt.internal.ui.util.ExternalEditorInput; @@ -47,7 +44,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; -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; @@ -147,47 +143,6 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio } } } - else if ( part instanceof DisassemblyView ) { - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) ) { - errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Empty_editor_1" ); //$NON-NLS-1$ - } - else { - BreakpointLocationVerifier bv = new BreakpointLocationVerifier(); - int lineNumber = bv.getValidAddressBreakpointLocation( null, ((ITextSelection)selection).getStartLine() ); - if ( lineNumber == -1 ) { - errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ - } - else { - IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); - if ( address == null ) { - errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ - } - else { - ICLineBreakpoint breakpoint = ((DisassemblyEditorInput)input).breakpointExists( address ); - if ( breakpoint != null ) { - DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true ); - } - else { - String module = ((DisassemblyEditorInput)input).getModuleFile(); - IResource resource = getAddressBreakpointResource( ((DisassemblyEditorInput)input).getSourceFile() ); - String sourceHandle = getSourceHandle( input ); - CDIDebugModel.createAddressBreakpoint( module, - sourceHandle, - resource, - ICBreakpointType.REGULAR, - ((DisassemblyEditorInput)input).getSourceLine( lineNumber ), - address, - true, - 0, - "", //$NON-NLS-1$ - true ); - } - return; - } - } - } - } else { errorMessage = ActionMessages.getString( "RunToLineAdapter.Operation_is_not_supported_1" ); //$NON-NLS-1$ } @@ -198,14 +153,7 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ public boolean canToggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) { - if ( part instanceof DisassemblyView ) { - IEditorInput input = ((DisassemblyView)part).getInput(); - if ( !(input instanceof DisassemblyEditorInput) || - ((DisassemblyEditorInput)input).equals( DisassemblyEditorInput.EMPTY_EDITOR_INPUT ) ) { - return false; - } - } - else if ( part instanceof DisassemblyEditor && selection instanceof ITextSelection ) { + if ( part instanceof DisassemblyEditor && selection instanceof ITextSelection ) { DisassemblyEditor editor = (DisassemblyEditor)part; int lineNumber = ((ITextSelection)selection).getStartLine(); if ( lineNumber != -1 ) { @@ -516,18 +464,6 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTargetExtensio } } - private IResource getAddressBreakpointResource( String fileName ) { - if ( fileName != null ) { - IPath path = new Path( fileName ); - if ( path.isValidPath( fileName ) ) { - IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path ); - if ( files.length > 0 ) - return files[0]; - } - } - return ResourcesPlugin.getWorkspace().getRoot(); - } - private IElementToggleBreakpointAdapter getToggleBreakpointAdapter( Object element ) { IElementToggleBreakpointAdapter adapter = null; if ( element instanceof IElementToggleBreakpointAdapter ) { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationModel.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java similarity index 99% rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationModel.java rename to debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java index 3400bdd6583..72884bf2cc7 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationModel.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyAnnotationModel.java @@ -8,7 +8,7 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.disassembly; +package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; import java.util.ArrayList; import java.util.Iterator; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java similarity index 99% rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java rename to debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java index 8688250eac9..962a62a215e 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyEditorInput.java @@ -8,7 +8,7 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.disassembly; +package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; import java.util.Arrays; import org.eclipse.cdt.core.IAddress; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java index dbed2cfa8d8..eb387f27f02 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMemoryRendering.java @@ -15,7 +15,6 @@ import org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextProvider; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualSourceViewer; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyAnnotationModel; import org.eclipse.cdt.debug.ui.disassembly.IDocumentPresentation; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.debug.core.model.IMemoryBlock; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java similarity index 94% rename from debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.java rename to debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java index 023dd7cde61..1c0aa47d637 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.java @@ -8,7 +8,7 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.disassembly; +package org.eclipse.cdt.debug.internal.ui.disassembly.rendering; import java.util.MissingResourceException; import java.util.ResourceBundle; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/rendering/DisassemblyMessages.properties new file mode 100644 index 00000000000..e69de29bb2d diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java index cd0392f9964..4aa9052aa0e 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/CDebugElementAdapterFactory.java @@ -51,7 +51,6 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { private static IDisassemblyContextProvider fgDisassemblyContextProvider = new CDisassemblyContextProvider(); private static IDocumentElementContentProvider fgDisassemblyContentProvider = new DisassemblyElementContentProvider(); private static IDocumentElementLabelProvider fgDisassemblyLabelProvider = new DisassemblyElementLabelProvider(); - private static IDocumentElementAnnotationProvider fgDisassemblyAnnotationProvider = new DisassemblyElementAnnotationProvider(); private static IElementToggleBreakpointAdapter fgDisassemblyToggleBreakpointAdapter = new DisassemblyToggleBreakpointAdapter(); private static ISourceDisplay fgSourceDisplayAdapter = new SourceDisplayAdapter(); @@ -121,11 +120,6 @@ public class CDebugElementAdapterFactory implements IAdapterFactory { return fgDisassemblyLabelProvider; } } - if ( adapterType.equals( IDocumentElementAnnotationProvider.class ) ) { - if ( adaptableObject instanceof IDisassemblyLine ) { - return fgDisassemblyAnnotationProvider; - } - } if ( adapterType.equals( IElementToggleBreakpointAdapter.class ) ) { if ( adaptableObject instanceof IDisassemblyLine ) { return fgDisassemblyToggleBreakpointAdapter; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementAnnotationProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementAnnotationProvider.java deleted file mode 100644 index c122c97c7ff..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/elements/adapters/DisassemblyElementAnnotationProvider.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 ARM Limited 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: - * ARM Limited - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.debug.internal.ui.elements.adapters; - -import java.math.BigInteger; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction; -import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; -import org.eclipse.cdt.debug.internal.core.model.DisassemblyRetrieval; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyInstructionPointerAnnotation; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationProvider; -import org.eclipse.cdt.debug.ui.disassembly.IDocumentElementAnnotationUpdate; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.ui.texteditor.MarkerAnnotation; - -public class DisassemblyElementAnnotationProvider implements IDocumentElementAnnotationProvider { - - /* (non-Javadoc) - * @see com.arm.eclipse.rvd.ui.disassembly.IDocumentElementAnnotationProvider#update(com.arm.eclipse.rvd.ui.disassembly.IDocumentElementAnnotationUpdate[]) - */ - public void update( final IDocumentElementAnnotationUpdate[] updates ) { - Job job = new Job( "Annotations update" ) { //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ - @Override - protected IStatus run( IProgressMonitor monitor ) { - for( int i = 0; i < updates.length; i++ ) { - IDocumentElementAnnotationUpdate update = updates[i]; - if ( !update.isCanceled() ) { - retrieveAnnotations( update ); - } - update.done(); - } - return Status.OK_STATUS; - } - }; - job.setSystem( true ); - job.schedule(); - } - - protected void retrieveAnnotations( IDocumentElementAnnotationUpdate update ) { - retrieveInstructionPointers( update ); - retrieveBreakpoints( update ); - } - - private void retrieveInstructionPointers( IDocumentElementAnnotationUpdate update ) { - Object root = update.getRootElement(); - if ( root instanceof DisassemblyRetrieval ) { - DisassemblyRetrieval retrieval = (DisassemblyRetrieval)root; - Object input = retrieval.getInput(); - if ( input instanceof ICStackFrame ) { - Object element = update.getElement(); - if ( element instanceof IDisassemblyInstruction ) { - BigInteger address = ((IDisassemblyInstruction)element).getAdress().getValue(); - ICStackFrame frame = (ICStackFrame)input; - IAddress frameAddress = frame.getAddress(); // will return null if frame has been disposed - if ( (frameAddress != null) && address.equals( frameAddress.getValue() ) ) { - IThread thread = frame.getThread(); - boolean topFrame; - try { - topFrame = ( frame == thread.getTopStackFrame() ); - update.addAnnotation( new DisassemblyInstructionPointerAnnotation( frame, topFrame ) ); - } - catch( DebugException e ) { - } - } - } - } - } - } - - private void retrieveBreakpoints( IDocumentElementAnnotationUpdate update ) { - IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints( CDebugCorePlugin.getUniqueIdentifier() ); - for ( IBreakpoint b : breakpoints ) { - if ( b instanceof ICLineBreakpoint ) { - try { - Object root = update.getRootElement(); - if ( root instanceof DisassemblyRetrieval ) { - Object element = update.getElement(); - if ( element instanceof IDisassemblyInstruction ) { - IDisassemblyInstruction instruction = (IDisassemblyInstruction)element; - BigInteger address = ((CDebugTarget)((DisassemblyRetrieval)root).getDebugTarget()).getBreakpointAddress( (ICLineBreakpoint)b ).getValue(); - BigInteger instrAddress = instruction.getAdress().getValue(); - if ( address != null && instrAddress != null && instrAddress.compareTo( address ) == 0 ) { - update.addAnnotation( new MarkerAnnotation( b.getMarker() ) ); - } - } - } - } - catch( CoreException e ) { - } - catch( NumberFormatException e ) { - } - } - } - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationHover.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationHover.java deleted file mode 100644 index 6e4e07d0735..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyAnnotationHover.java +++ /dev/null @@ -1,145 +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.views.disassembly; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.debug.internal.ui.HTMLPrinter; -import org.eclipse.core.resources.IMarker; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.ui.texteditor.MarkerAnnotation; - -/** - * Annotation hovering support for disassembly view. - */ -public class DisassemblyAnnotationHover implements IAnnotationHover { - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.source.IAnnotationHover#getHoverInfo(org.eclipse.jface.text.source.ISourceViewer, int) - */ - public String getHoverInfo( ISourceViewer sourceViewer, int lineNumber ) { - List markers = getMarkersForLine( sourceViewer, lineNumber ); - if ( markers != null ) { - if ( markers.size() == 1 ) { - // optimization - IMarker marker = (IMarker)markers.get( 0 ); - String message = marker.getAttribute( IMarker.MESSAGE, (String)null ); - if ( message != null && message.trim().length() > 0 ) - return formatSingleMessage( message ); - } - else { - List messages = new ArrayList(); - Iterator e = markers.iterator(); - while( e.hasNext() ) { - IMarker marker = (IMarker)e.next(); - String message = marker.getAttribute( IMarker.MESSAGE, (String)null ); - if ( message != null && message.trim().length() > 0 ) - messages.add( message.trim() ); - } - if ( messages.size() == 1 ) - return formatSingleMessage( (String)messages.get( 0 ) ); - if ( messages.size() > 1 ) - return formatMultipleMessages( messages ); - } - } - return null; - } - - /** - * Returns the distance to the ruler line. - */ - protected int compareRulerLine( Position position, IDocument document, int line ) { - if ( position.getOffset() > -1 && position.getLength() > -1 ) { - try { - int markerLine = document.getLineOfOffset( position.getOffset() ); - if ( line == markerLine ) - return 1; - if ( markerLine <= line && line <= document.getLineOfOffset( position.getOffset() + position.getLength() ) ) - return 2; - } - catch( BadLocationException x ) { - } - } - return 0; - } - - /* - * Formats a message as HTML text. - */ - private String formatSingleMessage( String message ) { - StringBuffer buffer = new StringBuffer(); - HTMLPrinter.addPageProlog( buffer ); - HTMLPrinter.addParagraph( buffer, HTMLPrinter.convertToHTMLContent( message ) ); - HTMLPrinter.addPageEpilog( buffer ); - return buffer.toString(); - } - - /* - * Formats several message as HTML text. - */ - private String formatMultipleMessages( List messages ) { - StringBuffer buffer = new StringBuffer(); - HTMLPrinter.addPageProlog( buffer ); - HTMLPrinter.addParagraph( buffer, HTMLPrinter.convertToHTMLContent( DisassemblyMessages.getString( "DisassemblyAnnotationHover.Multiple_markers_at_this_line_1" ) ) ); //$NON-NLS-1$ - HTMLPrinter.startBulletList( buffer ); - Iterator e = messages.iterator(); - while( e.hasNext() ) - HTMLPrinter.addBullet( buffer, HTMLPrinter.convertToHTMLContent( (String)e.next() ) ); - HTMLPrinter.endBulletList( buffer ); - HTMLPrinter.addPageEpilog( buffer ); - return buffer.toString(); - } - - /** - * Returns one marker which includes the ruler's line of activity. - */ - protected List getMarkersForLine( ISourceViewer viewer, int line ) { - IDocument document = viewer.getDocument(); - IAnnotationModel model = viewer.getAnnotationModel(); - if ( model == null ) - return null; - List exact = new ArrayList(); - List including = new ArrayList(); - Iterator e = model.getAnnotationIterator(); - while( e.hasNext() ) { - Object o = e.next(); - if ( o instanceof MarkerAnnotation ) { - MarkerAnnotation a = (MarkerAnnotation)o; - switch( compareRulerLine( model.getPosition( a ), document, line ) ) { - case 1: - exact.add( a.getMarker() ); - break; - case 2: - including.add( a.getMarker() ); - break; - } - } - } - return select( exact, including ); - } - - /** - * Selects a set of markers from the two lists. By default, it just returns - * the set of exact matches. - */ - protected List select( List exactMatch, List including ) { - return exactMatch; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyDocumentProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyDocumentProvider.java deleted file mode 100644 index a90759ec288..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyDocumentProvider.java +++ /dev/null @@ -1,189 +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.views.disassembly; - -import org.eclipse.core.resources.IMarkerDelta; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IBreakpointsListener; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.IElementStateListener; - -/** - * Document provider for disassembly view. - */ -public class DisassemblyDocumentProvider implements IDocumentProvider, IBreakpointsListener { - - private IDocument fDocument; - private DisassemblyAnnotationModel fAnnotationModel; - - /** - * Constructor for DisassemblyDocumentProvider. - */ - public DisassemblyDocumentProvider() { - fDocument = new Document(); - fAnnotationModel = new DisassemblyAnnotationModel(); - DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#connect(java.lang.Object) - */ - public void connect( Object element ) throws CoreException { - if ( element instanceof DisassemblyEditorInput ) { - String contents = ((DisassemblyEditorInput)element).getContents(); - fDocument.set( contents ); - } - else { - fDocument.set( "" ); //$NON-NLS-1$ - } - fAnnotationModel.setInput( ( element instanceof DisassemblyEditorInput ) ? (DisassemblyEditorInput)element : null, fDocument ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#disconnect(java.lang.Object) - */ - public void disconnect( Object element ) { - fDocument.set( "" ); //$NON-NLS-1$ - fAnnotationModel.setInput( null, fDocument ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#getDocument(java.lang.Object) - */ - public IDocument getDocument( Object element ) { - return fDocument; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#resetDocument(java.lang.Object) - */ - public void resetDocument( Object element ) throws CoreException { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#saveDocument(org.eclipse.core.runtime.IProgressMonitor, java.lang.Object, org.eclipse.jface.text.IDocument, boolean) - */ - public void saveDocument( IProgressMonitor monitor, Object element, IDocument document, boolean overwrite ) throws CoreException { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#getModificationStamp(java.lang.Object) - */ - public long getModificationStamp( Object element ) { - // TODO Auto-generated method stub - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#getSynchronizationStamp(java.lang.Object) - */ - public long getSynchronizationStamp( Object element ) { - // TODO Auto-generated method stub - return 0; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#isDeleted(java.lang.Object) - */ - public boolean isDeleted( Object element ) { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#mustSaveDocument(java.lang.Object) - */ - public boolean mustSaveDocument( Object element ) { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#canSaveDocument(java.lang.Object) - */ - public boolean canSaveDocument( Object element ) { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#getAnnotationModel(java.lang.Object) - */ - public IAnnotationModel getAnnotationModel( Object element ) { - return fAnnotationModel; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#aboutToChange(java.lang.Object) - */ - public void aboutToChange( Object element ) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#changed(java.lang.Object) - */ - public void changed( Object element ) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#addElementStateListener(org.eclipse.ui.texteditor.IElementStateListener) - */ - public void addElementStateListener( IElementStateListener listener ) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.ui.texteditor.IDocumentProvider#removeElementStateListener(org.eclipse.ui.texteditor.IElementStateListener) - */ - public void removeElementStateListener( IElementStateListener listener ) { - // TODO Auto-generated method stub - } - - protected void dispose() { - fDocument = null; - if ( fAnnotationModel != null ) { - fAnnotationModel.dispose(); - fAnnotationModel = null; - } - DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsAdded(org.eclipse.debug.core.model.IBreakpoint[]) - */ - public void breakpointsAdded( IBreakpoint[] breakpoints ) { - fAnnotationModel.breakpointsAdded( breakpoints, fDocument ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsChanged(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[]) - */ - public void breakpointsChanged( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) { - fAnnotationModel.breakpointsChanged( breakpoints, fDocument ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsRemoved(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[]) - */ - public void breakpointsRemoved( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) { - fAnnotationModel.breakpointsRemoved( breakpoints, fDocument ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyInstructionPointerAnnotation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyInstructionPointerAnnotation.java deleted file mode 100644 index 9864186687b..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyInstructionPointerAnnotation.java +++ /dev/null @@ -1,81 +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.views.disassembly; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.debug.core.DebugException; -import org.eclipse.jface.text.source.Annotation; - -/** - * An annotation for the vertical ruler in the disassembly view that shows one - * of two images for the current instruction pointer when debugging (one for - * the top stack frame, one for all others). - */ -public class DisassemblyInstructionPointerAnnotation extends Annotation { - - private int fHashCode = 0; - - /** - * Construct an instruction pointer annotation for the given stack frame. - * - * @param stackFrame frame to create an instruction pointer annotation for - * @param isTopFrame whether the given frame is the top stack frame in its thread - */ - public DisassemblyInstructionPointerAnnotation( ICStackFrame stackFrame, boolean isTopFrame ) { - super( isTopFrame ? IInternalCDebugUIConstants.ANN_DISASM_INSTR_POINTER_CURRENT : IInternalCDebugUIConstants.ANN_DISASM_INSTR_POINTER_SECONDARY, - false, - isTopFrame ? DisassemblyMessages.getString( "DisassemblyInstructionPointerAnnotation.Current_Pointer_1" ) : DisassemblyMessages.getString( "DisassemblyInstructionPointerAnnotation.Secondary_Pointer_1" ) ); //$NON-NLS-1$ //$NON-NLS-2$ - fHashCode = getHashCode( stackFrame ); - } - - private IDisassembly getDisassembly( ICStackFrame frame ) { - if ( frame != null ) { - ICDebugTarget target = (ICDebugTarget)frame.getDebugTarget(); - try { - return target.getDisassembly(); - } - catch( DebugException e ) { - } - } - return null; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return fHashCode; - } - - private int getHashCode( ICStackFrame frame ) { - int hashCode = 17; - IDisassembly disassembly = getDisassembly( frame ); - hashCode = 37*hashCode + (( disassembly != null ) ? disassembly.hashCode() : 0); - if ( frame != null ) { - IAddress address = frame.getAddress(); // will return null if frame has been disposed - if (address != null) { - hashCode = 37*hashCode + address.hashCode(); - } - } - return hashCode; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals( Object obj ) { - return ( obj != null ? obj.hashCode() == hashCode() : false ); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.properties deleted file mode 100644 index 37fb64272ab..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyMessages.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### - -DisassemblyDocumentProvider.Pending_1=Pending... -DisassemblyInstructionPointerAnnotation.Current_Pointer_1=Current Disassembly Instruction Pointer -DisassemblyInstructionPointerAnnotation.Secondary_Pointer_1=Secondary Disassembly Instruction Pointer -DisassemblyAnnotationHover.Multiple_markers_at_this_line_1=Multiple markers at this line -HTMLTextPresenter.ellipsis= -HTML2TextReader.dash=- -DisassemblyEditorInput.source_line_is_not_available_1= diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java deleted file mode 100644 index 56b954c51ac..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyView.java +++ /dev/null @@ -1,981 +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.views.disassembly; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDebugConstants; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; -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.EnableDisableBreakpointRulerAction; -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.IDebugExceptionHandler; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IThread; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.actions.ToggleBreakpointAction; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.TextPresentation; -import org.eclipse.jface.text.source.IAnnotationAccess; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.jface.text.source.IOverviewRuler; -import org.eclipse.jface.text.source.ISharedTextColors; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.IVerticalRuler; -import org.eclipse.jface.text.source.OverviewRuler; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.jface.text.source.VerticalRuler; -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.INullSelectionListener; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.editors.text.EditorsUI; -import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; -import org.eclipse.ui.texteditor.AnnotationPreference; -import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess; -import org.eclipse.ui.texteditor.DefaultRangeIndicator; -import org.eclipse.ui.texteditor.ITextEditorActionConstants; -import org.eclipse.ui.texteditor.IUpdate; -import org.eclipse.ui.texteditor.MarkerAnnotationPreferences; -import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; - -/** - * This view shows disassembly for a particular stack frame. - */ -public class DisassemblyView extends AbstractDebugEventHandlerView - implements ISelectionListener, - INullSelectionListener, - IPropertyChangeListener, - IDebugExceptionHandler, - IDisassemblyListener { - - /** - * Creates and returns the listener on this view's context menus. - * - * @return the menu listener - */ - protected final IMenuListener getContextMenuListener() { - if ( fMenuListener == null ) { - fMenuListener = new IMenuListener() { - - public void menuAboutToShow( IMenuManager menu ) { - String id = menu.getId(); - if ( getRulerContextMenuId().equals( id ) ) { - setFocus(); - rulerContextMenuAboutToShow( menu ); - } - else if ( getViewContextMenuId().equals( id ) ) { - setFocus(); - viewContextMenuAboutToShow( menu ); - } - } - }; - } - return fMenuListener; - } - - /** - * Creates and returns the listener on this editor's vertical ruler. - * - * @return the mouse listener - */ - protected final MouseListener getRulerMouseListener() { - if ( fMouseListener == null ) { - fMouseListener = new MouseListener() { - - private boolean fDoubleClicked = false; - - private void triggerAction( String actionID ) { - IAction action = getAction( actionID ); - if ( action != null ) { - if ( action instanceof IUpdate ) - ((IUpdate)action).update(); - if ( action.isEnabled() ) - action.run(); - } - } - - public void mouseUp( MouseEvent e ) { - setFocus(); - if ( 1 == e.button && !fDoubleClicked ) - triggerAction( ITextEditorActionConstants.RULER_CLICK ); - fDoubleClicked = false; - } - - public void mouseDoubleClick( MouseEvent e ) { - if ( 1 == e.button ) { - fDoubleClicked = true; - triggerAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT ); - } - } - - public void mouseDown( MouseEvent e ) { - StyledText text = getSourceViewer().getTextWidget(); - if ( text != null && !text.isDisposed() ) { - Display display = text.getDisplay(); - Point location = display.getCursorLocation(); - getRulerContextMenu().setLocation( location.x, location.y ); - } - } - }; - } - return fMouseListener; - } - - /** - * The width of the vertical ruler. - */ - private final static int VERTICAL_RULER_WIDTH = 12; - - /** - * Preference key for highlighting current line. - */ - private final static String CURRENT_LINE = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE; - - /** - * Preference key for highlight color of current line. - */ - private final static String CURRENT_LINE_COLOR = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR; - - /** - * The view's context menu id. - */ - private String fViewContextMenuId; - - /** - * The ruler's context menu id. - */ - private String fRulerContextMenuId; - - /** - * The vertical ruler. - */ - private IVerticalRuler fVerticalRuler; - - /** - * The overview ruler. - */ - private IOverviewRuler fOverviewRuler; - - /** - * The last stack frame for which the disassembly storage has - * been requested. - */ - protected ICStackFrame fLastStackFrame = null; - - /** - * Helper for managing the decoration support of this view's viewer. - */ - private SourceViewerDecorationSupport fSourceViewerDecorationSupport; - - /** - * Helper for accessing annotation from the perspective of this view. - */ - private IAnnotationAccess fAnnotationAccess; - - /** - * The annotation preferences. - */ - private MarkerAnnotationPreferences fAnnotationPreferences; - - /** - * Disassembly document provider. - */ - private DisassemblyDocumentProvider fDocumentProvider; - - /** - * Current instruction pointer nnotation. - */ - private DisassemblyInstructionPointerAnnotation fInstrPointerAnnotation; - - /** - * Context menu listener. - */ - private IMenuListener fMenuListener; - - /** - * Vertical ruler mouse listener. - */ - private MouseListener fMouseListener; - - /** - * The ruler context menu to be disposed. - */ - private Menu fRulerContextMenu; - - /** - * The text context menu to be disposed. - */ - private Menu fTextContextMenu; - - /** - * The actions registered with the view. - */ - private Map fActions = new HashMap( 10 ); - - /** - * Constructor for DisassemblyView. - */ - public DisassemblyView() { - super(); - setViewContextMenuId( "#DisassemblyViewContext" ); //$NON-NLS-1$ - setRulerContextMenuId( "#DisassemblyViewRulerContext" ); //$NON-NLS-1$ - fAnnotationPreferences = new MarkerAnnotationPreferences(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite) - */ - protected Viewer createViewer( Composite parent ) { - fVerticalRuler = createVerticalRuler(); - fOverviewRuler = createOverviewRuler( getSharedColors() ); - - SourceViewer viewer = createSourceViewer( parent, fVerticalRuler, getOverviewRuler() ); - viewer.configure( new DisassemblyViewerConfiguration() ); - getSourceViewerDecorationSupport( viewer ); - - getEditorPreferenceStore().addPropertyChangeListener( this ); - CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this ); - getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - getSite().setSelectionProvider( viewer.getSelectionProvider() ); - setEventHandler( createEventHandler() ); - - viewer.setDocument( getDocumentProvider().getDocument( DisassemblyEditorInput.EMPTY_EDITOR_INPUT ), getDocumentProvider().getAnnotationModel( null ) ); - - resetViewerInput(); - - return viewer; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#createActions() - */ - protected void createActions() { - IAction action; - IVerticalRuler ruler = getVerticalRuler(); - action= new ToggleBreakpointAction( this, null, ruler ); - setAction( IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT, action ); - action= new EnableDisableBreakpointRulerAction( this, ruler ); - setAction( IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT, action ); - action= new CBreakpointPropertiesRulerAction( this, ruler ); - setAction( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES, action ); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId() - */ - protected String getHelpContextId() { - return ICDebugHelpContextIds.DISASSEMBLY_VIEW; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager) - */ - protected void fillContextMenu( IMenuManager menu ) { - menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); - updateObjects(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager) - */ - protected void configureToolBar( IToolBarManager tbm ) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged( IWorkbenchPart part, ISelection selection ) { - if ( !isAvailable() || !isVisible() ) - return; - if ( selection == null ) - resetViewerInput(); - else if ( selection instanceof IStructuredSelection ) - computeInput( (IStructuredSelection)selection ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange( PropertyChangeEvent event ) { - String propertyName = event.getProperty(); - if ( IInternalCDebugUIConstants.DISASSEMBLY_SOURCE_LINE_COLOR.equals( propertyName ) ) { - IEditorInput input = getInput(); - if ( input instanceof DisassemblyEditorInput ) - getSourceViewer().changeTextPresentation( createTextPresentation( ((DisassemblyEditorInput)input).getSourceRegions() ), true ); - } - else if ( IInternalCDebugUIConstants.DISASSEMBLY_FONT.equals( propertyName ) ) { - getSourceViewer().getTextWidget().setFont( JFaceResources.getFont( IInternalCDebugUIConstants.DISASSEMBLY_FONT ) ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(org.eclipse.debug.core.DebugException) - */ - public void handleException( DebugException e ) { - showMessage( e.getMessage() ); - } - - /** - * Creates the vertical ruler to be used by this view. - * - * @return the vertical ruler - */ - protected IVerticalRuler createVerticalRuler() { - IVerticalRuler ruler = new VerticalRuler( VERTICAL_RULER_WIDTH, getAnnotationAccess() ); - return ruler; - } - - private IOverviewRuler createOverviewRuler( ISharedTextColors sharedColors ) { - IOverviewRuler ruler = new OverviewRuler( getAnnotationAccess(), VERTICAL_RULER_WIDTH, sharedColors ); - Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator(); - while( e.hasNext() ) { - AnnotationPreference preference = (AnnotationPreference)e.next(); - if ( preference.contributesToHeader() ) - ruler.addHeaderAnnotationType( preference.getAnnotationType() ); - } - return ruler; - } - - /** - * Creates the source viewer to be used by this view. - * - * @param parent the parent control - * @param ruler the vertical ruler - * @param styles style bits - * @return the source viewer - */ - private SourceViewer createSourceViewer( Composite parent, IVerticalRuler vertRuler, IOverviewRuler ovRuler ) { - DisassemblyViewer viewer = new DisassemblyViewer( parent, vertRuler, ovRuler ); - viewer.setRangeIndicator( new DefaultRangeIndicator() ); - JFaceResources.getFontRegistry().addListener( this ); - JFaceResources.getColorRegistry().addListener( this ); - return viewer; - } - - protected SourceViewer getSourceViewer() { - return (SourceViewer)getViewer(); - } - - /** - * Creates this view's event handler. - * - * @return an event handler - */ - protected AbstractDebugEventHandler createEventHandler() { - return new DisassemblyViewEventHandler( this ); - } - - protected void computeInput( IStructuredSelection ssel ) { - SourceViewer viewer = getSourceViewer(); - if ( viewer == null ) - return; - - fLastStackFrame = null; - if ( ssel != null && ssel.size() == 1 ) { - Object element = ssel.getFirstElement(); - if ( element instanceof ICStackFrame ) { - fLastStackFrame = (ICStackFrame)element; - IEditorInput input = getInput(); - if ( input instanceof DisassemblyEditorInput && - !((DisassemblyEditorInput)input).contains( (ICStackFrame)element ) ) - setViewerInput( DisassemblyEditorInput.PENDING_EDITOR_INPUT ); - computeInput( input, (ICStackFrame)element, this ); - return; - } - } - resetViewerInput(); - } - - public void setViewerInput( IEditorInput input ) { - SourceViewer viewer = getSourceViewer(); - if ( viewer == null ) - return; - - if ( input == null ) - input = DisassemblyEditorInput.EMPTY_EDITOR_INPUT; - - IEditorInput current = getInput(); - if ( current != null && current.equals( input ) ) { - updateObjects(); - return; - } - - setInput( input ); - showViewer(); - try { - getDocumentProvider().connect( input ); - } - catch( CoreException e ) { - // never happens - } - getSourceViewer().setDocument( getDocumentProvider().getDocument( input ), - getDocumentProvider().getAnnotationModel( input ) ); - if ( input instanceof DisassemblyEditorInput ) { - // Workaround for bug #69728 - IRegion[] sourceRegions = ((DisassemblyEditorInput)input).getSourceRegions(); - if ( sourceRegions.length > 0 ) { - getSourceViewer().changeTextPresentation( createTextPresentation( sourceRegions ), true ); - } - } - updateObjects(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#dispose() - */ - public void dispose() { - getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this ); - JFaceResources.getFontRegistry().removeListener( this ); - JFaceResources.getColorRegistry().removeListener( this ); - getEditorPreferenceStore().removePropertyChangeListener( this ); - CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this ); - - if ( fSourceViewerDecorationSupport != null ) { - fSourceViewerDecorationSupport.dispose(); - fSourceViewerDecorationSupport = null; - } - - if ( fDocumentProvider != null ) { - fDocumentProvider.dispose(); - fDocumentProvider = null; - } - - if ( fActions != null ) { - fActions.clear(); - fActions = null; - } - - super.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.views.disassembly.IDisassemblyListener#inputComputed(org.eclipse.cdt.debug.core.model.ICStackFrame, org.eclipse.core.runtime.IStatus, org.eclipse.ui.IEditorInput) - */ - public void inputComputed( final ICStackFrame frame, final IStatus status, final IEditorInput input ) { - Runnable runnable = new Runnable() { - public void run() { - if ( isAvailable() ) { - if ( fLastStackFrame != null && fLastStackFrame.equals( frame ) ) { - fLastStackFrame = null; - if ( !status.isOK() ) { - setInput( null ); - getViewer().setInput( null ); - showMessage( status.getMessage() ); - return; - } - } - if ( input != null ) { - setViewerInput( input ); - selectAndReveal( frame, input ); - } - else { - resetViewerInput(); - } - } - } - }; - asyncExec( runnable ); - } - - /** - * Asynchronousy computes the editor input for the given stack frame. - * - * @param current the current editor input - * @param frame the stack frame for which the input is required - * @param listener the listener to be notified when the computation is completed - */ - public void computeInput( final Object current, - final ICStackFrame frame, - final IDisassemblyListener listener ) { - Runnable runnable = new Runnable() { - public void run() { - IStatus status = Status.OK_STATUS; - IEditorInput input = null; - if ( current instanceof DisassemblyEditorInput && - ((DisassemblyEditorInput)current).contains( frame ) ) { - input = (IEditorInput)current; - } - else { - try { - input = DisassemblyEditorInput.create( frame ); - } - catch( DebugException e ) { - status = new Status( IStatus.ERROR, - CDebugUIPlugin.getUniqueIdentifier(), - 0, - e.getMessage(), - null ); - } - - } - listener.inputComputed( frame, status, input ); - } - }; - DebugPlugin.getDefault().asyncExec( runnable ); - } - - protected void selectAndReveal( ICStackFrame frame, IEditorInput input ) { - IRegion region = getLineInformation( frame, input ); - if ( region != null ) { - int start = region.getOffset(); - int length = region.getLength(); - StyledText widget = getSourceViewer().getTextWidget(); - widget.setRedraw( false ); - { - getSourceViewer().revealRange( start, length ); - getSourceViewer().setSelectedRange( start, 0 ); - } - widget.setRedraw( true ); - setInstructionPointer( frame, start, length, getDocumentProvider().getAnnotationModel( input ) ); - } - } - - /** - * Returns the line information for the given line in the given editor - */ - private IRegion getLineInformation( ICStackFrame frame, IEditorInput input ) { - if ( input instanceof DisassemblyEditorInput ) { - final IAddress address = frame.getAddress(); // will return null if frame has been disposed - if (address != null) { - int line = ((DisassemblyEditorInput)input).getInstructionLine( address ); - if ( line > 0 ) { - try { - return getSourceViewer().getDocument().getLineInformation( --line ); - } - catch( BadLocationException e1 ) { - } - } - } - } - return null; - } - - public IEditorInput getInput() { - if ( getSourceViewer() != null ) { - Object input = getSourceViewer().getInput(); - if ( input instanceof IEditorInput ) - return (IEditorInput)input; - } - return null; - } - - protected void setInput( IEditorInput input ) { - getSourceViewer().setInput( input ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - public void createPartControl( Composite parent ) { - super.createPartControl( parent ); - createViewContextMenu(); - createRulerContextMenu(); - if ( fSourceViewerDecorationSupport != null ) - fSourceViewerDecorationSupport.install( getEditorPreferenceStore() ); - } - - /** - * Returns the source viewer decoration support. - * - * @return the source viewer decoration support - */ - protected SourceViewerDecorationSupport getSourceViewerDecorationSupport( ISourceViewer viewer ) { - if ( fSourceViewerDecorationSupport == null ) { - fSourceViewerDecorationSupport = new SourceViewerDecorationSupport( viewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors() ); - configureSourceViewerDecorationSupport( fSourceViewerDecorationSupport ); - } - return fSourceViewerDecorationSupport; - } - - /** - * Creates the annotation access for this view. - * - * @return the created annotation access - */ - private IAnnotationAccess createAnnotationAccess() { - return new DefaultMarkerAnnotationAccess(); - } - - /** - * Configures the decoration support for this view's the source viewer. - */ - private void configureSourceViewerDecorationSupport( SourceViewerDecorationSupport support ) { - Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator(); - while( e.hasNext() ) - support.setAnnotationPreference( (AnnotationPreference)e.next() ); - support.setCursorLinePainterPreferenceKeys( CURRENT_LINE, CURRENT_LINE_COLOR ); - } - - /** - * Returns the annotation access. - * - * @return the annotation access - */ - private IAnnotationAccess getAnnotationAccess() { - if ( fAnnotationAccess == null ) - fAnnotationAccess = createAnnotationAccess(); - return fAnnotationAccess; - } - - private ISharedTextColors getSharedColors() { - ISharedTextColors sharedColors = CDebugUIPlugin.getDefault().getSharedTextColors(); - return sharedColors; - } - - private IPreferenceStore getEditorPreferenceStore() { - return EditorsUI.getPreferenceStore(); - } - - public DisassemblyDocumentProvider getDocumentProvider() { - if ( this.fDocumentProvider == null ) - this.fDocumentProvider = new DisassemblyDocumentProvider(); - return this.fDocumentProvider; - } - - protected void setInstructionPointer( ICStackFrame frame, int start, int length, IAnnotationModel model ) { - Assert.isNotNull( model ); - boolean tos = isTopStackFrame( frame ); - DisassemblyInstructionPointerAnnotation instPtrAnnotation = new DisassemblyInstructionPointerAnnotation( frame, tos ); - Position position = new Position( start, length ); - DisassemblyInstructionPointerAnnotation oldPointer = getCurrentInstructionPointer(); - if ( oldPointer != null ) - model.removeAnnotation( oldPointer ); - model.addAnnotation( instPtrAnnotation, position ); - setCurrentInstructionPointer( instPtrAnnotation ); - } - - private boolean isTopStackFrame( ICStackFrame stackFrame ) { - IThread thread = stackFrame.getThread(); - boolean tos = false; - try { - tos = stackFrame.equals( thread.getTopStackFrame() ); - } - catch( DebugException e ) { - } - return tos; - } - - private DisassemblyInstructionPointerAnnotation getCurrentInstructionPointer() { - return fInstrPointerAnnotation; - } - - private void setCurrentInstructionPointer( DisassemblyInstructionPointerAnnotation instrPointer ) { - fInstrPointerAnnotation = instrPointer; - } - - protected void removeCurrentInstructionPointer( IAnnotationModel model ) { - Assert.isNotNull( model ); - DisassemblyInstructionPointerAnnotation instrPointer = getCurrentInstructionPointer(); - if ( instrPointer != null ) { - model.removeAnnotation( instrPointer ); - setCurrentInstructionPointer( null ); - } - } - - protected void resetViewerInput() { - SourceViewer viewer = getSourceViewer(); - if ( viewer == null ) - return; - - IEditorInput input = DisassemblyEditorInput.EMPTY_EDITOR_INPUT; - setInput( input ); - showViewer(); - try { - getDocumentProvider().connect( input ); - } - catch( CoreException e ) { - // never happens - } - IAnnotationModel model = getDocumentProvider().getAnnotationModel( input ); - getSourceViewer().setDocument( getDocumentProvider().getDocument( input ), model ); - removeCurrentInstructionPointer( model ); - - updateObjects(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden() - */ - protected void becomesHidden() { - selectionChanged( null, new StructuredSelection() ); - super.becomesHidden(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible() - */ - protected void becomesVisible() { - super.becomesVisible(); - IViewPart part = getSite().getPage().findView( IDebugUIConstants.ID_DEBUG_VIEW ); - if ( part != null ) { - ISelection selection = getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW ); - selectionChanged( part, selection ); - } - } - - /** - * Returns the overview ruler. - * - * @return the overview ruler - */ - private IOverviewRuler getOverviewRuler() { - if ( fOverviewRuler == null ) - fOverviewRuler = createOverviewRuler( getSharedColors() ); - return fOverviewRuler; - } - - protected String getRulerContextMenuId() { - return this.fRulerContextMenuId; - } - - private void setRulerContextMenuId( String rulerContextMenuId ) { - Assert.isNotNull( rulerContextMenuId ); - this.fRulerContextMenuId = rulerContextMenuId; - } - - protected String getViewContextMenuId() { - return this.fViewContextMenuId; - } - - private void setViewContextMenuId( String viewContextMenuId ) { - Assert.isNotNull( viewContextMenuId ); - this.fViewContextMenuId = viewContextMenuId; - } - - /** - * Sets up the ruler context menu before it is made visible. - * - * @param menu the menu - */ - protected void rulerContextMenuAboutToShow( IMenuManager menu ) { - menu.add( new Separator( ITextEditorActionConstants.GROUP_REST ) ); - menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); - addAction( menu, IInternalCDebugUIConstants.ACTION_TOGGLE_BREAKPOINT ); - addAction( menu, IInternalCDebugUIConstants.ACTION_ENABLE_DISABLE_BREAKPOINT ); - addAction( menu, IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES ); - } - - /** - * Sets up the view context menu before it is made visible. - * - * @param menu the menu - */ - protected void viewContextMenuAboutToShow( IMenuManager menu ) { - menu.add( new Separator( ITextEditorActionConstants.GROUP_REST ) ); - menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); - } - - /** - * Convenience method to add the action installed under the given action id to the specified group of the menu. - * @param menu the menu to add the action to - * @param group the group in the menu - * @param actionId the id of the action to add - */ - protected final void addAction( IMenuManager menu, String group, String actionId ) { - IAction action = getAction( actionId ); - if ( action != null ) { - if ( action instanceof IUpdate ) - ((IUpdate)action).update(); - IMenuManager subMenu = menu.findMenuUsingPath( group ); - if ( subMenu != null ) - subMenu.add( action ); - else - menu.appendToGroup( group, action ); - } - } - - /** - * Convenience method to add the action installed under the given action id to the given menu. - * @param menu the menu to add the action to - * @param actionId the id of the action to be added - */ - protected final void addAction( IMenuManager menu, String actionId ) { - IAction action = getAction( actionId ); - if ( action != null ) { - if ( action instanceof IUpdate ) - ((IUpdate)action).update(); - menu.add( action ); - } - } - - protected Menu getRulerContextMenu() { - return this.fRulerContextMenu; - } - - private void setRulerContextMenu( Menu rulerContextMenu ) { - this.fRulerContextMenu = rulerContextMenu; - } - - private void createViewContextMenu() { - String id = getViewContextMenuId(); - MenuManager manager = new MenuManager( id, id ); - manager.setRemoveAllWhenShown( true ); - manager.addMenuListener( getContextMenuListener() ); - StyledText styledText = getSourceViewer().getTextWidget(); - setTextContextMenu( manager.createContextMenu( styledText ) ); - styledText.setMenu( getTextContextMenu() ); - - // register the context menu such that other plugins may contribute to it - if ( getSite() != null ) { - getSite().registerContextMenu( id, manager, getSourceViewer() ); - } - } - - private void createRulerContextMenu() { - String id = getRulerContextMenuId(); - MenuManager manager = new MenuManager( id, id ); - manager.setRemoveAllWhenShown( true ); - manager.addMenuListener( getContextMenuListener() ); - Control rulerControl = fVerticalRuler.getControl(); - setRulerContextMenu( manager.createContextMenu( rulerControl ) ); - rulerControl.setMenu( getRulerContextMenu() ); - rulerControl.addMouseListener( getRulerMouseListener() ); - - if ( getSite() != null ) { - getSite().registerContextMenu( id, manager, getSourceViewer() ); - } - } - - private Menu getTextContextMenu() { - return this.fTextContextMenu; - } - - private void setTextContextMenu( Menu textContextMenu ) { - this.fTextContextMenu = textContextMenu; - } - - public void setAction( String actionID, IAction action ) { - Assert.isNotNull( actionID ); - if ( action == null ) { - action = (IAction)fActions.remove( actionID ); - } - else { - fActions.put( actionID, action ); - } - } - - public IAction getAction( String actionID ) { - Assert.isNotNull( actionID ); - return (IAction)fActions.get( actionID ); - } - - private IVerticalRuler getVerticalRuler() { - return this.fVerticalRuler; - } - - private TextPresentation createTextPresentation( IRegion[] regions ) { - TextPresentation p = new TextPresentation(); - for ( int i = 0; i < regions.length; ++i ) { - p.addStyleRange( new StyleRange( regions[i].getOffset(), - regions[i].getLength(), - CDebugUIPlugin.getPreferenceColor( IInternalCDebugUIConstants.DISASSEMBLY_SOURCE_LINE_COLOR ), - null ) ); - } - return p; - } - - protected void refresh( IDisassembly disassembly ) { - if ( !(getInput() instanceof DisassemblyEditorInput) || !disassembly.equals( ((DisassemblyEditorInput)getInput()).getDisassembly() ) ) - return; - resetViewerInput(); - if ( !isAvailable() || !isVisible() ) - return; - IAdaptable context = DebugUITools.getDebugContext(); - if ( context instanceof ICStackFrame ) { - fLastStackFrame = (ICStackFrame)context; - IEditorInput input = getInput(); - if ( input instanceof DisassemblyEditorInput ) - setViewerInput( DisassemblyEditorInput.PENDING_EDITOR_INPUT ); - computeInput( input, (ICStackFrame)context, this ); - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#partActivated(org.eclipse.ui.IWorkbenchPart) - */ - public void partActivated( IWorkbenchPart part ) { - if ( this.equals( part ) ) { - CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON, true ); - } - super.partActivated( part ); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart) - */ - public void partDeactivated( IWorkbenchPart part ) { - if ( this.equals( part ) ) { - CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_INSTRUCTION_STEP_MODE_ON, false ); - } - super.partDeactivated( part ); - } - - @Override - public Object getAdapter(Class adapter) { - if (IDocument.class.equals(adapter)) { - return getDocumentProvider().getDocument(getInput()); - } - return super.getAdapter(adapter); - } - - @Override - public int getOrientation() { - //bug 273250 - Disassembly view should have LTR orientation - return SWT.LEFT_TO_RIGHT; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewEventHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewEventHandler.java deleted file mode 100644 index 87ea66e53e3..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewEventHandler.java +++ /dev/null @@ -1,85 +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.views.disassembly; - -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.ui.AbstractDebugView; - - -/** - * Updates the disassembly view. - */ -public class DisassemblyViewEventHandler extends AbstractDebugEventHandler { - - /** - * Constructor for DisassemblyViewEventHandler. - * - * @param view - */ - public DisassemblyViewEventHandler( AbstractDebugView view ) { - super( view ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#doHandleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - protected void doHandleDebugEvents( DebugEvent[] events ) { - for ( int i = 0; i < events.length; i++ ) { - DebugEvent event = events[i]; - switch( event.getKind() ) { - case DebugEvent.TERMINATE: - handleTerminateEvent( events[i] ); - break; - case DebugEvent.SUSPEND: - handleSuspendEvent( events[i] ); - break; - case DebugEvent.RESUME: - handleResumeEvent( events[i] ); - break; - case DebugEvent.CHANGE: - handleChangeEvent( events[i] ); - break; - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh() - */ - public void refresh() { - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh(java.lang.Object) - */ - protected void refresh( Object element ) { - } - - private void handleTerminateEvent( DebugEvent event ) { - } - - private void handleResumeEvent( DebugEvent event ) { - } - - private void handleSuspendEvent( DebugEvent event ) { - } - - private void handleChangeEvent( DebugEvent event ) { - if ( event.getSource() instanceof IDisassembly ) - getDisassemblyView().refresh( (IDisassembly)event.getSource() ); - } - - protected DisassemblyView getDisassemblyView() { - return (DisassemblyView)getView(); - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewer.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewer.java deleted file mode 100644 index 51bb66fba0a..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewer.java +++ /dev/null @@ -1,60 +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.views.disassembly; - -import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.text.source.IOverviewRuler; -import org.eclipse.jface.text.source.IVerticalRuler; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; - -/** - * The disassembly viewer. - */ -public class DisassemblyViewer extends SourceViewer { - - /** - * The current input. - */ - private Object fInput; - - /** - * Constructor for DisassemblyViewer. - * - * @param parent - * @param ruler - * @param styles - */ - public DisassemblyViewer( Composite parent, IVerticalRuler vertRuler, IOverviewRuler ovRuler ) { - super( parent, vertRuler, ovRuler, true, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION ); - getTextWidget().setFont( JFaceResources.getFont( IInternalCDebugUIConstants.DISASSEMBLY_FONT ) ); - setEditable( false ); - GridData gd = new GridData( GridData.FILL_BOTH ); - getControl().setLayoutData( gd ); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IInputProvider#getInput() - */ - public Object getInput() { - return fInput; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object) - */ - public void setInput( Object input ) { - fInput = input; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewerConfiguration.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewerConfiguration.java deleted file mode 100644 index acb8cfd0272..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyViewerConfiguration.java +++ /dev/null @@ -1,52 +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) - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.views.disassembly; - -import org.eclipse.jface.text.DefaultInformationControl; -import org.eclipse.jface.text.IInformationControl; -import org.eclipse.jface.text.IInformationControlCreator; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; -import org.eclipse.swt.widgets.Shell; - -/** - * Viewer configuration for disassembly. - */ -public class DisassemblyViewerConfiguration extends SourceViewerConfiguration { - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer) - */ - public IAnnotationHover getAnnotationHover( ISourceViewer sourceViewer ) { - return new DisassemblyAnnotationHover(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getInformationControlCreator(org.eclipse.jface.text.source.ISourceViewer) - */ - public IInformationControlCreator getInformationControlCreator( ISourceViewer sourceViewer ) { - return getInformationControlCreator( sourceViewer, true ); - } - - public IInformationControlCreator getInformationControlCreator( ISourceViewer sourceViewer, final boolean cutDown ) { - return new IInformationControlCreator() { - public IInformationControl createInformationControl( Shell parent ) { - return new DefaultInformationControl( parent, false ); - } - }; - } -} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/GoToAddressActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/GoToAddressActionDelegate.java deleted file mode 100644 index 7657b1f4524..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/GoToAddressActionDelegate.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.views.disassembly; - -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.debug.core.model.ICDebugTarget; -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.cdt.debug.core.model.IDisassembly; -import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; -import org.eclipse.cdt.debug.internal.core.model.Disassembly; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyEditorInput; -import org.eclipse.cdt.debug.internal.ui.views.disassembly.DisassemblyView; -import org.eclipse.cdt.utils.Addr32; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.dialogs.InputDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IActionDelegate; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; - -public class GoToAddressActionDelegate implements IActionDelegate, IViewActionDelegate { - private IViewPart fView; - private IAction fAction; - private DisassemblyView fDisassemblyView; - - public void init(IViewPart view) { - setView(view); - if (view instanceof DisassemblyView) { - fDisassemblyView = (DisassemblyView) view; - } - } - - private void setView(IViewPart view) { - fView = view; - } - - protected IViewPart getView() { - return fView; - } - - public void run(IAction action) { - String address; - InputDialog dialog = new InputDialog(fView.getViewSite().getShell(), "Enter address", "Enter address to go to", "", - new IInputValidator() { - public String isValid(String in) { - try { - String input = in.trim(); - if (input.length() == 0) - return "Cannot be empty address"; - if (input.toLowerCase().startsWith("0x")) { - Long.parseLong(input.substring(2), 16); - } else { - Long.parseLong(input); - } - return null; - } catch (NumberFormatException ex) { - return "Must be a hexadecimal or decimal address"; - } - } - }); - if (dialog.open() == Window.OK) { - address = dialog.getValue(); - gotoAddress(address); - } - } - - protected void setAction(IAction action) { - fAction = action; - } - - protected IAction getAction() { - return fAction; - } - - public void selectionChanged(IAction action, ISelection selection) { - setAction(action); - } - - private void gotoAddress(String addr) { - IAddress address = new Addr32(addr); - if (fDisassemblyView != null) { - ICDebugTarget target = null; - ISelection selection = fDisassemblyView.getSite().getPage().getSelection(IDebugUIConstants.ID_DEBUG_VIEW); - if (selection instanceof IStructuredSelection) { - Object element = ((IStructuredSelection) selection).getFirstElement(); - if (element instanceof ICStackFrame) { - IDebugTarget tar = ((ICStackFrame) element).getDebugTarget(); - if (tar instanceof ICDebugTarget) { - target = (ICDebugTarget) tar; - } - } - } - DisassemblyEditorInput input = null; - try { - input = create(target, address); - fDisassemblyView.setViewerInput(input); - } catch (DebugException e) { - MessageDialog dialog = new MessageDialog(fView.getViewSite().getShell(), "Wrong address", null, - "Cannot access memory at address " + addr, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, - 0); - dialog.open(); - } - } - } - - public static DisassemblyEditorInput create(ICDebugTarget target, IAddress address) throws DebugException { - DisassemblyEditorInput input = null; - IDisassembly disassembly = target.getDisassembly(); - if (disassembly instanceof Disassembly) { - IDisassemblyBlock block = ((Disassembly) disassembly).getDisassemblyBlock(address); - input = DisassemblyEditorInput.create(block); - } - return input; - } - - -} - diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/IDisassemblyListener.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/IDisassemblyListener.java deleted file mode 100644 index e1e643449f5..00000000000 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/disassembly/IDisassemblyListener.java +++ /dev/null @@ -1,32 +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.views.disassembly; - -import org.eclipse.cdt.debug.core.model.ICStackFrame; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.ui.IEditorInput; - -/** - * A disassembly listener is notified when the storage - * retrieval operation for given stack frame is completed. - */ -public interface IDisassemblyListener { - - /** - * Notifies this listener that the input is computed. - * - * @param frame the stack frame. - * @param status the result status. - * @param input the resulting editor input. - * null if status is not OK. - */ - public void inputComputed( ICStackFrame frame, IStatus status, IEditorInput input ); -}