Mercurial > projects > dwt-addons
diff dwtx/jface/text/information/IInformationPresenter.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwtx/jface/text/information/IInformationPresenter.d Sat Aug 23 19:10:48 2008 +0200 @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Port to the D programming language: + * Frank Benoit <benoit@tionex.de> + *******************************************************************************/ +module dwtx.jface.text.information.IInformationPresenter; + +import dwt.dwthelper.utils; + +import dwtx.jface.text.ITextViewer; + + +/** + * An information presenter shows information available at the text viewer's + * current document position. An <code>IInformationPresenter</code> is a + * {@link dwtx.jface.text.ITextViewer} add-on. + * <p> + * An information presenters has a list of {@link dwtx.jface.text.information.IInformationProvider} objects + * each of which is registered for a particular document content type. + * The presenter uses the strategy objects to retrieve the information to present. + * </p> + * <p> + * In order to provide backward compatibility for clients of <code>IInformationPresenter</code>, extension + * interfaces are used to provide a means of evolution. The following extension interfaces exist: + * <ul> + * <li>{@link IInformationPresenterExtension} since version 3.0 introducing + * the ability to handle documents with multiple partitions</li> + * </ul> + * </p> + * <p> + * The interface can be implemented by clients. By default, clients use + * {@link dwtx.jface.text.information.InformationPresenter} as the standard implementer of this interface. + * </p> + * + * @see dwtx.jface.text.information.IInformationPresenterExtension + * @see dwtx.jface.text.ITextViewer + * @see dwtx.jface.text.information.IInformationProvider + * @since 2.0 + */ +public interface IInformationPresenter { + + /** + * Installs the information presenter on the given text viewer. After this method has been + * finished, the presenter is operational, i.e. the method {@link #showInformation()} + * can be called until {@link #uninstall()} is called. + * + * @param textViewer the viewer on which the presenter is installed + */ + void install(ITextViewer textViewer); + + /** + * Removes the information presenter from the text viewer it has previously been + * installed on. + */ + void uninstall(); + + /** + * Shows information related to the cursor position of the text viewer + * this information presenter is installed on. + */ + void showInformation(); + + /** + * Returns the information provider to be used for the given content type. + * + * @param contentType the type of the content for which information will be requested + * @return an information provider or <code>null</code> if none exists for the specified content type + */ + IInformationProvider getInformationProvider(String contentType); +}