Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 77659434aa73da92d92f188a670c681627ecdd35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.debug.ui;


import org.eclipse.ui.IEditorInput;

/**
 * A source presentation is used to resolve an editor in which to display a
 * debug model element, breakpoint, or source element. By default, a debug model
 * presentation (which implements this interface) is used to resolve editors
 * when performing source lookup. However, a source locator may override default
 * editor resolution by implementing this interface.
 * <p>
 * Source lookup consists of the following steps:
 * </p>
 * <ol>
 * <li>Locating a source element - the source locator associated with a launch
 * is queried for the source element associated with a stack frame.</li>
 * <li>Resolving an editor in which to display a source element - by default,
 * the debug model presentation associated with the debug model being debugged
 * is queried for an editor input and editor id in which to display a source
 * element. However, clients may override editor resolution by specifying a
 * source locator that is an instance of <code>ISourcePresentation</code>. When
 * a source presentation is specified as a source locator, the source
 * presentation is used to resolve an editor, rather than the default debug
 * model presentation.</li>
 * </ol>
 *
 * <p>
 * Clients may implement this interface as part of an
 * {@link org.eclipse.debug.ui.IDebugModelPresentation} or as an optional
 * extension to an {@link org.eclipse.debug.core.model.ISourceLocator}.
 * </p>
 * 
 * @since 2.0
 */
public interface ISourcePresentation {

	/**
	 * Returns an editor input that should be used to display the given object
	 * in an editor or <code>null</code> if unable to provide an editor input
	 * for the given object.
	 *
	 * @param element a debug model element, breakpoint, or a source element
	 *  that was returned by a source locator's <code>getSourceElement(IStackFrame)</code>
	 *  method
	 * @return an editor input, or <code>null</code> if none
	 */
	IEditorInput getEditorInput(Object element);

	/**
	 * Returns the id of the 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
	 *    source 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
	 */
	String getEditorId(IEditorInput input, Object element);
}

Back to the top