129
|
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.ITextHover;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 /**
|
|
18 * Computes the information to be shown in a hover popup which appears on top of
|
|
19 * the text viewer's text widget when a hover event occurs. If the text hover
|
|
20 * does not provide information no hover popup is shown. Any implementer of this
|
|
21 * interface must be capable of operating in a non-UI thread.
|
|
22 * <p>
|
|
23 *
|
|
24 * In order to provide backward compatibility for clients of
|
|
25 * <code>ITextHover</code>, extension interfaces are used as a means of
|
|
26 * evolution. The following extension interfaces exist:
|
|
27 * <ul>
|
|
28 * <li>{@link dwtx.jface.text.ITextHoverExtension} since version 3.0
|
|
29 * allowing a text hover to provide a creator for the hover control. This allows
|
|
30 * for sophisticated hovers in a way that information computed by the hover can
|
|
31 * be displayed in the best possible form.</li>
|
|
32 * <li>{@link dwtx.jface.text.ITextHoverExtension2} since version 3.4
|
|
33 * allowing a text hover to return hover-specific information objects.</li>
|
|
34 * </ul></p>
|
|
35 * <p>
|
|
36 * Clients may implement this interface.</p>
|
|
37 *
|
|
38 * @see dwtx.jface.text.ITextHoverExtension
|
|
39 * @see dwtx.jface.text.ITextHoverExtension2
|
|
40 * @see dwtx.jface.text.ITextViewer
|
|
41 */
|
|
42 public interface ITextHover {
|
|
43
|
|
44 /**
|
|
45 * Returns the information which should be presented when a hover popup is shown
|
|
46 * for the specified hover region. The hover region has the same semantics
|
|
47 * as the region returned by <code>getHoverRegion</code>. If the returned
|
|
48 * information is <code>null</code> or empty no hover popup will be shown.
|
|
49 *
|
|
50 * @param textViewer the viewer on which the hover popup should be shown
|
|
51 * @param hoverRegion the text range in the viewer which is used to determine
|
|
52 * the hover display information
|
|
53 * @return the hover popup display information, or <code>null</code> if none available
|
|
54 * @deprecated As of 3.4, replaced by {@link ITextHoverExtension2#getHoverInfo2(ITextViewer, IRegion)}
|
|
55 */
|
|
56 String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion);
|
|
57
|
|
58 /**
|
|
59 * Returns the text region which should serve as the source of information
|
|
60 * to compute the hover popup display information. The popup has been requested
|
|
61 * for the given offset.<p>
|
|
62 * For example, if hover information can be provided on a per method basis in a
|
|
63 * source viewer, the offset should be used to find the enclosing method and the
|
|
64 * source range of the method should be returned.
|
|
65 *
|
|
66 * @param textViewer the viewer on which the hover popup should be shown
|
|
67 * @param offset the offset for which the hover request has been issued
|
|
68 * @return the hover region used to compute the hover display information
|
|
69 */
|
|
70 IRegion getHoverRegion(ITextViewer textViewer, int offset);
|
|
71 }
|