129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2007 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.source.ISourceViewer;
|
|
14
|
131
|
15 import dwtx.jface.text.source.ISharedTextColors; // packageimport
|
|
16 import dwtx.jface.text.source.ILineRange; // packageimport
|
|
17 import dwtx.jface.text.source.IAnnotationPresentation; // packageimport
|
|
18 import dwtx.jface.text.source.IVerticalRulerInfoExtension; // packageimport
|
|
19 import dwtx.jface.text.source.ICharacterPairMatcher; // packageimport
|
|
20 import dwtx.jface.text.source.TextInvocationContext; // packageimport
|
|
21 import dwtx.jface.text.source.LineChangeHover; // packageimport
|
|
22 import dwtx.jface.text.source.IChangeRulerColumn; // packageimport
|
|
23 import dwtx.jface.text.source.IAnnotationMap; // packageimport
|
|
24 import dwtx.jface.text.source.IAnnotationModelListenerExtension; // packageimport
|
|
25 import dwtx.jface.text.source.ISourceViewerExtension2; // packageimport
|
|
26 import dwtx.jface.text.source.IAnnotationHover; // packageimport
|
|
27 import dwtx.jface.text.source.ContentAssistantFacade; // packageimport
|
|
28 import dwtx.jface.text.source.IAnnotationAccess; // packageimport
|
|
29 import dwtx.jface.text.source.IVerticalRulerExtension; // packageimport
|
|
30 import dwtx.jface.text.source.IVerticalRulerColumn; // packageimport
|
|
31 import dwtx.jface.text.source.LineNumberRulerColumn; // packageimport
|
|
32 import dwtx.jface.text.source.MatchingCharacterPainter; // packageimport
|
|
33 import dwtx.jface.text.source.IAnnotationModelExtension; // packageimport
|
|
34 import dwtx.jface.text.source.ILineDifferExtension; // packageimport
|
|
35 import dwtx.jface.text.source.DefaultCharacterPairMatcher; // packageimport
|
|
36 import dwtx.jface.text.source.LineNumberChangeRulerColumn; // packageimport
|
|
37 import dwtx.jface.text.source.IAnnotationAccessExtension; // packageimport
|
|
38 import dwtx.jface.text.source.AnnotationModel; // packageimport
|
|
39 import dwtx.jface.text.source.ILineDifferExtension2; // packageimport
|
|
40 import dwtx.jface.text.source.IAnnotationModelListener; // packageimport
|
|
41 import dwtx.jface.text.source.IVerticalRuler; // packageimport
|
|
42 import dwtx.jface.text.source.DefaultAnnotationHover; // packageimport
|
|
43 import dwtx.jface.text.source.SourceViewer; // packageimport
|
|
44 import dwtx.jface.text.source.SourceViewerConfiguration; // packageimport
|
|
45 import dwtx.jface.text.source.AnnotationBarHoverManager; // packageimport
|
|
46 import dwtx.jface.text.source.CompositeRuler; // packageimport
|
|
47 import dwtx.jface.text.source.ImageUtilities; // packageimport
|
|
48 import dwtx.jface.text.source.VisualAnnotationModel; // packageimport
|
|
49 import dwtx.jface.text.source.IAnnotationModel; // packageimport
|
|
50 import dwtx.jface.text.source.ISourceViewerExtension3; // packageimport
|
|
51 import dwtx.jface.text.source.ILineDiffInfo; // packageimport
|
|
52 import dwtx.jface.text.source.VerticalRulerEvent; // packageimport
|
|
53 import dwtx.jface.text.source.ChangeRulerColumn; // packageimport
|
|
54 import dwtx.jface.text.source.ILineDiffer; // packageimport
|
|
55 import dwtx.jface.text.source.AnnotationModelEvent; // packageimport
|
|
56 import dwtx.jface.text.source.AnnotationColumn; // packageimport
|
|
57 import dwtx.jface.text.source.AnnotationRulerColumn; // packageimport
|
|
58 import dwtx.jface.text.source.IAnnotationHoverExtension; // packageimport
|
|
59 import dwtx.jface.text.source.AbstractRulerColumn; // packageimport
|
|
60 import dwtx.jface.text.source.ISourceViewerExtension; // packageimport
|
|
61 import dwtx.jface.text.source.AnnotationMap; // packageimport
|
|
62 import dwtx.jface.text.source.IVerticalRulerInfo; // packageimport
|
|
63 import dwtx.jface.text.source.IAnnotationModelExtension2; // packageimport
|
|
64 import dwtx.jface.text.source.LineRange; // packageimport
|
|
65 import dwtx.jface.text.source.IAnnotationAccessExtension2; // packageimport
|
|
66 import dwtx.jface.text.source.VerticalRuler; // packageimport
|
|
67 import dwtx.jface.text.source.JFaceTextMessages; // packageimport
|
|
68 import dwtx.jface.text.source.IOverviewRuler; // packageimport
|
|
69 import dwtx.jface.text.source.Annotation; // packageimport
|
|
70 import dwtx.jface.text.source.IVerticalRulerListener; // packageimport
|
|
71 import dwtx.jface.text.source.ISourceViewerExtension4; // packageimport
|
|
72 import dwtx.jface.text.source.AnnotationPainter; // packageimport
|
|
73 import dwtx.jface.text.source.IAnnotationHoverExtension2; // packageimport
|
|
74 import dwtx.jface.text.source.OverviewRuler; // packageimport
|
|
75 import dwtx.jface.text.source.OverviewRulerHoverManager; // packageimport
|
|
76
|
|
77
|
129
|
78 import dwt.dwthelper.utils;
|
|
79
|
|
80 import dwtx.jface.text.IDocument;
|
|
81 import dwtx.jface.text.IRegion;
|
|
82 import dwtx.jface.text.ITextOperationTarget;
|
|
83 import dwtx.jface.text.ITextViewer;
|
|
84
|
|
85
|
|
86 /**
|
|
87 * In addition to the text viewer functionality a source viewer supports:
|
|
88 * <ul>
|
|
89 * <li>visual annotations based on an annotation model
|
|
90 * <li>visual range indication
|
|
91 * <li>management of text viewer add-ons
|
|
92 * <li>explicit configuration
|
|
93 * </ul>
|
|
94 * It is assumed that range indication and visual annotations are shown inside
|
|
95 * the same presentation area. There are no assumptions about whether this area
|
|
96 * is different from the viewer's text widget.
|
|
97 * <p>
|
|
98 * As the visibility of visual annotations can dynamically be changed, it is
|
|
99 * assumed that the annotation presentation area can dynamically be hidden if it
|
|
100 * is different from the text widget.
|
|
101 * <p>
|
|
102 * In order to provide backward compatibility for clients of
|
|
103 * <code>ISourceViewer</code>, extension interfaces are used as a means of
|
|
104 * evolution. The following extension interfaces exist:
|
|
105 * <ul>
|
|
106 * <li>{@link dwtx.jface.text.source.ISourceViewerExtension} since version 2.1
|
|
107 * introducing the concept of an annotation overview.</li>
|
|
108 * <li>{@link dwtx.jface.text.source.ISourceViewerExtension2} since version 3.0
|
|
109 * allowing source viewers to roll back a previously performed configuration and
|
|
110 * allows access to the viewer's visual annotation model.</li>
|
|
111 * <li>{@link dwtx.jface.text.source.ISourceViewerExtension3} since version 3.2
|
|
112 * introducing the concept of a quick assist assistant and providing access
|
|
113 * to the quick assist invocation context as well as the current annotation hover.</li>
|
|
114 * <li>{@link dwtx.jface.text.source.ISourceViewerExtension4} since version 3.4
|
|
115 * introducing API to access a minimal set of content assistant APIs.</li>
|
|
116 * </ul></p>
|
|
117 * <p>
|
|
118 * Clients may implement this interface and its extension interfaces or use the
|
|
119 * default implementation provided by
|
|
120 * {@link dwtx.jface.text.source.SourceViewer}.</p>
|
|
121 *
|
|
122 * @see dwtx.jface.text.source.ISourceViewerExtension
|
|
123 * @see dwtx.jface.text.source.ISourceViewerExtension2
|
|
124 * @see dwtx.jface.text.source.ISourceViewerExtension3
|
|
125 * @see dwtx.jface.text.source.ISourceViewerExtension4
|
|
126 */
|
|
127 public interface ISourceViewer : ITextViewer {
|
|
128
|
|
129 /**
|
|
130 * Text operation code for requesting content assist to show completion
|
|
131 * proposals for the current insert position.
|
|
132 */
|
158
|
133 static const int CONTENTASSIST_PROPOSALS= ITextOperationTarget.STRIP_PREFIX + 1;
|
129
|
134
|
|
135 /**
|
|
136 * Text operation code for requesting content assist to show
|
|
137 * the content information for the current insert position.
|
|
138 */
|
158
|
139 static const int CONTENTASSIST_CONTEXT_INFORMATION= ITextOperationTarget.STRIP_PREFIX + 2;
|
129
|
140
|
|
141 /**
|
|
142 * Text operation code for formatting the selected text or complete document
|
|
143 * of this viewer if the selection is empty.
|
|
144 */
|
158
|
145 static const int FORMAT= ITextOperationTarget.STRIP_PREFIX + 3;
|
129
|
146
|
|
147 /**
|
|
148 * Text operation code for requesting information at the current insertion position.
|
|
149 * @since 2.0
|
|
150 */
|
158
|
151 static const int INFORMATION= ITextOperationTarget.STRIP_PREFIX + 4;
|
129
|
152
|
|
153 /*
|
|
154 * XXX: Cannot continue numbering due to operation codes used in ProjectionViewer
|
158
|
155 */
|
129
|
156
|
|
157 /**
|
|
158 * Text operation code for requesting quick assist. This will normally
|
|
159 * show quick assist and quick fix proposals for the current position.
|
|
160 * @since 3.2
|
|
161 */
|
158
|
162 static const int QUICK_ASSIST= ITextOperationTarget.STRIP_PREFIX + 10;
|
129
|
163
|
|
164 /**
|
|
165 * Configures the source viewer using the given configuration. Prior to 3.0 this
|
|
166 * method can only be called once. Since 3.0 this method can be called again
|
|
167 * after a call to {@link ISourceViewerExtension2#unconfigure()}.
|
|
168 *
|
|
169 * @param configuration the source viewer configuration to be used
|
|
170 */
|
|
171 void configure(SourceViewerConfiguration configuration);
|
|
172
|
|
173 /**
|
|
174 * Sets the annotation hover of this source viewer. The annotation hover
|
|
175 * provides the information to be displayed in a hover popup window
|
|
176 * if requested over the annotation presentation area. The annotation
|
|
177 * hover is assumed to be line oriented.
|
|
178 *
|
|
179 * @param annotationHover the hover to be used, <code>null</code> is a valid argument
|
|
180 */
|
|
181 void setAnnotationHover(IAnnotationHover annotationHover);
|
|
182
|
|
183 /**
|
|
184 * Sets the given document as this viewer's text model and the
|
|
185 * given annotation model as the model for this viewer's visual
|
|
186 * annotations. The presentation is accordingly updated. An appropriate
|
|
187 * <code>TextEvent</code> is issued. This text event does not carry
|
|
188 * a related document event.
|
|
189 *
|
|
190 * @param document the viewer's new input document
|
|
191 * @param annotationModel the model for the viewer's visual annotations
|
|
192 *
|
|
193 * @see ITextViewer#setDocument(IDocument)
|
|
194 */
|
|
195 void setDocument(IDocument document, IAnnotationModel annotationModel);
|
|
196
|
|
197 /**
|
|
198 * Sets the given document as this viewer's text model and the
|
|
199 * given annotation model as the model for this viewer's visual
|
|
200 * annotations. The presentation is accordingly updated whereby
|
|
201 * only the specified region is exposed. An appropriate
|
|
202 * <code>TextEvent</code> is issued. The text event does not carry a
|
|
203 * related document event. This method is a convenience method for
|
|
204 * <code>setDocument(document, annotationModel);setVisibleRegion(offset, length)</code>.
|
|
205 *
|
|
206 * @param document the new input document
|
|
207 * @param annotationModel the model of the viewer's visual annotations
|
|
208 * @param modelRangeOffset the offset of the model range
|
|
209 * @param modelRangeLength the length of the model range
|
|
210 *
|
|
211 * @see ITextViewer#setDocument(IDocument, int, int)
|
|
212 */
|
|
213 void setDocument(IDocument document, IAnnotationModel annotationModel, int modelRangeOffset, int modelRangeLength);
|
|
214
|
|
215 /**
|
|
216 * Returns this viewer's annotation model. Use
|
|
217 * {@link ISourceViewerExtension2#getVisualAnnotationModel()}in order to
|
|
218 * get access to the viewer's visual annotation model.
|
|
219 *
|
|
220 * @return this viewer's annotation model
|
|
221 */
|
|
222 IAnnotationModel getAnnotationModel();
|
|
223
|
|
224 /**
|
|
225 * Sets the annotation used by this viewer as range indicator. The
|
|
226 * range covered by this annotation is referred to as range indication.
|
|
227 *
|
|
228 * @param rangeIndicator the annotation to be used as this viewer's range indicator
|
|
229 */
|
|
230 void setRangeIndicator(Annotation rangeIndicator);
|
|
231
|
|
232 /**
|
|
233 * Sets the viewers's range indication to the specified range. Its is indicated
|
|
234 * whether the cursor should also be moved to the beginning of the specified range.
|
|
235 *
|
|
236 * @param offset the offset of the range
|
|
237 * @param length the length of the range
|
|
238 * @param moveCursor indicates whether the cursor should be moved to the given offset
|
|
239 */
|
|
240 void setRangeIndication(int offset, int length, bool moveCursor);
|
|
241
|
|
242 /**
|
|
243 * Returns the viewer's range indication.
|
|
244 *
|
|
245 * @return the viewer's range indication.
|
|
246 */
|
|
247 IRegion getRangeIndication();
|
|
248
|
|
249 /**
|
|
250 * Removes the viewer's range indication. There is no visible range indication
|
|
251 * after this method completed.
|
|
252 */
|
|
253 void removeRangeIndication();
|
|
254
|
|
255 /**
|
|
256 * Controls the visibility of annotations and in the case of separate
|
|
257 * presentation areas of text and annotations, the visibility of the
|
|
258 * annotation's presentation area.<p>
|
|
259 * By default, annotations and their presentation area are visible.
|
|
260 *
|
|
261 * @param show indicates the visibility of annotations
|
|
262 */
|
|
263 void showAnnotations(bool show);
|
|
264 }
|