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