01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.text.information;
11:
12: import org.eclipse.jface.text.ITextViewer;
13:
14: /**
15: * An information presenter shows information available at the text viewer's
16: * current document position. An <code>IInformationPresenter</code> is a
17: * {@link org.eclipse.jface.text.ITextViewer} add-on.
18: * <p>
19: * An information presenters has a list of {@link org.eclipse.jface.text.information.IInformationProvider} objects
20: * each of which is registered for a particular document content type.
21: * The presenter uses the strategy objects to retrieve the information to present.
22: * </p>
23: * <p>
24: * In order to provide backward compatibility for clients of <code>IInformationPresenter</code>, extension
25: * interfaces are used to provide a means of evolution. The following extension interfaces exist:
26: * <ul>
27: * <li>{@link IInformationPresenterExtension} since version 3.0 introducing
28: * the ability to handle documents with multiple partitions</li>
29: * </ul>
30: * </p>
31: * <p>
32: * The interface can be implemented by clients. By default, clients use
33: * {@link org.eclipse.jface.text.information.InformationPresenter} as the standard implementer of this interface.
34: * </p>
35: *
36: * @see org.eclipse.jface.text.ITextViewer
37: * @see org.eclipse.jface.text.information.IInformationProvider
38: * @since 2.0
39: */
40: public interface IInformationPresenter {
41:
42: /**
43: * Installs the information presenter on the given text viewer. After this method has been
44: * finished, the presenter is operational, i.e. the method {@link #showInformation()}
45: * can be called until {@link #uninstall()} is called.
46: *
47: * @param textViewer the viewer on which the presenter is installed
48: */
49: void install(ITextViewer textViewer);
50:
51: /**
52: * Removes the information presenter from the text viewer it has previously been
53: * installed on.
54: */
55: void uninstall();
56:
57: /**
58: * Shows information related to the cursor position of the text viewer
59: * this information presenter is installed on.
60: */
61: void showInformation();
62:
63: /**
64: * Returns the information provider to be used for the given content type.
65: *
66: * @param contentType the type of the content for which information will be requested
67: * @return an information provider or <code>null</code> if none exists for the specified content type
68: */
69: IInformationProvider getInformationProvider(String contentType);
70: }
|