KickJava   Java API By Example, From Geeks To Geeks.

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


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
12 package org.eclipse.jface.text;
13
14 import org.eclipse.swt.graphics.Point;
15
16 /**
17  * Extension interface for {@link org.eclipse.jface.text.ITextViewer}.
18  * <p>
19  * It provides
20  * <ul>
21  * <li>text presentation invalidation enhancements</li>
22  * <li>text hover management enhancements</li>
23  * <li>a replacement for auto indent strategies</li>
24  * <li>support for custom painters</li>
25  * </ul>
26  *
27  * It extends the means for text presentation invalidation by allowing a
28  * specific region of the presentation to get invalidated. It replaces
29  * {@link org.eclipse.jface.text.ITextViewer#setTextHover(ITextHover, String)}
30  * with a new method that allows to specify state masks for a better control of
31  * the hover behavior.
32  * <p>
33  * An {@link org.eclipse.jface.text.IAutoEditStrategy} is a generalization of
34  * the original {@link org.eclipse.jface.text.IAutoIndentStrategy}. Auto edit
35  * strategies can be arranged in a list that is executed like a pipeline when
36  * the viewer content is changed.
37  * <p>
38  * A {@link org.eclipse.jface.text.IPainter}is creating and managing visual
39  * decorations on the viewer's text widget. Viewer's can have an open number of
40  * painters. Painters are informed about changes to the viewer content and state
41  * and can take the necessary action in responds to the notification.
42  *
43  * @since 2.1
44  */

45 public interface ITextViewerExtension2 {
46
47      /**
48       * The state mask of the default hover (value <code>0xff</code>).
49       */

50      final int DEFAULT_HOVER_STATE_MASK= 0xff;
51
52     /**
53      * Invalidates the viewer's text presentation for the given range.
54      *
55      * @param offset the offset of the first character to be redrawn
56      * @param length the length of the range to be redrawn
57      */

58     void invalidateTextPresentation(int offset, int length);
59
60     /**
61      * Sets this viewer's text hover for the given content type and the given state mask. If the given text hover
62      * is <code>null</code>, any hover installed for the given content type and state mask is removed.
63      *
64      * @param textViewerHover the new hover or <code>null</code>
65      * @param contentType the type for which the hover is to be registered or unregistered
66      * @param stateMask the SWT event state mask; <code>DEFAULT_HOVER_STATE_MASK</code> indicates that
67      * the hover is installed as the default hover.
68      */

69     void setTextHover(ITextHover textViewerHover, String JavaDoc contentType, int stateMask);
70
71     /**
72      * Removes all text hovers for the given content type independent from their state mask.
73      * <p>
74      * Note: To remove a hover for a given content type and state mask
75      * use {@link #setTextHover(ITextHover, String, int)} with <code>null</code>
76      * as parameter for the text hover.
77      * </p>
78      * @param contentType the type for which all text hovers are to be unregistered
79      */

80     void removeTextHovers(String JavaDoc contentType);
81
82     /**
83      * Returns the currently displayed text hover if any, <code>null</code> otherwise.
84      *
85      * @return the currently displayed text hover or <code>null</code>
86      */

87     ITextHover getCurrentTextHover();
88
89     /**
90      * Returns the location at which the most recent mouse hover event
91      * has occurred.
92      *
93      * @return the location of the most recent mouse hover event
94      */

95     Point getHoverEventLocation();
96
97     /**
98      * Prepends the given auto edit strategy to the existing list of strategies
99      * for the specified content type. The strategies are called in the order in
100      * which they appear in the list of strategies.
101      *
102      * @param strategy the auto edit strategy
103      * @param contentType the content type
104      */

105     void prependAutoEditStrategy(IAutoEditStrategy strategy, String JavaDoc contentType);
106
107     /**
108      * Removes the first occurrence of the given auto edit strategy in the list of strategies
109      * registered under the specified content type.
110      *
111      * @param strategy the auto edit strategy
112      * @param contentType the content type
113      */

114     void removeAutoEditStrategy(IAutoEditStrategy strategy, String JavaDoc contentType);
115
116     /**
117      * Adds the given painter to this viewer.
118      *
119      * @param painter the painter to be added
120      */

121     void addPainter(IPainter painter);
122
123     /**
124      * Removes the given painter from this viewer. If the painter has not been
125      * added to this viewer, this call is without effect.
126      *
127      * @param painter the painter to be removed
128      */

129     void removePainter(IPainter painter);
130 }
131
Popular Tags