KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > ITextHover


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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;
12
13
14
15 /**
16  * Computes the information to be shown in a hover popup which appears on top of
17  * the text viewer's text widget when a hover event occurs. If the text hover
18  * does not provide information no hover popup is shown. Any implementer of this
19  * interface must be capable of operating in a non-UI thread.
20  * <p>
21  *
22  * In order to provide backward compatibility for clients of
23  * <code>ITextHover</code>, extension interfaces are used as a means of
24  * evolution. The following extension interfaces exist:
25  * <ul>
26  * <li>{@link org.eclipse.jface.text.ITextHoverExtension} since version 3.0
27  * allowing a text hover to provide a creator for the hover control. This allows
28  * for sophisticated hovers in a way that information computed by the hover can
29  * be displayed in the best possible form.</li>
30  * </ul></p>
31  * <p>
32  * Clients may implement this interface.</p>
33  *
34  * @see org.eclipse.jface.text.ITextHoverExtension
35  * @see org.eclipse.jface.text.ITextViewer
36  */

37 public interface ITextHover {
38
39     /**
40      * Returns the information which should be presented when a hover popup is shown
41      * for the specified hover region. The hover region has the same semantics
42      * as the region returned by <code>getHoverRegion</code>. If the returned
43      * information is <code>null</code> or empty no hover popup will be shown.
44      *
45      * @param textViewer the viewer on which the hover popup should be shown
46      * @param hoverRegion the text range in the viewer which is used to determine
47      * the hover display information
48      * @return the hover popup display information
49      */

50     String JavaDoc getHoverInfo(ITextViewer textViewer, IRegion hoverRegion);
51
52     /**
53      * Returns the text region which should serve as the source of information
54      * to compute the hover popup display information. The popup has been requested
55      * for the given offset.<p>
56      * For example, if hover information can be provided on a per method basis in a
57      * source viewer, the offset should be used to find the enclosing method and the
58      * source range of the method should be returned.
59      *
60      * @param textViewer the viewer on which the hover popup should be shown
61      * @param offset the offset for which the hover request has been issued
62      * @return the hover region used to compute the hover display information
63      */

64     IRegion getHoverRegion(ITextViewer textViewer, int offset);
65 }
66
Popular Tags