From dac361c1c2ed75c701c8e2e38cdff9598ed7e0d4 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 16 Apr 2008 21:59:40 +0000 Subject: Contributing new disassembly. --- .../ui/disassembly/editor/DisassemblyEditor.java | 20 +++++++++++++++++++- .../editor/DisassemblyEditorPresentation.java | 18 ++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java index 93c3dbff2da..fc7d99c582b 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditor.java @@ -16,6 +16,7 @@ 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.actions.ToggleBreakpointRulerAction; +import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyDocumentProvider; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyPane; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DocumentContentProvider; import org.eclipse.cdt.debug.internal.ui.disassembly.viewer.VirtualDocument; @@ -31,6 +32,8 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.IVerticalRuler; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -43,7 +46,7 @@ import org.eclipse.ui.part.EditorPart; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; -public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusableEditor, IDebugContextListener { +public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusableEditor, IDebugContextListener, IPropertyChangeListener { private DisassemblyPane fDisassemblyPane; @@ -73,10 +76,14 @@ public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusa /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) */ + @SuppressWarnings("restriction") @Override public void init( IEditorSite site, IEditorInput input ) throws PartInitException { setSite( site ); setInput( input ); + ((DisassemblyDocumentProvider)getDocumentProvider()). + getDocumentPresentation( input ). + addPropertyChangeListener( this ); DebugUITools.getDebugContextManager().addDebugContextListener( this ); } @@ -138,9 +145,13 @@ public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusa /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#dispose() */ + @SuppressWarnings("restriction") @Override public void dispose() { DebugUITools.getDebugContextManager().removeDebugContextListener( this ); + ((DisassemblyDocumentProvider)getDocumentProvider()). + getDocumentPresentation( getEditorInput() ). + removePropertyChangeListener( this ); getDocumentProvider().disconnect( getEditorInput() ); fDisassemblyPane.dispose(); super.dispose(); @@ -334,4 +345,11 @@ public class DisassemblyEditor extends EditorPart implements ITextEditor, IReusa action= new CBreakpointPropertiesRulerAction( this, ruler ); setAction( IInternalCDebugUIConstants.ACTION_BREAKPOINT_PROPERTIES, action ); } + + /* (non-Javadoc) + * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) + */ + public void propertyChange( PropertyChangeEvent event ) { + getViewer().refresh(); + } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorPresentation.java index 57d73eb3891..5adcd4208c6 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/disassembly/editor/DisassemblyEditorPresentation.java @@ -21,8 +21,14 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationConte * org.eclipse.cdt.debug.internal.ui.disassembly.viewer.DisassemblyEditorPresentation: * //TODO Add description. */ +@SuppressWarnings("restriction") public class DisassemblyEditorPresentation extends PresentationContext implements IDocumentPresentation { + public static final String PROPERTY_SHOW_INSTRUCTIONS = "PROPERTY_SHOW_INSTRUCTIONS"; //$NON-NLS-1$ + public static final String PROPERTY_SHOW_SOURCE = "PROPERTY_SHOW_SOURCE"; //$NON-NLS-1$ + public static final String PROPERTY_SHOW_ADDRESSES = "PROPERTY_SHOW_ADDRESSES"; //$NON-NLS-1$ + public static final String PROPERTY_SHOW_LINE_NUMBERS = "PROPERTY_SHOW_LINE_NUMBERS"; //$NON-NLS-1$ + private boolean fShowInstructions = true; private boolean fShowSource = false; @@ -31,24 +37,24 @@ public class DisassemblyEditorPresentation extends PresentationContext implement public DisassemblyEditorPresentation() { super( ICDebugUIConstants.ID_DEFAULT_DISASSEMBLY_EDITOR ); - fShowInstructions = CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS ); - fShowSource = CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE ); + setProperty( PROPERTY_SHOW_INSTRUCTIONS, Boolean.valueOf( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS ) ) ); + setProperty( PROPERTY_SHOW_SOURCE, Boolean.valueOf( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE ) ) ); } public boolean showIntstructions() { - return fShowInstructions; + return ((Boolean)getProperty( PROPERTY_SHOW_INSTRUCTIONS )).booleanValue(); } public void setShowIntstructions( boolean showIntstructions ) { - fShowInstructions = showIntstructions; + setProperty( PROPERTY_SHOW_INSTRUCTIONS, Boolean.valueOf( showIntstructions ) ); } public boolean showSource() { - return fShowSource; + return ((Boolean)getProperty( PROPERTY_SHOW_SOURCE )).booleanValue(); } public void setShowSource( boolean showSource ) { - fShowSource = showSource; + setProperty( PROPERTY_SHOW_SOURCE, Boolean.valueOf( showSource ) ); } public boolean showAddresses() { -- cgit v1.2.3