Mercurial > projects > dwt-addons
comparison dwtx/jface/text/ITextViewerExtension2.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, 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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 | |
14 module dwtx.jface.text.ITextViewerExtension2; | |
15 | |
16 import dwt.dwthelper.utils; | |
17 | |
18 import dwt.graphics.Point; | |
19 | |
20 /** | |
21 * Extension interface for {@link dwtx.jface.text.ITextViewer}. | |
22 * <p> | |
23 * It provides | |
24 * <ul> | |
25 * <li>text presentation invalidation enhancements</li> | |
26 * <li>text hover management enhancements</li> | |
27 * <li>a replacement for auto indent strategies</li> | |
28 * <li>support for custom painters</li> | |
29 * </ul> | |
30 * | |
31 * It extends the means for text presentation invalidation by allowing a | |
32 * specific region of the presentation to get invalidated. It replaces | |
33 * {@link dwtx.jface.text.ITextViewer#setTextHover(ITextHover, String)} | |
34 * with a new method that allows to specify state masks for a better control of | |
35 * the hover behavior. | |
36 * <p> | |
37 * An {@link dwtx.jface.text.IAutoEditStrategy} is a generalization of | |
38 * the original {@link dwtx.jface.text.IAutoIndentStrategy}. Auto edit | |
39 * strategies can be arranged in a list that is executed like a pipeline when | |
40 * the viewer content is changed. | |
41 * <p> | |
42 * A {@link dwtx.jface.text.IPainter}is creating and managing visual | |
43 * decorations on the viewer's text widget. Viewer's can have an open number of | |
44 * painters. Painters are informed about changes to the viewer content and state | |
45 * and can take the necessary action in responds to the notification. | |
46 * | |
47 * @since 2.1 | |
48 */ | |
49 public interface ITextViewerExtension2 { | |
50 | |
51 /** | |
52 * The state mask of the default hover (value <code>0xff</code>). | |
53 */ | |
54 final int DEFAULT_HOVER_STATE_MASK= 0xff; | |
55 | |
56 /** | |
57 * Invalidates the viewer's text presentation for the given range. | |
58 * | |
59 * @param offset the offset of the first character to be redrawn | |
60 * @param length the length of the range to be redrawn | |
61 */ | |
62 void invalidateTextPresentation(int offset, int length); | |
63 | |
64 /** | |
65 * Sets this viewer's text hover for the given content type and the given state mask. If the given text hover | |
66 * is <code>null</code>, any hover installed for the given content type and state mask is removed. | |
67 * | |
68 * @param textViewerHover the new hover or <code>null</code> | |
69 * @param contentType the type for which the hover is to be registered or unregistered | |
70 * @param stateMask the DWT event state mask; <code>DEFAULT_HOVER_STATE_MASK</code> indicates that | |
71 * the hover is installed as the default hover. | |
72 */ | |
73 void setTextHover(ITextHover textViewerHover, String contentType, int stateMask); | |
74 | |
75 /** | |
76 * Removes all text hovers for the given content type independent from their state mask. | |
77 * <p> | |
78 * Note: To remove a hover for a given content type and state mask | |
79 * use {@link #setTextHover(ITextHover, String, int)} with <code>null</code> | |
80 * as parameter for the text hover. | |
81 * </p> | |
82 * @param contentType the type for which all text hovers are to be unregistered | |
83 */ | |
84 void removeTextHovers(String contentType); | |
85 | |
86 /** | |
87 * Returns the currently displayed text hover if any, <code>null</code> otherwise. | |
88 * | |
89 * @return the currently displayed text hover or <code>null</code> | |
90 */ | |
91 ITextHover getCurrentTextHover(); | |
92 | |
93 /** | |
94 * Returns the location at which the most recent mouse hover event | |
95 * has occurred. | |
96 * | |
97 * @return the location of the most recent mouse hover event | |
98 */ | |
99 Point getHoverEventLocation(); | |
100 | |
101 /** | |
102 * Prepends the given auto edit strategy to the existing list of strategies | |
103 * for the specified content type. The strategies are called in the order in | |
104 * which they appear in the list of strategies. | |
105 * | |
106 * @param strategy the auto edit strategy | |
107 * @param contentType the content type | |
108 */ | |
109 void prependAutoEditStrategy(IAutoEditStrategy strategy, String contentType); | |
110 | |
111 /** | |
112 * Removes the first occurrence of the given auto edit strategy in the list of strategies | |
113 * registered under the specified content type. | |
114 * | |
115 * @param strategy the auto edit strategy | |
116 * @param contentType the content type | |
117 */ | |
118 void removeAutoEditStrategy(IAutoEditStrategy strategy, String contentType); | |
119 | |
120 /** | |
121 * Adds the given painter to this viewer. | |
122 * | |
123 * @param painter the painter to be added | |
124 */ | |
125 void addPainter(IPainter painter); | |
126 | |
127 /** | |
128 * Removes the given painter from this viewer. If the painter has not been | |
129 * added to this viewer, this call is without effect. | |
130 * | |
131 * @param painter the painter to be removed | |
132 */ | |
133 void removePainter(IPainter painter); | |
134 } |