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.jface.text.information; 12 13 import org.eclipse.jface.text.ITextViewer; 14 15 16 /** 17 * An information presenter shows information available at the text viewer's 18 * current document position. An <code>IInformationPresenter</code> is a 19 * {@link org.eclipse.jface.text.ITextViewer} add-on. 20 * <p> 21 * An information presenters has a list of {@link org.eclipse.jface.text.information.IInformationProvider} objects 22 * each of which is registered for a particular document content type. 23 * The presenter uses the strategy objects to retrieve the information to present. 24 * </p> 25 * <p> 26 * In order to provide backward compatibility for clients of <code>IInformationPresenter</code>, extension 27 * interfaces are used to provide a means of evolution. The following extension interfaces exist: 28 * <ul> 29 * <li>{@link IInformationPresenterExtension} since version 3.0 introducing 30 * the ability to handle documents with multiple partitions</li> 31 * </ul> 32 * </p> 33 * <p> 34 * The interface can be implemented by clients. By default, clients use 35 * {@link org.eclipse.jface.text.information.InformationPresenter} as the standard implementer of this interface. 36 * </p> 37 * 38 * @see org.eclipse.jface.text.ITextViewer 39 * @see org.eclipse.jface.text.information.IInformationProvider 40 * @since 2.0 41 */ 42 public interface IInformationPresenter { 43 44 /** 45 * Installs the information presenter on the given text viewer. After this method has been 46 * finished, the presenter is operational, i.e. the method {@link #showInformation()} 47 * can be called until {@link #uninstall()} is called. 48 * 49 * @param textViewer the viewer on which the presenter is installed 50 */ 51 void install(ITextViewer textViewer); 52 53 /** 54 * Removes the information presenter from the text viewer it has previously been 55 * installed on. 56 */ 57 void uninstall(); 58 59 /** 60 * Shows information related to the cursor position of the text viewer 61 * this information presenter is installed on. 62 */ 63 void showInformation(); 64 65 /** 66 * Returns the information provider to be used for the given content type. 67 * 68 * @param contentType the type of the content for which information will be requested 69 * @return an information provider or <code>null</code> if none exists for the specified content type 70 */ 71 IInformationProvider getInformationProvider(String contentType); 72 } 73