diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java index 345f7473d73..befe3d2fee1 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/DsfSourceDisplayAdapter.java @@ -588,7 +588,8 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl fSourceLookupParticipant = new DsfSourceLookupParticipant(session); fSourceLookup.addParticipants(new ISourceLookupParticipant[] {fSourceLookupParticipant} ); - fIPManager = new InstructionPointerManager(); + final IInstructionPointerPresentation ipPresentation = (IInstructionPointerPresentation) session.getModelAdapter(IInstructionPointerPresentation.class); + fIPManager = new InstructionPointerManager(ipPresentation); fSession.addServiceEventListener(this, null); @@ -607,7 +608,7 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl * @since 1.1 */ public void setSelectionChangeDelay(int delay) { - fSelectionChangeDelay = delay; + fSelectionChangeDelay = delay; } public void dispose() { diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/IInstructionPointerPresentation.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/IInstructionPointerPresentation.java new file mode 100644 index 00000000000..29e42557287 --- /dev/null +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/IInstructionPointerPresentation.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * Copyright (c) 2009 Wind River Systems, Inc. and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.debug.ui.sourcelookup; + + +import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext; +import org.eclipse.jface.text.source.Annotation; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IEditorPart; + +/** + * Clients may implement this interface to override annotations used to display + * instruction pointers for stack frames. + *
+ * This interface is modeled after the platform interface + * {@link org.eclipse.debug.ui.IInstructionPointerPresentation}. + *
+ *+ * A client has several options when overriding default instruction pointer + * annotations. The following prioritized order is used to compute an annotation + * for a stack frame. + *
null
value from getInstructionPointerAnnotation(..)
+ * .annotationType
extension to use. This is done by
+ * returning a non-null
value from
+ * getInstructionPointerAnnotationType(..)
. When specified, the
+ * annotation type controls the image displayed via its associated
+ * markerAnnotationSpecification
.null
value from getInstructionPointerImage(..)
.null
+ * value from getInstructionPointerText(..)
.
+ *
+ * + * These methods are called when the debugger has opened an editor to display + * source for the given stack frame. The image will be positioned based on stack + * frame line number and character ranges. + *
+ * + * @see org.eclipse.debug.ui.IInstructionPointerPresentation + * @since 2.0 + */ +public interface IInstructionPointerPresentation { + /** + * Returns an annotation used for the specified stack frame in the specified + * editor, ornull
if a default annotation should be used.
+ *
+ * @param editorPart the editor the debugger has opened
+ * @param frame the stack frame for which the debugger is displaying
+ * source
+ * @return annotation or null
+ */
+ public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IFrameDMContext frame);
+
+ /**
+ * Returns an identifier of a org.eclipse.ui.editors.annotationTypes
extension used for
+ * the specified stack frame in the specified editor, or null
if a default annotation
+ * should be used.
+ *
+ * @param editorPart the editor the debugger has opened
+ * @param frame the stack frame for which the debugger is displaying
+ * source
+ * @return annotation type identifier or null
+ */
+ public String getInstructionPointerAnnotationType(IEditorPart editorPart, IFrameDMContext frame);
+
+ /**
+ * Returns the instruction pointer image used for the specified stack frame in the specified
+ * editor, or null
if a default image should be used.
+ * + * By default, the debug platform uses different images for top stack + * frames and non-top stack frames in a thread. + *
+ * @param editorPart the editor the debugger has opened + * @param frame the stack frame for which the debugger is displaying + * source + * @return image ornull
+ */
+ public Image getInstructionPointerImage(IEditorPart editorPart, IFrameDMContext frame);
+
+ /**
+ * Returns the text to associate with the instruction pointer annotation used for the
+ * specified stack frame in the specified editor, or null
if a default
+ * message should be used.
+ * + * By default, the debug platform uses different images for top stack + * frames and non-top stack frames in a thread. + *
+ * @param editorPart the editor the debugger has opened + * @param frame the stack frame for which the debugger is displaying + * source + * @return message ornull
+ */
+ public String getInstructionPointerText(IEditorPart editorPart, IFrameDMContext frame);
+}
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/InstructionPointerManager.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/InstructionPointerManager.java
index 825ec43daf3..b94b7dc3a2a 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/InstructionPointerManager.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/sourcelookup/InstructionPointerManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation 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
@@ -11,8 +11,7 @@
*******************************************************************************/
package org.eclipse.cdt.dsf.debug.ui.sourcelookup;
-
-import java.util.Collections;
+
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -22,6 +21,7 @@ import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.IRunControl;
import org.eclipse.cdt.dsf.debug.service.IStack;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
+import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.text.Position;
@@ -154,13 +154,30 @@ class InstructionPointerManager {
* Mapping of IDebugTarget objects to (mappings of IThread objects to lists of instruction
* pointer contexts).
*/
- private Listnull
to use the default presentation
+ */
+ public InstructionPointerManager(IInstructionPointerPresentation presentation) {
+ fPresentation = presentation;
+ fAnnotationWrappers = new LinkedList