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.PaintManager;
|
|
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.IFindReplaceTargetExtension3; // packageimport
|
|
111 import dwtx.jface.text.ITextDoubleClickStrategy; // packageimport
|
|
112 import dwtx.jface.text.IDocumentExtension3; // 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 import java.util.ArrayList;
|
|
161 import java.util.Iterator;
|
|
162 import java.util.List;
|
|
163
|
|
164 import dwt.custom.StyledText;
|
|
165 import dwt.events.KeyEvent;
|
|
166 import dwt.events.KeyListener;
|
|
167 import dwt.events.MouseEvent;
|
|
168 import dwt.events.MouseListener;
|
|
169 import dwt.widgets.Control;
|
|
170 import dwtx.jface.viewers.ISelectionChangedListener;
|
|
171 import dwtx.jface.viewers.ISelectionProvider;
|
|
172 import dwtx.jface.viewers.SelectionChangedEvent;
|
|
173
|
|
174
|
|
175 /**
|
|
176 * Manages the {@link dwtx.jface.text.IPainter} object registered with an
|
|
177 * {@link dwtx.jface.text.ITextViewer}.
|
|
178 * <p>
|
|
179 * Clients usually instantiate and configure objects of this type.</p>
|
|
180 *
|
|
181 * @since 2.1
|
|
182 */
|
|
183 public final class PaintManager : KeyListener, MouseListener, ISelectionChangedListener, ITextListener, ITextInputListener {
|
|
184
|
|
185 /**
|
|
186 * Position updater used by the position manager. This position updater differs from the default position
|
|
187 * updater in that it extends a position when an insertion happens at the position's offset and right behind
|
|
188 * the position.
|
|
189 */
|
|
190 static class PaintPositionUpdater : DefaultPositionUpdater {
|
|
191
|
|
192 /**
|
|
193 * Creates the position updater for the given category.
|
|
194 *
|
|
195 * @param category the position category
|
|
196 */
|
|
197 protected PaintPositionUpdater(String category) {
|
|
198 super(category);
|
|
199 }
|
|
200
|
|
201 /**
|
|
202 * If an insertion happens at a position's offset, the
|
|
203 * position is extended rather than shifted. Also, if something is added
|
|
204 * right behind the end of the position, the position is extended rather
|
|
205 * than kept stable.
|
|
206 */
|
|
207 protected void adaptToInsert() {
|
|
208
|
|
209 int myStart= fPosition.offset;
|
|
210 int myEnd= fPosition.offset + fPosition.length;
|
|
211 myEnd= Math.max(myStart, myEnd);
|
|
212
|
|
213 int yoursStart= fOffset;
|
|
214 int yoursEnd= fOffset + fReplaceLength;// - 1;
|
|
215 yoursEnd= Math.max(yoursStart, yoursEnd);
|
|
216
|
|
217 if (myEnd < yoursStart)
|
|
218 return;
|
|
219
|
|
220 if (myStart <= yoursStart)
|
|
221 fPosition.length += fReplaceLength;
|
|
222 else
|
|
223 fPosition.offset += fReplaceLength;
|
|
224 }
|
|
225 }
|
|
226
|
|
227 /**
|
|
228 * The paint position manager used by this paint manager. The paint position
|
|
229 * manager is installed on a single document and control the creation/disposed
|
|
230 * and updating of a position category that will be used for managing positions.
|
|
231 */
|
|
232 static class PositionManager : IPaintPositionManager {
|
|
233
|
|
234 // /** The document this position manager works on */
|
|
235 private IDocument fDocument;
|
|
236 /** The position updater used for the managing position category */
|
|
237 private IPositionUpdater fPositionUpdater;
|
|
238 /** The managing position category */
|
|
239 private String fCategory;
|
|
240
|
|
241 /**
|
|
242 * Creates a new position manager. Initializes the managing
|
|
243 * position category using its class name and its hash value.
|
|
244 */
|
|
245 public PositionManager() {
|
|
246 fCategory= getClass().getName() + hashCode();
|
|
247 fPositionUpdater= new PaintPositionUpdater(fCategory);
|
|
248 }
|
|
249
|
|
250 /**
|
|
251 * Installs this position manager in the given document. The position manager stays
|
|
252 * active until <code>uninstall</code> or <code>dispose</code>
|
|
253 * is called.
|
|
254 *
|
|
255 * @param document the document to be installed on
|
|
256 */
|
|
257 public void install(IDocument document) {
|
|
258 fDocument= document;
|
|
259 fDocument.addPositionCategory(fCategory);
|
|
260 fDocument.addPositionUpdater(fPositionUpdater);
|
|
261 }
|
|
262
|
|
263 /**
|
|
264 * Disposes this position manager. The position manager is automatically
|
|
265 * removed from the document it has previously been installed
|
|
266 * on.
|
|
267 */
|
|
268 public void dispose() {
|
|
269 uninstall(fDocument);
|
|
270 }
|
|
271
|
|
272 /**
|
|
273 * Uninstalls this position manager form the given document. If the position
|
|
274 * manager has no been installed on this document, this method is without effect.
|
|
275 *
|
|
276 * @param document the document form which to uninstall
|
|
277 */
|
|
278 public void uninstall(IDocument document) {
|
|
279 if (document is fDocument && document !is null) {
|
|
280 try {
|
|
281 fDocument.removePositionUpdater(fPositionUpdater);
|
|
282 fDocument.removePositionCategory(fCategory);
|
|
283 } catch (BadPositionCategoryException x) {
|
|
284 // should not happen
|
|
285 }
|
|
286 fDocument= null;
|
|
287 }
|
|
288 }
|
|
289
|
|
290 /*
|
|
291 * @see IPositionManager#addManagedPosition(Position)
|
|
292 */
|
|
293 public void managePosition(Position position) {
|
|
294 try {
|
|
295 fDocument.addPosition(fCategory, position);
|
|
296 } catch (BadPositionCategoryException x) {
|
|
297 // should not happen
|
|
298 } catch (BadLocationException x) {
|
|
299 // should not happen
|
|
300 }
|
|
301 }
|
|
302
|
|
303 /*
|
|
304 * @see IPositionManager#removeManagedPosition(Position)
|
|
305 */
|
|
306 public void unmanagePosition(Position position) {
|
|
307 try {
|
|
308 fDocument.removePosition(fCategory, position);
|
|
309 } catch (BadPositionCategoryException x) {
|
|
310 // should not happen
|
|
311 }
|
|
312 }
|
|
313 }
|
|
314
|
|
315
|
|
316 /** The painters managed by this paint manager. */
|
|
317 private List fPainters= new ArrayList(2);
|
|
318 /** The position manager used by this paint manager */
|
|
319 private PositionManager fManager;
|
|
320 /** The associated text viewer */
|
|
321 private ITextViewer fTextViewer;
|
|
322
|
|
323 /**
|
|
324 * Creates a new paint manager for the given text viewer.
|
|
325 *
|
|
326 * @param textViewer the text viewer associated to this newly created paint manager
|
|
327 */
|
|
328 public PaintManager(ITextViewer textViewer) {
|
|
329 fTextViewer= textViewer;
|
|
330 }
|
|
331
|
|
332
|
|
333 /**
|
|
334 * Adds the given painter to the list of painters managed by this paint manager.
|
|
335 * If the painter is already registered with this paint manager, this method is
|
|
336 * without effect.
|
|
337 *
|
|
338 * @param painter the painter to be added
|
|
339 */
|
|
340 public void addPainter(IPainter painter) {
|
|
341 if (!fPainters.contains(painter)) {
|
|
342 fPainters.add(painter);
|
|
343 if (fPainters.size() is 1)
|
|
344 install();
|
|
345 painter.setPositionManager(fManager);
|
|
346 painter.paint(IPainter.INTERNAL);
|
|
347 }
|
|
348 }
|
|
349
|
|
350 /**
|
|
351 * Removes the given painter from the list of painters managed by this
|
|
352 * paint manager. If the painter has not previously been added to this
|
|
353 * paint manager, this method is without effect.
|
|
354 *
|
|
355 * @param painter the painter to be removed
|
|
356 */
|
|
357 public void removePainter(IPainter painter) {
|
|
358 if (fPainters.remove(painter)) {
|
|
359 painter.deactivate(true);
|
|
360 painter.setPositionManager(null);
|
|
361 }
|
|
362 if (fPainters.size() is 0)
|
|
363 dispose();
|
|
364 }
|
|
365
|
|
366 /**
|
|
367 * Installs/activates this paint manager. Is called as soon as the
|
|
368 * first painter is to be managed by this paint manager.
|
|
369 */
|
|
370 private void install() {
|
|
371
|
|
372 fManager= new PositionManager();
|
|
373 if (fTextViewer.getDocument() !is null)
|
|
374 fManager.install(fTextViewer.getDocument());
|
|
375
|
|
376 fTextViewer.addTextInputListener(this);
|
|
377
|
|
378 addListeners();
|
|
379 }
|
|
380
|
|
381 /**
|
|
382 * Installs our listener set on the text viewer and the text widget,
|
|
383 * respectively.
|
|
384 */
|
|
385 private void addListeners() {
|
|
386 ISelectionProvider provider= fTextViewer.getSelectionProvider();
|
|
387 provider.addSelectionChangedListener(this);
|
|
388
|
|
389 fTextViewer.addTextListener(this);
|
|
390
|
|
391 StyledText text= fTextViewer.getTextWidget();
|
|
392 text.addKeyListener(this);
|
|
393 text.addMouseListener(this);
|
|
394 }
|
|
395
|
|
396 /**
|
|
397 * Disposes this paint manager. The paint manager uninstalls itself
|
|
398 * and clears all registered painters. This method is also called when the
|
|
399 * last painter is removed from the list of managed painters.
|
|
400 */
|
|
401 public void dispose() {
|
|
402
|
|
403 if (fManager !is null) {
|
|
404 fManager.dispose();
|
|
405 fManager= null;
|
|
406 }
|
|
407
|
|
408 for (Iterator e = fPainters.iterator(); e.hasNext();)
|
|
409 ((IPainter) e.next()).dispose();
|
|
410 fPainters.clear();
|
|
411
|
|
412 fTextViewer.removeTextInputListener(this);
|
|
413
|
|
414 removeListeners();
|
|
415 }
|
|
416
|
|
417 /**
|
|
418 * Removes our set of listeners from the text viewer and widget,
|
|
419 * respectively.
|
|
420 */
|
|
421 private void removeListeners() {
|
|
422 ISelectionProvider provider= fTextViewer.getSelectionProvider();
|
|
423 if (provider !is null)
|
|
424 provider.removeSelectionChangedListener(this);
|
|
425
|
|
426 fTextViewer.removeTextListener(this);
|
|
427
|
|
428 StyledText text= fTextViewer.getTextWidget();
|
|
429 if (text !is null && !text.isDisposed()) {
|
|
430 text.removeKeyListener(this);
|
|
431 text.removeMouseListener(this);
|
|
432 }
|
|
433 }
|
|
434
|
|
435 /**
|
|
436 * Triggers all registered painters for the given reason.
|
|
437 *
|
|
438 * @param reason the reason
|
|
439 * @see IPainter
|
|
440 */
|
|
441 private void paint(int reason) {
|
|
442 for (Iterator e = fPainters.iterator(); e.hasNext();)
|
|
443 ((IPainter) e.next()).paint(reason);
|
|
444 }
|
|
445
|
|
446 /*
|
|
447 * @see KeyListener#keyPressed(KeyEvent)
|
|
448 */
|
|
449 public void keyPressed(KeyEvent e) {
|
|
450 paint(IPainter.KEY_STROKE);
|
|
451 }
|
|
452
|
|
453 /*
|
|
454 * @see KeyListener#keyReleased(KeyEvent)
|
|
455 */
|
|
456 public void keyReleased(KeyEvent e) {
|
|
457 }
|
|
458
|
|
459 /*
|
|
460 * @see MouseListener#mouseDoubleClick(MouseEvent)
|
|
461 */
|
|
462 public void mouseDoubleClick(MouseEvent e) {
|
|
463 }
|
|
464
|
|
465 /*
|
|
466 * @see MouseListener#mouseDown(MouseEvent)
|
|
467 */
|
|
468 public void mouseDown(MouseEvent e) {
|
|
469 paint(IPainter.MOUSE_BUTTON);
|
|
470 }
|
|
471
|
|
472 /*
|
|
473 * @see MouseListener#mouseUp(MouseEvent)
|
|
474 */
|
|
475 public void mouseUp(MouseEvent e) {
|
|
476 }
|
|
477
|
|
478 /*
|
|
479 * @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
|
|
480 */
|
|
481 public void selectionChanged(SelectionChangedEvent event) {
|
|
482 paint(IPainter.SELECTION);
|
|
483 }
|
|
484
|
|
485 /*
|
|
486 * @see ITextListener#textChanged(TextEvent)
|
|
487 */
|
|
488 public void textChanged(TextEvent event) {
|
|
489
|
|
490 if (!event.getViewerRedrawState())
|
|
491 return;
|
|
492
|
|
493 Control control= fTextViewer.getTextWidget();
|
|
494 if (control !is null) {
|
|
495 control.getDisplay().asyncExec(new Runnable() {
|
|
496 public void run() {
|
|
497 if (fTextViewer !is null)
|
|
498 paint(IPainter.TEXT_CHANGE);
|
|
499 }
|
|
500 });
|
|
501 }
|
|
502 }
|
|
503
|
|
504 /*
|
|
505 * @see ITextInputListener#inputDocumentAboutToBeChanged(IDocument, IDocument)
|
|
506 */
|
|
507 public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
|
|
508 if (oldInput !is null) {
|
|
509 for (Iterator e = fPainters.iterator(); e.hasNext();)
|
|
510 ((IPainter) e.next()).deactivate(false);
|
|
511 fManager.uninstall(oldInput);
|
|
512 removeListeners();
|
|
513 }
|
|
514 }
|
|
515
|
|
516 /*
|
|
517 * @see ITextInputListener#inputDocumentChanged(IDocument, IDocument)
|
|
518 */
|
|
519 public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
|
|
520 if (newInput !is null) {
|
|
521 fManager.install(newInput);
|
|
522 paint(IPainter.TEXT_CHANGE);
|
|
523 addListeners();
|
|
524 }
|
|
525 }
|
|
526 }
|
|
527
|