KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > information > IInformationProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.IRegion;
14 import org.eclipse.jface.text.ITextViewer;
15
16
17 /**
18  * Provides information related to the content of a text viewer.
19  * <p>
20  * In order to provide backward compatibility for clients of <code>IInformationPresenter</code>, extension
21  * interfaces are used to provide a means of evolution. The following extension interfaces exist:
22  * <ul>
23  * <li>{@link IInformationProviderExtension} since version 2.1 introducing
24  * the ability to handle documents with multiple partitions</li>
25  * <li>{@link IInformationProviderExtension2} since version 3.0 introducing
26  * the ability to provide its own information control creator</li>
27  * </ul>
28  * </p>
29  * <p>
30  * Clients may implement this interface.
31  * </p>
32  *
33  * @see org.eclipse.jface.text.ITextViewer
34  * @since 2.0
35  */

36 public interface IInformationProvider {
37
38     /**
39      * Returns the region of the text viewer's document close to the given
40      * offset that contains a subject about which information can be provided.<p>
41      * For example, if information can be provided on a per code block basis,
42      * the offset should be used to find the enclosing code block and the source
43      * range of the block should be returned.
44      *
45      * @param textViewer the text viewer in which information has been requested
46      * @param offset the offset at which information has been requested
47      * @return the region of the text viewer's document containing the information subject
48      */

49     IRegion getSubject(ITextViewer textViewer, int offset);
50
51     /**
52      * Returns the information about the given subject or <code>null</code> if
53      * no information is available. It depends on the concrete configuration in which
54      * format the information is to be provided. For example, information presented
55      * in an information control displaying HTML, should be provided in HTML.
56      *
57      * @param textViewer the viewer in whose document the subject is contained
58      * @param subject the text region constituting the information subject
59      * @return the information about the subject
60      * @see IInformationPresenter
61      * @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)}
62      */

63     String JavaDoc getInformation(ITextViewer textViewer, IRegion subject);
64 }
65
Popular Tags