1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Contributing new disassembly.

This commit is contained in:
Mikhail Khodjaiants 2008-04-16 21:59:40 +00:00
parent 5b528871c9
commit dac361c1c2
2 changed files with 31 additions and 7 deletions

View file

@ -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();
}
}

View file

@ -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() {