Mercurial > projects > dwt-addons
comparison dwtx/jface/text/TextViewer.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | f8d52b926852 |
children | 862b05e0334a |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
58 import dwtx.jface.text.IRegion; // packageimport | 58 import dwtx.jface.text.IRegion; // packageimport |
59 import dwtx.jface.text.IInformationControlExtension2; // packageimport | 59 import dwtx.jface.text.IInformationControlExtension2; // packageimport |
60 import dwtx.jface.text.IDocumentExtension4; // packageimport | 60 import dwtx.jface.text.IDocumentExtension4; // packageimport |
61 import dwtx.jface.text.IDocumentExtension2; // packageimport | 61 import dwtx.jface.text.IDocumentExtension2; // packageimport |
62 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport | 62 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport |
63 import dwtx.jface.text.Assert; // packageimport | |
64 import dwtx.jface.text.DefaultInformationControl; // packageimport | 63 import dwtx.jface.text.DefaultInformationControl; // packageimport |
65 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport | 64 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport |
66 import dwtx.jface.text.DocumentClone; // packageimport | 65 import dwtx.jface.text.DocumentClone; // packageimport |
67 import dwtx.jface.text.DefaultUndoManager; // packageimport | 66 import dwtx.jface.text.DefaultUndoManager; // packageimport |
68 import dwtx.jface.text.IFindReplaceTarget; // packageimport | 67 import dwtx.jface.text.IFindReplaceTarget; // packageimport |
155 | 154 |
156 import dwt.dwthelper.utils; | 155 import dwt.dwthelper.utils; |
157 import dwtx.dwtxhelper.Collection; | 156 import dwtx.dwtxhelper.Collection; |
158 import dwtx.dwtxhelper.regex; | 157 import dwtx.dwtxhelper.regex; |
159 import tango.text.convert.Format; | 158 import tango.text.convert.Format; |
159 import tango.core.Thread; | |
160 | 160 |
161 import dwt.DWT; | 161 import dwt.DWT; |
162 import dwt.custom.LineBackgroundEvent; | 162 import dwt.custom.LineBackgroundEvent; |
163 import dwt.custom.LineBackgroundListener; | 163 import dwt.custom.LineBackgroundListener; |
164 import dwt.custom.MovementEvent; | 164 import dwt.custom.MovementEvent; |
238 public class TextViewer : Viewer , | 238 public class TextViewer : Viewer , |
239 ITextViewer, ITextViewerExtension, ITextViewerExtension2, ITextViewerExtension4, ITextViewerExtension6, ITextViewerExtension7, ITextViewerExtension8, | 239 ITextViewer, ITextViewerExtension, ITextViewerExtension2, ITextViewerExtension4, ITextViewerExtension6, ITextViewerExtension7, ITextViewerExtension8, |
240 IEditingSupportRegistry, ITextOperationTarget, ITextOperationTargetExtension, | 240 IEditingSupportRegistry, ITextOperationTarget, ITextOperationTargetExtension, |
241 IWidgetTokenOwner, IWidgetTokenOwnerExtension, IPostSelectionProvider { | 241 IWidgetTokenOwner, IWidgetTokenOwnerExtension, IPostSelectionProvider { |
242 | 242 |
243 alias Viewer.fireSelectionChanged fireSelectionChanged; | |
244 | |
243 /** Internal flag to indicate the debug state. */ | 245 /** Internal flag to indicate the debug state. */ |
244 public static const bool TRACE_ERRORS= false; | 246 public static const bool TRACE_ERRORS= false; |
245 /** Internal flag to indicate the debug state. */ | 247 /** Internal flag to indicate the debug state. */ |
246 private static const bool TRACE_DOUBLE_CLICK= false; | 248 private static const bool TRACE_DOUBLE_CLICK= false; |
247 | 249 |
365 StyledText textWidget= getTextWidget(); | 367 StyledText textWidget= getTextWidget(); |
366 s.doubleClicked(this.outer); | 368 s.doubleClicked(this.outer); |
367 fDoubleClickSelection= textWidget.getSelection(); | 369 fDoubleClickSelection= textWidget.getSelection(); |
368 event.newOffset= fDoubleClickSelection.x; | 370 event.newOffset= fDoubleClickSelection.x; |
369 if (TRACE_DOUBLE_CLICK) | 371 if (TRACE_DOUBLE_CLICK) |
370 System.out_.println("- setting selection: x= " + fDoubleClickSelection.x + ", y= " + fDoubleClickSelection.y); //$NON-NLS-1$ //$NON-NLS-2$ | 372 System.out_.println(Format("- setting selection: x= {}, y= {}", fDoubleClickSelection.x, fDoubleClickSelection.y)); //$NON-NLS-1$ //$NON-NLS-2$ |
371 } | 373 } |
372 } else { | 374 } else { |
373 if (fDoubleClickSelection.x <= event.offset && event.offset <= fDoubleClickSelection.y) | 375 if (fDoubleClickSelection.x <= event.offset && event.offset <= fDoubleClickSelection.y) |
374 event.newOffset= fDoubleClickSelection.x; | 376 event.newOffset= fDoubleClickSelection.x; |
375 } | 377 } |
381 * | 383 * |
382 * @param e the event to print | 384 * @param e the event to print |
383 * @since 3.3 | 385 * @since 3.3 |
384 */ | 386 */ |
385 private void print(MovementEvent e) { | 387 private void print(MovementEvent e) { |
386 System.out_.println("line offset: " + e.lineOffset); //$NON-NLS-1$ | 388 System.out_.println(Format("line offset: {}", e.lineOffset)); //$NON-NLS-1$ |
387 System.out_.println("line: " + e.lineText); //$NON-NLS-1$ | 389 System.out_.println(Format("line: {}", e.lineText)); //$NON-NLS-1$ |
388 System.out_.println("type: " + e.movement); //$NON-NLS-1$ | 390 System.out_.println(Format("type: {}", e.movement)); //$NON-NLS-1$ |
389 System.out_.println("offset: " + e.offset); //$NON-NLS-1$ | 391 System.out_.println(Format("offset: {}", e.offset)); //$NON-NLS-1$ |
390 System.out_.println("newOffset: " + e.newOffset); //$NON-NLS-1$ | 392 System.out_.println(Format("newOffset: {}", e.newOffset)); //$NON-NLS-1$ |
391 } | 393 } |
392 | 394 |
393 /** | 395 /** |
394 * Monitors the area of the viewer's document that is visible in the viewer. | 396 * Monitors the area of the viewer's document that is visible in the viewer. |
395 * If the area might have changed, it informs the text viewer about this | 397 * If the area might have changed, it informs the text viewer about this |
587 index= i; | 589 index= i; |
588 } | 590 } |
589 } | 591 } |
590 | 592 |
591 /** List of registered verify key listeners. */ | 593 /** List of registered verify key listeners. */ |
592 private List fListeners= new ArrayList(); | 594 private List fListeners; |
593 /** List of pending batches. */ | 595 /** List of pending batches. */ |
594 private List fBatched= new ArrayList(); | 596 private List fBatched; |
595 /** The reentrance count. */ | 597 /** The reentrance count. */ |
596 private int fReentranceCount= 0; | 598 private int fReentranceCount= 0; |
599 | |
600 this(){ | |
601 fListeners= new ArrayList(); | |
602 fBatched= new ArrayList(); | |
603 } | |
597 | 604 |
598 /* | 605 /* |
599 * @see VerifyKeyListener#verifyKey(VerifyEvent) | 606 * @see VerifyKeyListener#verifyKey(VerifyEvent) |
600 */ | 607 */ |
601 public void verifyKey(VerifyEvent event) { | 608 public void verifyKey(VerifyEvent event) { |
661 int idx= -1; | 668 int idx= -1; |
662 | 669 |
663 // find index based on identity | 670 // find index based on identity |
664 int size= fListeners.size(); | 671 int size= fListeners.size(); |
665 for (int i= 0; i < size; i++) { | 672 for (int i= 0; i < size; i++) { |
666 if (listener is fListeners.get(i)) { | 673 if (cast(Object)listener is fListeners.get(i)) { |
667 idx= i; | 674 idx= i; |
668 break; | 675 break; |
669 } | 676 } |
670 } | 677 } |
671 | 678 |
674 | 681 |
675 if (idx !is -1) | 682 if (idx !is -1) |
676 fListeners.remove(idx); | 683 fListeners.remove(idx); |
677 | 684 |
678 if (index > fListeners.size()) | 685 if (index > fListeners.size()) |
679 fListeners.add(listener); | 686 fListeners.add(cast(Object)listener); |
680 else | 687 else |
681 fListeners.add(index, listener); | 688 fListeners.add(index, cast(Object)listener); |
682 } | 689 } |
683 | 690 |
684 if (size is 0) // checking old size, i.e. current size is size + 1 | 691 if (size is 0) // checking old size, i.e. current size is size + 1 |
685 install(); | 692 install(); |
686 } | 693 } |
702 | 709 |
703 } else { | 710 } else { |
704 | 711 |
705 int size= fListeners.size(); | 712 int size= fListeners.size(); |
706 for (int i= 0; i < size; i++) { | 713 for (int i= 0; i < size; i++) { |
707 if (listener is fListeners.get(i)) { | 714 if (cast(Object)listener is fListeners.get(i)) { |
708 fListeners.remove(i); | 715 fListeners.remove(i); |
709 if (size is 1) // checking old size, i.e. current size is size - 1 | 716 if (size is 1) // checking old size, i.e. current size is size - 1 |
710 uninstall(); | 717 uninstall(); |
711 return; | 718 return; |
712 } | 719 } |
890 * @since 2.0 | 897 * @since 2.0 |
891 */ | 898 */ |
892 public void update(DocumentEvent event) { | 899 public void update(DocumentEvent event) { |
893 int offset= event.getOffset(); | 900 int offset= event.getOffset(); |
894 int length= event.getLength(); | 901 int length= event.getLength(); |
895 int delta= event.getText().length() - length; | 902 int delta= event.getText().length - length; |
896 | 903 |
897 if (offset < fPosition.getOffset()) | 904 if (offset < fPosition.getOffset()) |
898 fPosition.setOffset(fPosition.getOffset() + delta); | 905 fPosition.setOffset(fPosition.getOffset() + delta); |
899 else if (offset < fPosition.getOffset() + fPosition.getLength()) | 906 else if (offset < fPosition.getOffset() + fPosition.getLength()) |
900 fPosition.setLength(fPosition.getLength() + delta); | 907 fPosition.setLength(fPosition.getLength() + delta); |
1206 * | 1213 * |
1207 * @param contentType the content type | 1214 * @param contentType the content type |
1208 * @param stateMask the state mask | 1215 * @param stateMask the state mask |
1209 */ | 1216 */ |
1210 protected this(String contentType, int stateMask) { | 1217 protected this(String contentType, int stateMask) { |
1211 Assert.isNotNull(contentType); | 1218 //Assert.isNotNull(contentType); |
1212 fContentType= contentType; | 1219 fContentType= contentType; |
1213 fStateMask= stateMask; | 1220 fStateMask= stateMask; |
1214 } | 1221 } |
1215 | 1222 |
1216 /* | 1223 /* |
1217 * @see java.lang.Object#equals(java.lang.Object) | 1224 * @see java.lang.Object#equals(java.lang.Object) |
1218 */ | 1225 */ |
1219 public bool equals(Object obj) { | 1226 public override int opEquals(Object obj) { |
1220 if (obj is null || obj.getClass() !is getClass()) | 1227 if (obj is null || obj.classinfo !is this.classinfo ) |
1221 return false; | 1228 return false; |
1222 TextHoverKey textHoverKey= cast(TextHoverKey)obj; | 1229 TextHoverKey textHoverKey= cast(TextHoverKey)obj; |
1223 return textHoverKey.fContentType.equals(fContentType) && textHoverKey.fStateMask is fStateMask; | 1230 return textHoverKey.fContentType.equals(fContentType) && textHoverKey.fStateMask is fStateMask; |
1224 } | 1231 } |
1225 | 1232 |
1226 /* | 1233 /* |
1227 * @see java.lang.Object#hashCode() | 1234 * @see java.lang.Object#hashCode() |
1228 */ | 1235 */ |
1229 public override hash_t toHash() { | 1236 public override hash_t toHash() { |
1230 return fStateMask << 16 | fContentType.toHash(); | 1237 return fStateMask << 16 | .toHash(fContentType); |
1231 } | 1238 } |
1232 | 1239 |
1233 /** | 1240 /** |
1234 * Sets the state mask of this text hover key. | 1241 * Sets the state mask of this text hover key. |
1235 * | 1242 * |
1361 private void connect(IDocument document) { | 1368 private void connect(IDocument document) { |
1362 Assert.isLegal(document !is null); | 1369 Assert.isLegal(document !is null); |
1363 Assert.isLegal(!isConnected()); | 1370 Assert.isLegal(!isConnected()); |
1364 fUpdaterDocument= document; | 1371 fUpdaterDocument= document; |
1365 try { | 1372 try { |
1366 fUpdaterCategory= SELECTION_POSITION_CATEGORY + toHash(); | 1373 fUpdaterCategory= SELECTION_POSITION_CATEGORY ~ Integer.toString(toHash()); |
1367 fUpdater= new NonDeletingPositionUpdater(fUpdaterCategory); | 1374 fUpdater= new NonDeletingPositionUpdater(fUpdaterCategory); |
1368 fUpdaterDocument.addPositionCategory(fUpdaterCategory); | 1375 fUpdaterDocument.addPositionCategory(fUpdaterCategory); |
1369 fUpdaterDocument.addPositionUpdater(fUpdater); | 1376 fUpdaterDocument.addPositionUpdater(fUpdater); |
1370 | 1377 |
1371 Point selectionRange= getSelectedRange(); | 1378 Point selectionRange= getSelectedRange(); |
1408 */ | 1415 */ |
1409 private void updatePosition(Position position, int offset, int length) { | 1416 private void updatePosition(Position position, int offset, int length) { |
1410 position.setOffset(offset); | 1417 position.setOffset(offset); |
1411 position.setLength(length); | 1418 position.setLength(length); |
1412 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=32795 | 1419 // http://bugs.eclipse.org/bugs/show_bug.cgi?id=32795 |
1413 position.isDeleted= false; | 1420 position.isDeleted_= false; |
1414 } | 1421 } |
1415 | 1422 |
1416 /** | 1423 /** |
1417 * Returns the document line to keep visually stable. If the caret line is (partially) | 1424 * Returns the document line to keep visually stable. If the caret line is (partially) |
1418 * visible, it is returned, otherwise the topmost (partially) visible line is returned. | 1425 * visible, it is returned, otherwise the topmost (partially) visible line is returned. |
1640 protected Position fMarkPosition; | 1647 protected Position fMarkPosition; |
1641 /** | 1648 /** |
1642 * The mark position category. | 1649 * The mark position category. |
1643 * @since 2.0 | 1650 * @since 2.0 |
1644 */ | 1651 */ |
1645 private const String MARK_POSITION_CATEGORY; | 1652 private /+const+/ String MARK_POSITION_CATEGORY; |
1646 /** | 1653 /** |
1647 * The mark position updater | 1654 * The mark position updater |
1648 * @since 2.0 | 1655 * @since 2.0 |
1649 */ | 1656 */ |
1650 private const IPositionUpdater fMarkPositionUpdater; | 1657 private /+const+/ IPositionUpdater fMarkPositionUpdater; |
1651 /** | 1658 /** |
1652 * The flag indicating the redraw behavior | 1659 * The flag indicating the redraw behavior |
1653 * @since 2.0 | 1660 * @since 2.0 |
1654 */ | 1661 */ |
1655 private int fRedrawCounter= 0; | 1662 private int fRedrawCounter= 0; |
1675 private List fPostSelectionChangedListeners; | 1682 private List fPostSelectionChangedListeners; |
1676 /** | 1683 /** |
1677 * Queued post selection changed events count. | 1684 * Queued post selection changed events count. |
1678 * @since 3.0 | 1685 * @since 3.0 |
1679 */ | 1686 */ |
1680 private const int[] fNumberOfPostSelectionChangedEvents= new int[1]; | 1687 private /+const+/ int[] fNumberOfPostSelectionChangedEvents; |
1681 /** | 1688 /** |
1682 * Last selection range sent to post selection change listeners. | 1689 * Last selection range sent to post selection change listeners. |
1683 * @since 3.0 | 1690 * @since 3.0 |
1684 */ | 1691 */ |
1685 private IRegion fLastSentPostSelectionChange; | 1692 private IRegion fLastSentPostSelectionChange; |
1686 /** | 1693 /** |
1687 * The set of registered editor helpers. | 1694 * The set of registered editor helpers. |
1688 * @since 3.1 | 1695 * @since 3.1 |
1689 */ | 1696 */ |
1690 private Set fEditorHelpers= new HashSet(); | 1697 private Set fEditorHelpers; |
1691 /** | 1698 /** |
1692 * The internal rewrite session listener. | 1699 * The internal rewrite session listener. |
1693 * @since 3.1 | 1700 * @since 3.1 |
1694 */ | 1701 */ |
1695 private DocumentRewriteSessionListener fDocumentRewriteSessionListener; | 1702 private DocumentRewriteSessionListener fDocumentRewriteSessionListener; |
1793 fDocumentCommand= new DocumentCommand(); | 1800 fDocumentCommand= new DocumentCommand(); |
1794 fVerifyKeyListenersManager= new VerifyKeyListenersManager(); | 1801 fVerifyKeyListenersManager= new VerifyKeyListenersManager(); |
1795 MARK_POSITION_CATEGORY=Format("__mark_category_{}", toHash()); //$NON-NLS-1$ | 1802 MARK_POSITION_CATEGORY=Format("__mark_category_{}", toHash()); //$NON-NLS-1$ |
1796 fMarkPositionUpdater= new DefaultPositionUpdater(MARK_POSITION_CATEGORY); | 1803 fMarkPositionUpdater= new DefaultPositionUpdater(MARK_POSITION_CATEGORY); |
1797 fDocumentRewriteSessionListener= new DocumentRewriteSessionListener(); | 1804 fDocumentRewriteSessionListener= new DocumentRewriteSessionListener(); |
1805 fNumberOfPostSelectionChangedEvents= new int[1]; | |
1806 fEditorHelpers= new HashSet(); | |
1798 } | 1807 } |
1799 /** | 1808 /** |
1800 * Internal use only | 1809 * Internal use only |
1801 */ | 1810 */ |
1802 protected this() { | 1811 protected this() { |
2106 | 2115 |
2107 if (strategies is null) { | 2116 if (strategies is null) { |
2108 if (autoEditStrategies is null) | 2117 if (autoEditStrategies is null) |
2109 return; | 2118 return; |
2110 | 2119 |
2111 fAutoIndentStrategies.put(contentType, null); | 2120 fAutoIndentStrategies.put(contentType, cast(Object)null); |
2112 | 2121 |
2113 } else { | 2122 } else { |
2114 if (autoEditStrategies is null) { | 2123 if (autoEditStrategies is null) { |
2115 autoEditStrategies= new ArrayList(); | 2124 autoEditStrategies= new ArrayList(); |
2116 fAutoIndentStrategies.put(contentType, autoEditStrategies); | 2125 fAutoIndentStrategies.put(contentType, cast(Object)autoEditStrategies); |
2117 } | 2126 } |
2118 | 2127 |
2119 autoEditStrategies.clear(); | 2128 autoEditStrategies.clear(); |
2120 autoEditStrategies.addAll(Arrays.asList(strategies)); | 2129 autoEditStrategies.addAll(Arrays.asList(arraycast!(Object)(strategies))); |
2121 } | 2130 } |
2122 } | 2131 } |
2123 | 2132 |
2124 /* | 2133 /* |
2125 * @see dwtx.jface.text.ITextViewerExtension2#prependAutoEditStrategy(dwtx.jface.text.IAutoEditStrategy, java.lang.String) | 2134 * @see dwtx.jface.text.ITextViewerExtension2#prependAutoEditStrategy(dwtx.jface.text.IAutoEditStrategy, java.lang.String) |
2126 * @since 2.1 | 2135 * @since 2.1 |
2127 */ | 2136 */ |
2128 public void prependAutoEditStrategy(IAutoEditStrategy strategy, String contentType) { | 2137 public void prependAutoEditStrategy(IAutoEditStrategy strategy, String contentType) { |
2129 | 2138 |
2130 if (strategy is null || contentType is null) | 2139 if (strategy is null || contentType is null) |
2131 throw new IllegalArgumentException(); | 2140 throw new IllegalArgumentException(""); |
2132 | 2141 |
2133 if (fAutoIndentStrategies is null) | 2142 if (fAutoIndentStrategies is null) |
2134 fAutoIndentStrategies= new HashMap(); | 2143 fAutoIndentStrategies= new HashMap(); |
2135 | 2144 |
2136 List autoEditStrategies= cast(List) fAutoIndentStrategies.get(contentType); | 2145 List autoEditStrategies= cast(List) fAutoIndentStrategies.get(contentType); |
2137 if (autoEditStrategies is null) { | 2146 if (autoEditStrategies is null) { |
2138 autoEditStrategies= new ArrayList(); | 2147 autoEditStrategies= new ArrayList(); |
2139 fAutoIndentStrategies.put(contentType, autoEditStrategies); | 2148 fAutoIndentStrategies.put(contentType,cast(Object) autoEditStrategies); |
2140 } | 2149 } |
2141 | 2150 |
2142 autoEditStrategies.add(0, strategy); | 2151 autoEditStrategies.add(0, cast(Object)strategy); |
2143 } | 2152 } |
2144 | 2153 |
2145 /* | 2154 /* |
2146 * @see dwtx.jface.text.ITextViewerExtension2#removeAutoEditStrategy(dwtx.jface.text.IAutoEditStrategy, java.lang.String) | 2155 * @see dwtx.jface.text.ITextViewerExtension2#removeAutoEditStrategy(dwtx.jface.text.IAutoEditStrategy, java.lang.String) |
2147 * @since 2.1 | 2156 * @since 2.1 |
2153 List autoEditStrategies= cast(List) fAutoIndentStrategies.get(contentType); | 2162 List autoEditStrategies= cast(List) fAutoIndentStrategies.get(contentType); |
2154 if (autoEditStrategies is null) | 2163 if (autoEditStrategies is null) |
2155 return; | 2164 return; |
2156 | 2165 |
2157 for (final Iterator iterator= autoEditStrategies.iterator(); iterator.hasNext(); ) { | 2166 for (final Iterator iterator= autoEditStrategies.iterator(); iterator.hasNext(); ) { |
2158 if (iterator.next().equals(strategy)) { | 2167 if (iterator.next().opEquals(cast(Object)strategy)) { |
2159 iterator.remove(); | 2168 iterator.remove(); |
2160 break; | 2169 break; |
2161 } | 2170 } |
2162 } | 2171 } |
2163 | 2172 |
2164 if (autoEditStrategies.isEmpty()) | 2173 if (autoEditStrategies.isEmpty()) |
2165 fAutoIndentStrategies.put(contentType, null); | 2174 fAutoIndentStrategies.put(contentType, cast(Object)null); |
2166 } | 2175 } |
2167 | 2176 |
2168 /* | 2177 /* |
2169 * @see ITextViewer#setEventConsumer(IEventConsumer) | 2178 * @see ITextViewer#setEventConsumer(IEventConsumer) |
2170 */ | 2179 */ |
2185 if (ok) { | 2194 if (ok) { |
2186 | 2195 |
2187 if (fIndentChars is null) | 2196 if (fIndentChars is null) |
2188 fIndentChars= new HashMap(); | 2197 fIndentChars= new HashMap(); |
2189 | 2198 |
2190 fIndentChars.put(contentType, indentPrefixes); | 2199 fIndentChars.put(contentType, new ArrayWrapperObject( stringcast(indentPrefixes))); |
2191 | 2200 |
2192 } else if (fIndentChars !is null) | 2201 } else if (fIndentChars !is null) |
2193 fIndentChars.remove(contentType); | 2202 fIndentChars.remove(contentType); |
2194 } | 2203 } |
2195 | 2204 |
2224 public void setDefaultPrefixes(String[] defaultPrefixes, String contentType) { | 2233 public void setDefaultPrefixes(String[] defaultPrefixes, String contentType) { |
2225 | 2234 |
2226 if (defaultPrefixes !is null && defaultPrefixes.length > 0) { | 2235 if (defaultPrefixes !is null && defaultPrefixes.length > 0) { |
2227 if (fDefaultPrefixChars is null) | 2236 if (fDefaultPrefixChars is null) |
2228 fDefaultPrefixChars= new HashMap(); | 2237 fDefaultPrefixChars= new HashMap(); |
2229 fDefaultPrefixChars.put(contentType, defaultPrefixes); | 2238 fDefaultPrefixChars.put(contentType, new ArrayWrapperObject( stringcast(defaultPrefixes))); |
2230 } else if (fDefaultPrefixChars !is null) | 2239 } else if (fDefaultPrefixChars !is null) |
2231 fDefaultPrefixChars.remove(contentType); | 2240 fDefaultPrefixChars.remove(contentType); |
2232 } | 2241 } |
2233 | 2242 |
2234 /* | 2243 /* |
2261 TextHoverKey key= new TextHoverKey(contentType, stateMask); | 2270 TextHoverKey key= new TextHoverKey(contentType, stateMask); |
2262 if (hover !is null) { | 2271 if (hover !is null) { |
2263 if (fTextHovers is null) { | 2272 if (fTextHovers is null) { |
2264 fTextHovers= new HashMap(); | 2273 fTextHovers= new HashMap(); |
2265 } | 2274 } |
2266 fTextHovers.put(key, hover); | 2275 fTextHovers.put(key, cast(Object)hover); |
2267 } else if (fTextHovers !is null) | 2276 } else if (fTextHovers !is null) |
2268 fTextHovers.remove(key); | 2277 fTextHovers.remove(key); |
2269 | 2278 |
2270 ensureHoverControlManagerInstalled(); | 2279 ensureHoverControlManagerInstalled(); |
2271 } | 2280 } |
2526 if (delta > 0) { | 2535 if (delta > 0) { |
2527 // in the middle of a multi-character line delimiter | 2536 // in the middle of a multi-character line delimiter |
2528 offset= lineEnd; | 2537 offset= lineEnd; |
2529 String delimiter= document.getLineDelimiter(lineNumber); | 2538 String delimiter= document.getLineDelimiter(lineNumber); |
2530 if (delimiter !is null) | 2539 if (delimiter !is null) |
2531 offset += delimiter.length(); | 2540 offset += delimiter.length; |
2532 } | 2541 } |
2533 | 2542 |
2534 int end= offset + length; | 2543 int end= offset + length; |
2535 lineInformation= document.getLineInformationOfOffset(end); | 2544 lineInformation= document.getLineInformationOfOffset(end); |
2536 lineEnd= lineInformation.getOffset() + lineInformation.getLength(); | 2545 lineEnd= lineInformation.getOffset() + lineInformation.getLength(); |
2589 * @see dwtx.jface.text.IPostSelectionProvider#addPostSelectionChangedListener(dwtx.jface.viewers.ISelectionChangedListener) | 2598 * @see dwtx.jface.text.IPostSelectionProvider#addPostSelectionChangedListener(dwtx.jface.viewers.ISelectionChangedListener) |
2590 * @since 3.0 | 2599 * @since 3.0 |
2591 */ | 2600 */ |
2592 public void addPostSelectionChangedListener(ISelectionChangedListener listener) { | 2601 public void addPostSelectionChangedListener(ISelectionChangedListener listener) { |
2593 | 2602 |
2594 Assert.isNotNull(listener); | 2603 Assert.isNotNull(cast(Object)listener); |
2595 | 2604 |
2596 if (fPostSelectionChangedListeners is null) | 2605 if (fPostSelectionChangedListeners is null) |
2597 fPostSelectionChangedListeners= new ArrayList(); | 2606 fPostSelectionChangedListeners= new ArrayList(); |
2598 | 2607 |
2599 if (!fPostSelectionChangedListeners.contains(listener)) | 2608 if (!fPostSelectionChangedListeners.contains(cast(Object)listener)) |
2600 fPostSelectionChangedListeners.add(listener); | 2609 fPostSelectionChangedListeners.add(cast(Object)listener); |
2601 } | 2610 } |
2602 | 2611 |
2603 /* | 2612 /* |
2604 * @see dwtx.jface.text.IPostSelectionProvider#removePostSelectionChangedListener(dwtx.jface.viewers.ISelectionChangedListener) | 2613 * @see dwtx.jface.text.IPostSelectionProvider#removePostSelectionChangedListener(dwtx.jface.viewers.ISelectionChangedListener) |
2605 * @since 3.0 | 2614 * @since 3.0 |
2606 */ | 2615 */ |
2607 public void removePostSelectionChangedListener(ISelectionChangedListener listener) { | 2616 public void removePostSelectionChangedListener(ISelectionChangedListener listener) { |
2608 | 2617 |
2609 Assert.isNotNull(listener); | 2618 Assert.isNotNull(cast(Object)listener); |
2610 | 2619 |
2611 if (fPostSelectionChangedListeners !is null) { | 2620 if (fPostSelectionChangedListeners !is null) { |
2612 fPostSelectionChangedListeners.remove(listener); | 2621 fPostSelectionChangedListeners.remove(cast(Object)listener); |
2613 if (fPostSelectionChangedListeners.size() is 0) | 2622 if (fPostSelectionChangedListeners.size() is 0) |
2614 fPostSelectionChangedListeners= null; | 2623 fPostSelectionChangedListeners= null; |
2615 } | 2624 } |
2616 } | 2625 } |
2617 | 2626 |
2643 if (display is null) | 2652 if (display is null) |
2644 return; | 2653 return; |
2645 | 2654 |
2646 fNumberOfPostSelectionChangedEvents[0]++; | 2655 fNumberOfPostSelectionChangedEvents[0]++; |
2647 display.timerExec(getEmptySelectionChangedEventDelay(), new class() Runnable { | 2656 display.timerExec(getEmptySelectionChangedEventDelay(), new class() Runnable { |
2648 final int id= fNumberOfPostSelectionChangedEvents[0]; | 2657 const int id; |
2658 this(){ | |
2659 id = fNumberOfPostSelectionChangedEvents[0]; | |
2660 } | |
2649 public void run() { | 2661 public void run() { |
2650 if (id is fNumberOfPostSelectionChangedEvents[0]) { | 2662 if (id is fNumberOfPostSelectionChangedEvents[0]) { |
2651 // Check again because this is executed after the delay | 2663 // Check again because this is executed after the delay |
2652 if (getDisplay() !is null) { | 2664 if (getDisplay() !is null) { |
2653 Point selection= fTextWidget.getSelectionRange(); | 2665 Point selection= fTextWidget.getSelectionRange(); |
2654 if (selection !is null) { | 2666 if (selection !is null) { |
2655 IRegion r= widgetRange2ModelRange(new Region(selection.x, selection.y)); | 2667 IRegion r= widgetRange2ModelRange(new Region(selection.x, selection.y)); |
2656 if (fireEqualSelection || (r !is null && !r.equals(fLastSentPostSelectionChange)) || r is null) { | 2668 if (fireEqualSelection || (r !is null && !(cast(Object)r).opEquals(cast(Object)fLastSentPostSelectionChange)) || r is null) { |
2657 fLastSentPostSelectionChange= r; | 2669 fLastSentPostSelectionChange= r; |
2658 firePostSelectionChanged(selection.x, selection.y); | 2670 firePostSelectionChanged(selection.x, selection.y); |
2659 } | 2671 } |
2660 } | 2672 } |
2661 } | 2673 } |
2701 * @since 3.0 | 2713 * @since 3.0 |
2702 */ | 2714 */ |
2703 protected void fireSelectionChanged(int offset, int length) { | 2715 protected void fireSelectionChanged(int offset, int length) { |
2704 if (redraws()) { | 2716 if (redraws()) { |
2705 IRegion r= widgetRange2ModelRange(new Region(offset, length)); | 2717 IRegion r= widgetRange2ModelRange(new Region(offset, length)); |
2706 if ((r !is null && !r.equals(fLastSentSelectionChange)) || r is null) { | 2718 if ((r !is null && !(cast(Object)r).opEquals(cast(Object)fLastSentSelectionChange)) || r is null) { |
2707 fLastSentSelectionChange= r; | 2719 fLastSentSelectionChange= r; |
2708 ISelection selection= r !is null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); | 2720 ISelection selection= r !is null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); |
2709 SelectionChangedEvent event= new SelectionChangedEvent(this, selection); | 2721 SelectionChangedEvent event= new SelectionChangedEvent(this, selection); |
2710 fireSelectionChanged(event); | 2722 fireSelectionChanged(event); |
2711 } | 2723 } |
2757 /* | 2769 /* |
2758 * @see ITextViewer#addTextListener(ITextListener) | 2770 * @see ITextViewer#addTextListener(ITextListener) |
2759 */ | 2771 */ |
2760 public void addTextListener(ITextListener listener) { | 2772 public void addTextListener(ITextListener listener) { |
2761 | 2773 |
2762 Assert.isNotNull(listener); | 2774 Assert.isNotNull(cast(Object)listener); |
2763 | 2775 |
2764 if (fTextListeners is null) | 2776 if (fTextListeners is null) |
2765 fTextListeners= new ArrayList(); | 2777 fTextListeners= new ArrayList(); |
2766 | 2778 |
2767 if (!fTextListeners.contains(listener)) | 2779 if (!fTextListeners.contains(cast(Object)listener)) |
2768 fTextListeners.add(listener); | 2780 fTextListeners.add(cast(Object)listener); |
2769 } | 2781 } |
2770 | 2782 |
2771 /* | 2783 /* |
2772 * @see ITextViewer#removeTextListener(ITextListener) | 2784 * @see ITextViewer#removeTextListener(ITextListener) |
2773 */ | 2785 */ |
2774 public void removeTextListener(ITextListener listener) { | 2786 public void removeTextListener(ITextListener listener) { |
2775 | 2787 |
2776 Assert.isNotNull(listener); | 2788 Assert.isNotNull(cast(Object)listener); |
2777 | 2789 |
2778 if (fTextListeners !is null) { | 2790 if (fTextListeners !is null) { |
2779 fTextListeners.remove(listener); | 2791 fTextListeners.remove(cast(Object)listener); |
2780 if (fTextListeners.size() is 0) | 2792 if (fTextListeners.size() is 0) |
2781 fTextListeners= null; | 2793 fTextListeners= null; |
2782 } | 2794 } |
2783 } | 2795 } |
2784 | 2796 |
2809 /* | 2821 /* |
2810 * @see ITextViewer#addTextInputListener(ITextInputListener) | 2822 * @see ITextViewer#addTextInputListener(ITextInputListener) |
2811 */ | 2823 */ |
2812 public void addTextInputListener(ITextInputListener listener) { | 2824 public void addTextInputListener(ITextInputListener listener) { |
2813 | 2825 |
2814 Assert.isNotNull(listener); | 2826 Assert.isNotNull(cast(Object)listener); |
2815 | 2827 |
2816 if (fTextInputListeners is null) | 2828 if (fTextInputListeners is null) |
2817 fTextInputListeners= new ArrayList(); | 2829 fTextInputListeners= new ArrayList(); |
2818 | 2830 |
2819 if (!fTextInputListeners.contains(listener)) | 2831 if (!fTextInputListeners.contains(cast(Object)listener)) |
2820 fTextInputListeners.add(listener); | 2832 fTextInputListeners.add(cast(Object)listener); |
2821 } | 2833 } |
2822 | 2834 |
2823 /* | 2835 /* |
2824 * @see ITextViewer#removeTextInputListener(ITextInputListener) | 2836 * @see ITextViewer#removeTextInputListener(ITextInputListener) |
2825 */ | 2837 */ |
2826 public void removeTextInputListener(ITextInputListener listener) { | 2838 public void removeTextInputListener(ITextInputListener listener) { |
2827 | 2839 |
2828 Assert.isNotNull(listener); | 2840 Assert.isNotNull(cast(Object)listener); |
2829 | 2841 |
2830 if (fTextInputListeners !is null) { | 2842 if (fTextInputListeners !is null) { |
2831 fTextInputListeners.remove(listener); | 2843 fTextInputListeners.remove(cast(Object)listener); |
2832 if (fTextInputListeners.size() is 0) | 2844 if (fTextInputListeners.size() is 0) |
2833 fTextInputListeners= null; | 2845 fTextInputListeners= null; |
2834 } | 2846 } |
2835 } | 2847 } |
2836 | 2848 |
2872 | 2884 |
2873 /* | 2885 /* |
2874 * @see Viewer#getInput() | 2886 * @see Viewer#getInput() |
2875 */ | 2887 */ |
2876 public Object getInput() { | 2888 public Object getInput() { |
2877 return getDocument(); | 2889 return cast(Object)getDocument(); |
2878 } | 2890 } |
2879 | 2891 |
2880 /* | 2892 /* |
2881 * @see ITextViewer#getDocument() | 2893 * @see ITextViewer#getDocument() |
2882 */ | 2894 */ |
2908 fDocument= document; | 2920 fDocument= document; |
2909 | 2921 |
2910 setVisibleDocument(fDocument); | 2922 setVisibleDocument(fDocument); |
2911 | 2923 |
2912 resetPlugins(); | 2924 resetPlugins(); |
2913 inputChanged(fDocument, oldDocument); | 2925 inputChanged(cast(Object)fDocument, cast(Object)oldDocument); |
2914 | 2926 |
2915 fireInputDocumentChanged(oldDocument, fDocument); | 2927 fireInputDocumentChanged(oldDocument, fDocument); |
2916 fLastSentSelectionChange= null; | 2928 fLastSentSelectionChange= null; |
2917 fReplaceTextPresentation= false; | 2929 fReplaceTextPresentation= false; |
2918 } | 2930 } |
2937 } catch (BadLocationException x) { | 2949 } catch (BadLocationException x) { |
2938 throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_visible_region_1")); //$NON-NLS-1$ | 2950 throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_visible_region_1")); //$NON-NLS-1$ |
2939 } | 2951 } |
2940 | 2952 |
2941 resetPlugins(); | 2953 resetPlugins(); |
2942 inputChanged(fDocument, oldDocument); | 2954 inputChanged(cast(Object)fDocument, cast(Object)oldDocument); |
2943 | 2955 |
2944 fireInputDocumentChanged(oldDocument, fDocument); | 2956 fireInputDocumentChanged(oldDocument, fDocument); |
2945 fLastSentSelectionChange= null; | 2957 fLastSentSelectionChange= null; |
2946 fReplaceTextPresentation= false; | 2958 fReplaceTextPresentation= false; |
2947 } | 2959 } |
3060 if (fViewportListeners is null) { | 3072 if (fViewportListeners is null) { |
3061 fViewportListeners= new ArrayList(); | 3073 fViewportListeners= new ArrayList(); |
3062 initializeViewportUpdate(); | 3074 initializeViewportUpdate(); |
3063 } | 3075 } |
3064 | 3076 |
3065 if (!fViewportListeners.contains(listener)) | 3077 if (!fViewportListeners.contains(cast(Object)listener)) |
3066 fViewportListeners.add(listener); | 3078 fViewportListeners.add(cast(Object)listener); |
3067 } | 3079 } |
3068 | 3080 |
3069 /* | 3081 /* |
3070 * @see ITextViewer#removeViewportListener(IVewportListener) | 3082 * @see ITextViewer#removeViewportListener(IVewportListener) |
3071 */ | 3083 */ |
3072 public void removeViewportListener(IViewportListener listener) { | 3084 public void removeViewportListener(IViewportListener listener) { |
3073 if (fViewportListeners !is null) | 3085 if (fViewportListeners !is null) |
3074 fViewportListeners.remove(listener); | 3086 fViewportListeners.remove(cast(Object)listener); |
3075 } | 3087 } |
3076 | 3088 |
3077 /** | 3089 /** |
3078 * Checks whether the view port changed and if so informs all registered | 3090 * Checks whether the view port changed and if so informs all registered |
3079 * listeners about the change. | 3091 * listeners about the change. |
3309 else | 3321 else |
3310 newOffset= startPixel; | 3322 newOffset= startPixel; |
3311 | 3323 |
3312 float index= (cast(float)newOffset) / (cast(float)getAverageCharWidth()); | 3324 float index= (cast(float)newOffset) / (cast(float)getAverageCharWidth()); |
3313 | 3325 |
3314 fTextWidget.setHorizontalIndex(Math.round(index)); | 3326 fTextWidget.setHorizontalIndex(cast(int)Math.round(index)); |
3315 } | 3327 } |
3316 | 3328 |
3317 } | 3329 } |
3318 } catch (BadLocationException e) { | 3330 } catch (BadLocationException e) { |
3319 throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_range")); //$NON-NLS-1$ | 3331 throw new IllegalArgumentException(JFaceTextMessages.getString("TextViewer.error.invalid_range")); //$NON-NLS-1$ |
3567 ChildDocument cdoc= cast(ChildDocument) document; | 3579 ChildDocument cdoc= cast(ChildDocument) document; |
3568 return cdoc.getParentDocumentRange().getOffset(); | 3580 return cdoc.getParentDocumentRange().getOffset(); |
3569 } | 3581 } |
3570 | 3582 |
3571 return 0; | 3583 return 0; |
3584 } | |
3585 package int _getVisibleRegionOffset_package() { | |
3586 return _getVisibleRegionOffset(); | |
3572 } | 3587 } |
3573 | 3588 |
3574 /* | 3589 /* |
3575 * @see ITextViewer#getVisibleRegion() | 3590 * @see ITextViewer#getVisibleRegion() |
3576 */ | 3591 */ |
3649 public void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType) { | 3664 public void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType) { |
3650 | 3665 |
3651 if (strategy !is null) { | 3666 if (strategy !is null) { |
3652 if (fDoubleClickStrategies is null) | 3667 if (fDoubleClickStrategies is null) |
3653 fDoubleClickStrategies= new HashMap(); | 3668 fDoubleClickStrategies= new HashMap(); |
3654 fDoubleClickStrategies.put(contentType, strategy); | 3669 fDoubleClickStrategies.put(stringcast(contentType), cast(Object)strategy); |
3655 } else if (fDoubleClickStrategies !is null) | 3670 } else if (fDoubleClickStrategies !is null) |
3656 fDoubleClickStrategies.remove(contentType); | 3671 fDoubleClickStrategies.remove(contentType); |
3657 } | 3672 } |
3658 | 3673 |
3659 /** | 3674 /** |
3948 extension.ignorePostNotificationReplaces(); | 3963 extension.ignorePostNotificationReplaces(); |
3949 else | 3964 else |
3950 extension.acceptPostNotificationReplaces(); | 3965 extension.acceptPostNotificationReplaces(); |
3951 } | 3966 } |
3952 } | 3967 } |
3968 package void ignoreAutoEditStrategies_package(bool ignore) { | |
3969 return ignoreAutoEditStrategies(ignore); | |
3970 } | |
3953 | 3971 |
3954 /** | 3972 /** |
3955 * Returns whether this viewer ignores the registered auto edit strategies. | 3973 * Returns whether this viewer ignores the registered auto edit strategies. |
3956 * | 3974 * |
3957 * @return <code>true</code> if the strategies are ignored | 3975 * @return <code>true</code> if the strategies are ignored |
4408 | 4426 |
4409 // Prevents setting of widget selection with line delimiters at beginning or end | 4427 // Prevents setting of widget selection with line delimiters at beginning or end |
4410 char startChar= adapter.charAt(widgetPos); | 4428 char startChar= adapter.charAt(widgetPos); |
4411 char endChar= adapter.charAt(widgetPos+length-1); | 4429 char endChar= adapter.charAt(widgetPos+length-1); |
4412 bool borderHasLineDelimiter= startChar is '\n' || startChar is '\r' || endChar is '\n' || endChar is '\r'; | 4430 bool borderHasLineDelimiter= startChar is '\n' || startChar is '\r' || endChar is '\n' || endChar is '\r'; |
4413 bool redraws= redraws(); | 4431 bool redraws_= redraws(); |
4414 if (borderHasLineDelimiter && redraws) | 4432 if (borderHasLineDelimiter && redraws_) |
4415 setRedraw(false); | 4433 setRedraw(false); |
4416 | 4434 |
4417 if (redraws()) { | 4435 if (redraws()) { |
4418 fTextWidget.setSelectionRange(widgetPos, length); | 4436 fTextWidget.setSelectionRange(widgetPos, length); |
4419 internalRevealRange(widgetPos, widgetPos + length); | 4437 internalRevealRange(widgetPos, widgetPos + length); |
4420 selectionChanged(widgetPos, length); | 4438 selectionChanged(widgetPos, length); |
4421 } else { | 4439 } else { |
4422 setSelectedRange(widgetOffset2ModelOffset(widgetPos), length); | 4440 setSelectedRange(widgetOffset2ModelOffset(widgetPos), length); |
4423 if (redraws) | 4441 if (redraws_) |
4424 setRedraw(true); | 4442 setRedraw(true); |
4425 } | 4443 } |
4426 | 4444 |
4427 return widgetOffset2ModelOffset(widgetPos); | 4445 return widgetOffset2ModelOffset(widgetPos); |
4428 } | 4446 } |
4485 | 4503 |
4486 // Prevents setting of widget selection with line delimiters at beginning or end | 4504 // Prevents setting of widget selection with line delimiters at beginning or end |
4487 char startChar= adapter.charAt(widgetPos); | 4505 char startChar= adapter.charAt(widgetPos); |
4488 char endChar= adapter.charAt(widgetPos+length-1); | 4506 char endChar= adapter.charAt(widgetPos+length-1); |
4489 bool borderHasLineDelimiter= startChar is '\n' || startChar is '\r' || endChar is '\n' || endChar is '\r'; | 4507 bool borderHasLineDelimiter= startChar is '\n' || startChar is '\r' || endChar is '\n' || endChar is '\r'; |
4490 bool redraws= redraws(); | 4508 bool redraws_= redraws(); |
4491 if (borderHasLineDelimiter && redraws) | 4509 if (borderHasLineDelimiter && redraws_) |
4492 setRedraw(false); | 4510 setRedraw(false); |
4493 | 4511 |
4494 if (redraws()) { | 4512 if (redraws()) { |
4495 fTextWidget.setSelectionRange(widgetPos, length); | 4513 fTextWidget.setSelectionRange(widgetPos, length); |
4496 internalRevealRange(widgetPos, widgetPos + length); | 4514 internalRevealRange(widgetPos, widgetPos + length); |
4497 selectionChanged(widgetPos, length); | 4515 selectionChanged(widgetPos, length); |
4498 } else { | 4516 } else { |
4499 setSelectedRange(modelPos, length); | 4517 setSelectedRange(modelPos, length); |
4500 if (redraws) | 4518 if (redraws_) |
4501 setRedraw(true); | 4519 setRedraw(true); |
4502 } | 4520 } |
4503 | 4521 |
4504 return modelPos; | 4522 return modelPos; |
4505 } | 4523 } |
4992 * @see dwtx.jface.text.ITextViewerExtension2#getCurrentTextHover() | 5010 * @see dwtx.jface.text.ITextViewerExtension2#getCurrentTextHover() |
4993 */ | 5011 */ |
4994 public ITextHover getCurrentTextHover() { | 5012 public ITextHover getCurrentTextHover() { |
4995 if (fTextHoverManager is null) | 5013 if (fTextHoverManager is null) |
4996 return null; | 5014 return null; |
4997 return fTextHoverManager.getCurrentTextHover(); | 5015 return fTextHoverManager.getCurrentTextHover_package(); |
4998 } | 5016 } |
4999 | 5017 |
5000 /* | 5018 /* |
5001 * @see dwtx.jface.text.ITextViewerExtension2#getHoverEventLocation() | 5019 * @see dwtx.jface.text.ITextViewerExtension2#getHoverEventLocation() |
5002 */ | 5020 */ |
5003 public Point getHoverEventLocation() { | 5021 public Point getHoverEventLocation() { |
5004 if (fTextHoverManager is null) | 5022 if (fTextHoverManager is null) |
5005 return null; | 5023 return null; |
5006 return fTextHoverManager.getHoverEventLocation(); | 5024 return fTextHoverManager.getHoverEventLocation_package(); |
5007 } | 5025 } |
5008 | 5026 |
5009 /** | 5027 /** |
5010 * Returns the paint manager of this viewer. | 5028 * Returns the paint manager of this viewer. |
5011 * | 5029 * |
5402 * @see ITextViewerExtension4#addTextPresentationListener(ITextPresentationListener) | 5420 * @see ITextViewerExtension4#addTextPresentationListener(ITextPresentationListener) |
5403 * @since 3.0 | 5421 * @since 3.0 |
5404 */ | 5422 */ |
5405 public void addTextPresentationListener(ITextPresentationListener listener) { | 5423 public void addTextPresentationListener(ITextPresentationListener listener) { |
5406 | 5424 |
5407 Assert.isNotNull(listener); | 5425 Assert.isNotNull(cast(Object)listener); |
5408 | 5426 |
5409 if (fTextPresentationListeners is null) | 5427 if (fTextPresentationListeners is null) |
5410 fTextPresentationListeners= new ArrayList(); | 5428 fTextPresentationListeners= new ArrayList(); |
5411 | 5429 |
5412 if (!fTextPresentationListeners.contains(listener)) | 5430 if (!fTextPresentationListeners.contains(cast(Object)listener)) |
5413 fTextPresentationListeners.add(listener); | 5431 fTextPresentationListeners.add(cast(Object)listener); |
5414 } | 5432 } |
5415 | 5433 |
5416 /* | 5434 /* |
5417 * @see ITextViewerExtension4#removeTextPresentationListener(ITextPresentationListener) | 5435 * @see ITextViewerExtension4#removeTextPresentationListener(ITextPresentationListener) |
5418 * @since 3.0 | 5436 * @since 3.0 |
5419 */ | 5437 */ |
5420 public void removeTextPresentationListener(ITextPresentationListener listener) { | 5438 public void removeTextPresentationListener(ITextPresentationListener listener) { |
5421 | 5439 |
5422 Assert.isNotNull(listener); | 5440 Assert.isNotNull(cast(Object)listener); |
5423 | 5441 |
5424 if (fTextPresentationListeners !is null) { | 5442 if (fTextPresentationListeners !is null) { |
5425 fTextPresentationListeners.remove(listener); | 5443 fTextPresentationListeners.remove(cast(Object)listener); |
5426 if (fTextPresentationListeners.size() is 0) | 5444 if (fTextPresentationListeners.size() is 0) |
5427 fTextPresentationListeners= null; | 5445 fTextPresentationListeners= null; |
5428 } | 5446 } |
5429 } | 5447 } |
5430 | 5448 |
5432 * @see dwtx.jface.text.IEditingSupportRegistry#registerHelper(dwtx.jface.text.IEditingSupport) | 5450 * @see dwtx.jface.text.IEditingSupportRegistry#registerHelper(dwtx.jface.text.IEditingSupport) |
5433 * @since 3.1 | 5451 * @since 3.1 |
5434 */ | 5452 */ |
5435 public void register(IEditingSupport helper) { | 5453 public void register(IEditingSupport helper) { |
5436 Assert.isLegal(helper !is null); | 5454 Assert.isLegal(helper !is null); |
5437 fEditorHelpers.add(helper); | 5455 fEditorHelpers.add(cast(Object)helper); |
5438 } | 5456 } |
5439 | 5457 |
5440 /* | 5458 /* |
5441 * @see dwtx.jface.text.IEditingSupportRegistry#deregisterHelper(dwtx.jface.text.IEditingSupport) | 5459 * @see dwtx.jface.text.IEditingSupportRegistry#deregisterHelper(dwtx.jface.text.IEditingSupport) |
5442 * @since 3.1 | 5460 * @since 3.1 |
5443 */ | 5461 */ |
5444 public void unregister(IEditingSupport helper) { | 5462 public void unregister(IEditingSupport helper) { |
5445 fEditorHelpers.remove(helper); | 5463 fEditorHelpers.remove(cast(Object)helper); |
5446 } | 5464 } |
5447 | 5465 |
5448 /* | 5466 /* |
5449 * @see dwtx.jface.text.IEditingSupportRegistry#getCurrentHelpers() | 5467 * @see dwtx.jface.text.IEditingSupportRegistry#getCurrentHelpers() |
5450 * @since 3.1 | 5468 * @since 3.1 |