129
|
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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.IDocumentExtension3;
|
|
14
|
131
|
15 import dwtx.jface.text.IDocumentPartitioningListener; // packageimport
|
|
16 import dwtx.jface.text.DefaultTextHover; // packageimport
|
|
17 import dwtx.jface.text.AbstractInformationControl; // packageimport
|
|
18 import dwtx.jface.text.TextUtilities; // packageimport
|
|
19 import dwtx.jface.text.IInformationControlCreatorExtension; // packageimport
|
|
20 import dwtx.jface.text.AbstractInformationControlManager; // packageimport
|
|
21 import dwtx.jface.text.ITextViewerExtension2; // packageimport
|
|
22 import dwtx.jface.text.IDocumentPartitioner; // packageimport
|
|
23 import dwtx.jface.text.DefaultIndentLineAutoEditStrategy; // packageimport
|
|
24 import dwtx.jface.text.ITextSelection; // packageimport
|
|
25 import dwtx.jface.text.Document; // packageimport
|
|
26 import dwtx.jface.text.FindReplaceDocumentAdapterContentProposalProvider; // packageimport
|
|
27 import dwtx.jface.text.ITextListener; // packageimport
|
|
28 import dwtx.jface.text.BadPartitioningException; // packageimport
|
|
29 import dwtx.jface.text.ITextViewerExtension5; // packageimport
|
|
30 import dwtx.jface.text.IDocumentPartitionerExtension3; // packageimport
|
|
31 import dwtx.jface.text.IUndoManager; // packageimport
|
|
32 import dwtx.jface.text.ITextHoverExtension2; // packageimport
|
|
33 import dwtx.jface.text.IRepairableDocument; // packageimport
|
|
34 import dwtx.jface.text.IRewriteTarget; // packageimport
|
|
35 import dwtx.jface.text.DefaultPositionUpdater; // packageimport
|
|
36 import dwtx.jface.text.RewriteSessionEditProcessor; // packageimport
|
|
37 import dwtx.jface.text.TextViewerHoverManager; // packageimport
|
|
38 import dwtx.jface.text.DocumentRewriteSession; // packageimport
|
|
39 import dwtx.jface.text.TextViewer; // packageimport
|
|
40 import dwtx.jface.text.ITextViewerExtension8; // packageimport
|
|
41 import dwtx.jface.text.RegExMessages; // packageimport
|
|
42 import dwtx.jface.text.IDelayedInputChangeProvider; // packageimport
|
|
43 import dwtx.jface.text.ITextOperationTargetExtension; // packageimport
|
|
44 import dwtx.jface.text.IWidgetTokenOwner; // packageimport
|
|
45 import dwtx.jface.text.IViewportListener; // packageimport
|
|
46 import dwtx.jface.text.GapTextStore; // packageimport
|
|
47 import dwtx.jface.text.MarkSelection; // packageimport
|
|
48 import dwtx.jface.text.IDocumentPartitioningListenerExtension; // packageimport
|
|
49 import dwtx.jface.text.IDocumentAdapterExtension; // packageimport
|
|
50 import dwtx.jface.text.IInformationControlExtension; // packageimport
|
|
51 import dwtx.jface.text.IDocumentPartitioningListenerExtension2; // packageimport
|
|
52 import dwtx.jface.text.DefaultDocumentAdapter; // packageimport
|
|
53 import dwtx.jface.text.ITextViewerExtension3; // packageimport
|
|
54 import dwtx.jface.text.IInformationControlCreator; // packageimport
|
|
55 import dwtx.jface.text.TypedRegion; // packageimport
|
|
56 import dwtx.jface.text.ISynchronizable; // packageimport
|
|
57 import dwtx.jface.text.IMarkRegionTarget; // packageimport
|
|
58 import dwtx.jface.text.TextViewerUndoManager; // packageimport
|
|
59 import dwtx.jface.text.IRegion; // packageimport
|
|
60 import dwtx.jface.text.IInformationControlExtension2; // packageimport
|
|
61 import dwtx.jface.text.IDocumentExtension4; // packageimport
|
|
62 import dwtx.jface.text.IDocumentExtension2; // packageimport
|
|
63 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport
|
|
64 import dwtx.jface.text.Assert; // packageimport
|
|
65 import dwtx.jface.text.DefaultInformationControl; // packageimport
|
|
66 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport
|
|
67 import dwtx.jface.text.DocumentClone; // packageimport
|
|
68 import dwtx.jface.text.DefaultUndoManager; // packageimport
|
|
69 import dwtx.jface.text.IFindReplaceTarget; // packageimport
|
|
70 import dwtx.jface.text.IAutoEditStrategy; // packageimport
|
|
71 import dwtx.jface.text.ILineTrackerExtension; // packageimport
|
|
72 import dwtx.jface.text.IUndoManagerExtension; // packageimport
|
|
73 import dwtx.jface.text.TextSelection; // packageimport
|
|
74 import dwtx.jface.text.DefaultAutoIndentStrategy; // packageimport
|
|
75 import dwtx.jface.text.IAutoIndentStrategy; // packageimport
|
|
76 import dwtx.jface.text.IPainter; // packageimport
|
|
77 import dwtx.jface.text.IInformationControl; // packageimport
|
|
78 import dwtx.jface.text.IInformationControlExtension3; // packageimport
|
|
79 import dwtx.jface.text.ITextViewerExtension6; // packageimport
|
|
80 import dwtx.jface.text.IInformationControlExtension4; // packageimport
|
|
81 import dwtx.jface.text.DefaultLineTracker; // packageimport
|
|
82 import dwtx.jface.text.IDocumentInformationMappingExtension; // packageimport
|
|
83 import dwtx.jface.text.IRepairableDocumentExtension; // packageimport
|
|
84 import dwtx.jface.text.ITextHover; // packageimport
|
|
85 import dwtx.jface.text.FindReplaceDocumentAdapter; // packageimport
|
|
86 import dwtx.jface.text.ILineTracker; // packageimport
|
|
87 import dwtx.jface.text.Line; // packageimport
|
|
88 import dwtx.jface.text.ITextViewerExtension; // packageimport
|
|
89 import dwtx.jface.text.IDocumentAdapter; // packageimport
|
|
90 import dwtx.jface.text.TextEvent; // packageimport
|
|
91 import dwtx.jface.text.BadLocationException; // packageimport
|
|
92 import dwtx.jface.text.AbstractDocument; // packageimport
|
|
93 import dwtx.jface.text.AbstractLineTracker; // packageimport
|
|
94 import dwtx.jface.text.TreeLineTracker; // packageimport
|
|
95 import dwtx.jface.text.ITextPresentationListener; // packageimport
|
|
96 import dwtx.jface.text.Region; // packageimport
|
|
97 import dwtx.jface.text.ITextViewer; // packageimport
|
|
98 import dwtx.jface.text.IDocumentInformationMapping; // packageimport
|
|
99 import dwtx.jface.text.MarginPainter; // packageimport
|
|
100 import dwtx.jface.text.IPaintPositionManager; // packageimport
|
|
101 import dwtx.jface.text.TextPresentation; // packageimport
|
|
102 import dwtx.jface.text.IFindReplaceTargetExtension; // packageimport
|
|
103 import dwtx.jface.text.ISlaveDocumentManagerExtension; // packageimport
|
|
104 import dwtx.jface.text.ISelectionValidator; // packageimport
|
|
105 import dwtx.jface.text.IDocumentExtension; // packageimport
|
|
106 import dwtx.jface.text.PropagatingFontFieldEditor; // packageimport
|
|
107 import dwtx.jface.text.ConfigurableLineTracker; // packageimport
|
|
108 import dwtx.jface.text.SlaveDocumentEvent; // packageimport
|
|
109 import dwtx.jface.text.IDocumentListener; // packageimport
|
|
110 import dwtx.jface.text.PaintManager; // packageimport
|
|
111 import dwtx.jface.text.IFindReplaceTargetExtension3; // packageimport
|
|
112 import dwtx.jface.text.ITextDoubleClickStrategy; // packageimport
|
|
113 import dwtx.jface.text.Position; // packageimport
|
|
114 import dwtx.jface.text.TextMessages; // packageimport
|
|
115 import dwtx.jface.text.CopyOnWriteTextStore; // packageimport
|
|
116 import dwtx.jface.text.WhitespaceCharacterPainter; // packageimport
|
|
117 import dwtx.jface.text.IPositionUpdater; // packageimport
|
|
118 import dwtx.jface.text.DefaultTextDoubleClickStrategy; // packageimport
|
|
119 import dwtx.jface.text.ListLineTracker; // packageimport
|
|
120 import dwtx.jface.text.ITextInputListener; // packageimport
|
|
121 import dwtx.jface.text.BadPositionCategoryException; // packageimport
|
|
122 import dwtx.jface.text.IWidgetTokenKeeperExtension; // packageimport
|
|
123 import dwtx.jface.text.IInputChangedListener; // packageimport
|
|
124 import dwtx.jface.text.ITextOperationTarget; // packageimport
|
|
125 import dwtx.jface.text.IDocumentInformationMappingExtension2; // packageimport
|
|
126 import dwtx.jface.text.ITextViewerExtension7; // packageimport
|
|
127 import dwtx.jface.text.IInformationControlExtension5; // packageimport
|
|
128 import dwtx.jface.text.IDocumentRewriteSessionListener; // packageimport
|
|
129 import dwtx.jface.text.JFaceTextUtil; // packageimport
|
|
130 import dwtx.jface.text.AbstractReusableInformationControlCreator; // packageimport
|
|
131 import dwtx.jface.text.TabsToSpacesConverter; // packageimport
|
|
132 import dwtx.jface.text.CursorLinePainter; // packageimport
|
|
133 import dwtx.jface.text.ITextHoverExtension; // packageimport
|
|
134 import dwtx.jface.text.IEventConsumer; // packageimport
|
|
135 import dwtx.jface.text.IDocument; // packageimport
|
|
136 import dwtx.jface.text.IWidgetTokenKeeper; // packageimport
|
|
137 import dwtx.jface.text.DocumentCommand; // packageimport
|
|
138 import dwtx.jface.text.TypedPosition; // packageimport
|
|
139 import dwtx.jface.text.IEditingSupportRegistry; // packageimport
|
|
140 import dwtx.jface.text.IDocumentPartitionerExtension; // packageimport
|
|
141 import dwtx.jface.text.AbstractHoverInformationControlManager; // packageimport
|
|
142 import dwtx.jface.text.IEditingSupport; // packageimport
|
|
143 import dwtx.jface.text.IMarkSelection; // packageimport
|
|
144 import dwtx.jface.text.ISlaveDocumentManager; // packageimport
|
|
145 import dwtx.jface.text.DocumentEvent; // packageimport
|
|
146 import dwtx.jface.text.DocumentPartitioningChangedEvent; // packageimport
|
|
147 import dwtx.jface.text.ITextStore; // packageimport
|
|
148 import dwtx.jface.text.JFaceTextMessages; // packageimport
|
|
149 import dwtx.jface.text.DocumentRewriteSessionEvent; // packageimport
|
|
150 import dwtx.jface.text.SequentialRewriteTextStore; // packageimport
|
|
151 import dwtx.jface.text.DocumentRewriteSessionType; // packageimport
|
|
152 import dwtx.jface.text.TextAttribute; // packageimport
|
|
153 import dwtx.jface.text.ITextViewerExtension4; // packageimport
|
|
154 import dwtx.jface.text.ITypedRegion; // packageimport
|
|
155
|
|
156
|
129
|
157 import dwt.dwthelper.utils;
|
|
158
|
|
159 /**
|
|
160 * Extension interface for {@link dwtx.jface.text.IDocument}.
|
|
161 * <p>
|
|
162 * Adds the concept of multiple partitionings and the concept of zero-length
|
|
163 * partitions in conjunction with open and delimited partitions. A delimited
|
|
164 * partition has a well defined start delimiter and a well defined end
|
|
165 * delimiter. Between two delimited partitions there may be an open partition of
|
|
166 * length zero.
|
|
167 * <p>
|
|
168 *
|
|
169 * In order to fulfill the contract of this interface, the document must be
|
|
170 * configured with a document partitioner implementing
|
|
171 * {@link dwtx.jface.text.IDocumentPartitionerExtension2}.
|
|
172 *
|
|
173 * @see dwtx.jface.text.IDocumentPartitionerExtension2
|
|
174 * @since 3.0
|
|
175 */
|
|
176 public interface IDocumentExtension3 {
|
|
177
|
|
178 /**
|
|
179 * The identifier of the default partitioning.
|
|
180 */
|
|
181 final static String DEFAULT_PARTITIONING= "__dftl_partitioning"; //$NON-NLS-1$
|
|
182
|
|
183
|
|
184 /**
|
|
185 * Returns the existing partitionings for this document. This includes
|
|
186 * the default partitioning.
|
|
187 *
|
|
188 * @return the existing partitionings for this document
|
|
189 */
|
|
190 String[] getPartitionings();
|
|
191
|
|
192 /**
|
|
193 * Returns the set of legal content types of document partitions for the given partitioning
|
|
194 * This set can be empty. The set can contain more content types than contained by the
|
|
195 * result of <code>getPartitioning(partitioning, 0, getLength())</code>.
|
|
196 *
|
|
197 * @param partitioning the partitioning for which to return the legal content types
|
|
198 * @return the set of legal content types
|
|
199 * @exception BadPartitioningException if partitioning is invalid for this document
|
|
200 */
|
|
201 String[] getLegalContentTypes(String partitioning) throws BadPartitioningException;
|
|
202
|
|
203
|
|
204 /**
|
|
205 * Returns the type of the document partition containing the given offset
|
|
206 * for the given partitioning. This is a convenience method for
|
|
207 * <code>getPartition(partitioning, offset, bool).getType()</code>.
|
|
208 * <p>
|
|
209 * If <code>preferOpenPartitions</code> is <code>true</code>,
|
|
210 * precedence is given to an open partition ending at <code>offset</code>
|
|
211 * over a delimited partition starting at <code>offset</code>. If it is
|
|
212 * <code>false</code>, precedence is given to the partition that does not
|
|
213 * end at <code>offset</code>.
|
|
214 * </p>
|
|
215 * This is only supported if the connected <code>IDocumentPartitioner</code>
|
|
216 * supports it, i.e. implements <code>IDocumentPartitionerExtension2</code>.
|
|
217 * Otherwise, <code>preferOpenPartitions</code> is ignored.
|
|
218 * </p>
|
|
219 *
|
|
220 * @param partitioning the partitioning
|
|
221 * @param offset the document offset
|
|
222 * @param preferOpenPartitions <code>true</code> if precedence should be
|
|
223 * given to a open partition ending at <code>offset</code> over a
|
|
224 * closed partition starting at <code>offset</code>
|
|
225 * @return the partition type
|
|
226 * @exception BadLocationException if offset is invalid in this document
|
|
227 * @exception BadPartitioningException if partitioning is invalid for this document
|
|
228 */
|
|
229 String getContentType(String partitioning, int offset, bool preferOpenPartitions) throws BadLocationException, BadPartitioningException;
|
|
230
|
|
231 /**
|
|
232 * Returns the document partition of the given partitioning in which the
|
|
233 * given offset is located.
|
|
234 * <p>
|
|
235 * If <code>preferOpenPartitions</code> is <code>true</code>,
|
|
236 * precedence is given to an open partition ending at <code>offset</code>
|
|
237 * over a delimited partition starting at <code>offset</code>. If it is
|
|
238 * <code>false</code>, precedence is given to the partition that does not
|
|
239 * end at <code>offset</code>.
|
|
240 * </p>
|
|
241 * This is only supported if the connected <code>IDocumentPartitioner</code>
|
|
242 * supports it, i.e. implements <code>IDocumentPartitionerExtension2</code>.
|
|
243 * Otherwise, <code>preferOpenPartitions</code> is ignored.
|
|
244 * </p>
|
|
245 *
|
|
246 * @param partitioning the partitioning
|
|
247 * @param offset the document offset
|
|
248 * @param preferOpenPartitions <code>true</code> if precedence should be
|
|
249 * given to a open partition ending at <code>offset</code> over a
|
|
250 * closed partition starting at <code>offset</code>
|
|
251 * @return a specification of the partition
|
|
252 * @exception BadLocationException if offset is invalid in this document
|
|
253 * @exception BadPartitioningException if partitioning is invalid for this document
|
|
254 */
|
|
255 ITypedRegion getPartition(String partitioning, int offset, bool preferOpenPartitions) throws BadLocationException, BadPartitioningException;
|
|
256
|
|
257 /**
|
|
258 * Computes the partitioning of the given document range based on the given
|
|
259 * partitioning type.
|
|
260 * <p>
|
|
261 * If <code>includeZeroLengthPartitions</code> is <code>true</code>, a
|
|
262 * zero-length partition of an open partition type (usually the default
|
|
263 * partition) is included between two closed partitions. If it is
|
|
264 * <code>false</code>, no zero-length partitions are included.
|
|
265 * </p>
|
|
266 * This is only supported if the connected <code>IDocumentPartitioner</code>
|
|
267 * supports it, i.e. implements <code>IDocumentPartitionerExtension2</code>.
|
|
268 * Otherwise, <code>includeZeroLengthPartitions</code> is ignored.
|
|
269 * </p>
|
|
270 *
|
|
271 * @param partitioning the document's partitioning type
|
|
272 * @param offset the document offset at which the range starts
|
|
273 * @param length the length of the document range
|
|
274 * @param includeZeroLengthPartitions <code>true</code> if zero-length
|
|
275 * partitions should be returned as part of the computed partitioning
|
|
276 * @return a specification of the range's partitioning
|
|
277 * @exception BadLocationException if the range is invalid in this document$
|
|
278 * @exception BadPartitioningException if partitioning is invalid for this document
|
|
279 */
|
|
280 ITypedRegion[] computePartitioning(String partitioning, int offset, int length, bool includeZeroLengthPartitions) throws BadLocationException, BadPartitioningException;
|
|
281
|
|
282 /**
|
|
283 * Sets this document's partitioner. The caller of this method is responsible for
|
|
284 * disconnecting the document's old partitioner from the document and to
|
|
285 * connect the new partitioner to the document. Informs all document partitioning
|
|
286 * listeners about this change.
|
|
287 *
|
|
288 * @param partitioning the partitioning for which to set the partitioner
|
|
289 * @param partitioner the document's new partitioner
|
|
290 * @see IDocumentPartitioningListener
|
|
291 */
|
|
292 void setDocumentPartitioner(String partitioning, IDocumentPartitioner partitioner);
|
|
293
|
|
294 /**
|
|
295 * Returns the partitioner for the given partitioning or <code>null</code> if
|
|
296 * no partitioner is registered.
|
|
297 *
|
|
298 * @param partitioning the partitioning for which to set the partitioner
|
|
299 * @return the partitioner for the given partitioning
|
|
300 */
|
|
301 IDocumentPartitioner getDocumentPartitioner(String partitioning);
|
|
302 }
|