1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.debug.ui; 12 13 14 import org.eclipse.ui.IEditorInput; 15 16 /** 17 * A source presentation is used to resolve an editor in 18 * which to display a debug model element, breakpoint, or 19 * source element. By default, a debug model presentation 20 * (which implements this interface) is used to resolve 21 * editors when performing source lookup. However, a source 22 * locator may override default editor resolution by implementing 23 * this interface. 24 * <p> 25 * Source lookup consists of the following steps:<ol> 26 * <li>Locating a source element - the source locator associated 27 * with a launch is queried for the source element associated 28 * with a stack frame.</li> 29 * <li>Resolving an editor in which to display a source element - 30 * by default, the debug model presentation associated with the 31 * debug model being debugged is queried for an editor input 32 * and editor id in which to display a source element. However, 33 * clients may override editor resolution by specifying a source 34 * locator that is an instance of <code>ISourcePresentation</code>. 35 * When a source presentation is specified as a source locator, 36 * the source presentation is used to resolve an editor, rather 37 * than the default debug model presentation.</li> 38 * </ol> 39 * </p> 40 * <p> 41 * Clients may implement this interface as part of an 42 * {@link org.eclipse.debug.ui.IDebugModelPresentation} or as an optional 43 * extension to an {@link org.eclipse.debug.core.model.ISourceLocator}. 44 * </p> 45 * @since 2.0 46 */ 47 public interface ISourcePresentation { 48 49 /** 50 * Returns an editor input that should be used to display the given object 51 * in an editor or <code>null</code> if unable to provide an editor input 52 * for the given object. 53 * 54 * @param element a debug model element, breakpoint, or a source element 55 * that was returned by a source locator's <code>getSourceElement(IStackFrame)</code> 56 * method 57 * @return an editor input, or <code>null</code> if none 58 */ 59 public IEditorInput getEditorInput(Object element); 60 61 /** 62 * Returns the id of the editor to use to display the 63 * given editor input and object, or <code>null</code> if 64 * unable to provide an editor id. 65 * 66 * @param input an editor input that was previously retrieved from this 67 * source presentation's <code>getEditorInput</code> method 68 * @param element the object that was used in the call to 69 * <code>getEditorInput</code>, that corresponds to the given editor 70 * input 71 * @return an editor id, or <code>null</code> if none 72 */ 73 public String getEditorId(IEditorInput input, Object element); 74 } 75