diff options
author | aleherbau | 2011-05-09 05:47:49 +0000 |
---|---|---|
committer | aleherbau | 2011-05-09 05:47:49 +0000 |
commit | aa76d5643f37b2e8f8e97ffa55005d81ca2baf1c (patch) | |
tree | ddf758ef19e164892e26d8bb8b3bb78c9b40e73d /plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf | |
parent | cdf3495bb3e46b30d450a419bc36b2ba0eb95ae3 (diff) | |
download | org.eclipse.tcf-aa76d5643f37b2e8f8e97ffa55005d81ca2baf1c.tar.gz org.eclipse.tcf-aa76d5643f37b2e8f8e97ffa55005d81ca2baf1c.tar.xz org.eclipse.tcf-aa76d5643f37b2e8f8e97ffa55005d81ca2baf1c.zip |
TCF Debugger: Bug 344919 - [cdt] Reuse CDT's Source Not Found Editor
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf')
2 files changed, 66 insertions, 11 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/ISourceNotFoundPresentation.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/ISourceNotFoundPresentation.java new file mode 100644 index 000000000..18c4259b1 --- /dev/null +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/ISourceNotFoundPresentation.java @@ -0,0 +1,47 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.internal.tcf.debug.ui.model;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.ui.IEditorInput;
+
+/**
+ * Adapter to customize source presentation for the source-not-found case.
+ */
+public interface ISourceNotFoundPresentation {
+
+ /**
+ * Returns an editor input that should be used to display a source-not-found editor
+ * for the given object or <code>null</code> if unable to provide an editor input
+ * for the given object.
+ *
+ * @param element a debug model element
+ * @param cfg the launch configuration of the debug element
+ * @param file unresolved source file path
+ * @return an editor input, or <code>null</code> if none
+ */
+ public IEditorInput getEditorInput(Object element, ILaunchConfiguration cfg, String file);
+
+ /**
+ * Returns the id of the source-not-found editor to use to display the
+ * given editor input and object, or <code>null</code> if
+ * unable to provide an editor id.
+ *
+ * @param input an editor input that was previously retrieved from this
+ * presentation's <code>getEditorInput</code> method
+ * @param element the object that was used in the call to
+ * <code>getEditorInput</code>, that corresponds to the given editor
+ * input
+ * @return an editor id, or <code>null</code> if none
+ */
+ public String getEditorId(IEditorInput input, Object element);
+
+}
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java index 8ad1274c4..6a5886fd9 100644 --- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java +++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/model/TCFModel.java @@ -1057,13 +1057,13 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, top_frame = stack_frame.getFrameNo() == 0; ctx_id = stack_frame.parent.id; } - displaySource(cnt, page, ctx_id, top_frame, area); + displaySource(cnt, page, element, ctx_id, top_frame, area); } }); } private void displaySource(final int cnt, final IWorkbenchPage page, - final String exe_id, final boolean top_frame, final ILineNumbers.CodeArea area) { + final Object element, final String exe_id, final boolean top_frame, final ILineNumbers.CodeArea area) { final boolean disassembly_available = channel.getRemoteService(IDisassembly.class) != null; display.asyncExec(new Runnable() { public void run() { @@ -1099,6 +1099,23 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, line = area.start_line; } } + if (area != null && !instruction_stepping_enabled && (editor_input == null || editor_id == null)) { + ILaunchConfiguration cfg = launch.getLaunchConfiguration(); + ISourceNotFoundPresentation presentation = (ISourceNotFoundPresentation) DebugPlugin.getAdapter(element, ISourceNotFoundPresentation.class); + if (presentation != null) { + String filename = TCFSourceLookupParticipant.toFileName(area); + editor_input = presentation.getEditorInput(element, cfg, filename); + editor_id = presentation.getEditorId(editor_input, element); + } + if (editor_id == null || editor_input == null) { + editor_id = IDebugUIConstants.ID_COMMON_SOURCE_NOT_FOUND_EDITOR; + editor_input = editor_not_found.get(cfg); + if (editor_input == null) { + editor_input = new CommonSourceNotFoundEditorInput(cfg); + editor_not_found.put(cfg, editor_input); + } + } + } if (exe_id != null && disassembly_available && (editor_input == null || editor_id == null || instruction_stepping_enabled) && PlatformUI.getWorkbench().getEditorRegistry().findEditor( @@ -1106,15 +1123,6 @@ public class TCFModel implements IElementContentProvider, IElementLabelProvider, editor_id = DisassemblyEditorInput.EDITOR_ID; editor_input = DisassemblyEditorInput.INSTANCE; } - if (area != null && (editor_input == null || editor_id == null)) { - ILaunchConfiguration cfg = launch.getLaunchConfiguration(); - editor_id = IDebugUIConstants.ID_COMMON_SOURCE_NOT_FOUND_EDITOR; - editor_input = editor_not_found.get(cfg); - if (editor_input == null) { - editor_input = new CommonSourceNotFoundEditorInput(cfg); - editor_not_found.put(cfg, editor_input); - } - } if (cnt != display_source_generation) return; ITextEditor text_editor = null; if (page != null && editor_input != null && editor_id != null) { |