01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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.IRegion;
13: import org.eclipse.jface.text.ITextViewer;
14:
15: /**
16: * Provides information related to the content of a text viewer.
17: * <p>
18: * In order to provide backward compatibility for clients of <code>IInformationPresenter</code>, extension
19: * interfaces are used to provide a means of evolution. The following extension interfaces exist:
20: * <ul>
21: * <li>{@link IInformationProviderExtension} since version 2.1 introducing
22: * the ability to handle documents with multiple partitions</li>
23: * <li>{@link IInformationProviderExtension2} since version 3.0 introducing
24: * the ability to provide its own information control creator</li>
25: * </ul>
26: * </p>
27: * <p>
28: * Clients may implement this interface.
29: * </p>
30: *
31: * @see org.eclipse.jface.text.ITextViewer
32: * @since 2.0
33: */
34: public interface IInformationProvider {
35:
36: /**
37: * Returns the region of the text viewer's document close to the given
38: * offset that contains a subject about which information can be provided.<p>
39: * For example, if information can be provided on a per code block basis,
40: * the offset should be used to find the enclosing code block and the source
41: * range of the block should be returned.
42: *
43: * @param textViewer the text viewer in which information has been requested
44: * @param offset the offset at which information has been requested
45: * @return the region of the text viewer's document containing the information subject
46: */
47: IRegion getSubject(ITextViewer textViewer, int offset);
48:
49: /**
50: * Returns the information about the given subject or <code>null</code> if
51: * no information is available. It depends on the concrete configuration in which
52: * format the information is to be provided. For example, information presented
53: * in an information control displaying HTML, should be provided in HTML.
54: *
55: * @param textViewer the viewer in whose document the subject is contained
56: * @param subject the text region constituting the information subject
57: * @return the information about the subject
58: * @see IInformationPresenter
59: * @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)}
60: */
61: String getInformation(ITextViewer textViewer, IRegion subject);
62: }
|