Mercurial > projects > dwt-addons
comparison dwtx/jface/text/AbstractDocument.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | 25f1f92fa3df |
children |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
61 import dwtx.jface.text.IRegion; // packageimport | 61 import dwtx.jface.text.IRegion; // packageimport |
62 import dwtx.jface.text.IInformationControlExtension2; // packageimport | 62 import dwtx.jface.text.IInformationControlExtension2; // packageimport |
63 import dwtx.jface.text.IDocumentExtension4; // packageimport | 63 import dwtx.jface.text.IDocumentExtension4; // packageimport |
64 import dwtx.jface.text.IDocumentExtension2; // packageimport | 64 import dwtx.jface.text.IDocumentExtension2; // packageimport |
65 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport | 65 import dwtx.jface.text.IDocumentPartitionerExtension2; // packageimport |
66 import dwtx.jface.text.Assert; // packageimport | |
67 import dwtx.jface.text.DefaultInformationControl; // packageimport | 66 import dwtx.jface.text.DefaultInformationControl; // packageimport |
68 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport | 67 import dwtx.jface.text.IWidgetTokenOwnerExtension; // packageimport |
69 import dwtx.jface.text.DocumentClone; // packageimport | 68 import dwtx.jface.text.DocumentClone; // packageimport |
70 import dwtx.jface.text.DefaultUndoManager; // packageimport | 69 import dwtx.jface.text.DefaultUndoManager; // packageimport |
71 import dwtx.jface.text.IFindReplaceTarget; // packageimport | 70 import dwtx.jface.text.IFindReplaceTarget; // packageimport |
155 import dwtx.jface.text.ITextViewerExtension4; // packageimport | 154 import dwtx.jface.text.ITextViewerExtension4; // packageimport |
156 import dwtx.jface.text.ITypedRegion; // packageimport | 155 import dwtx.jface.text.ITypedRegion; // packageimport |
157 | 156 |
158 import dwt.dwthelper.utils; | 157 import dwt.dwthelper.utils; |
159 import dwtx.dwtxhelper.Collection; | 158 import dwtx.dwtxhelper.Collection; |
160 | 159 import dwtx.dwtxhelper.regex; |
161 // import java.util.regex.PatternSyntaxException; | 160 import tango.text.convert.Format; |
162 | 161 |
163 import dwtx.core.runtime.Assert; | 162 import dwtx.core.runtime.Assert; |
164 import dwtx.core.runtime.ListenerList; | 163 import dwtx.core.runtime.ListenerList; |
165 | 164 |
166 | 165 |
332 * document has been initialized with a text store. | 331 * document has been initialized with a text store. |
333 * | 332 * |
334 * @return the document's text store | 333 * @return the document's text store |
335 */ | 334 */ |
336 protected ITextStore getStore() { | 335 protected ITextStore getStore() { |
337 Assert.isNotNull(fStore); | 336 Assert.isNotNull(cast(Object)fStore); |
338 return fStore; | 337 return fStore; |
339 } | 338 } |
340 | 339 |
341 /** | 340 /** |
342 * Returns the document's line tracker. Assumes that the | 341 * Returns the document's line tracker. Assumes that the |
343 * document has been initialized with a line tracker. | 342 * document has been initialized with a line tracker. |
344 * | 343 * |
345 * @return the document's line tracker | 344 * @return the document's line tracker |
346 */ | 345 */ |
347 protected ILineTracker getTracker() { | 346 protected ILineTracker getTracker() { |
348 Assert.isNotNull(fTracker); | 347 Assert.isNotNull(cast(Object)fTracker); |
349 return fTracker; | 348 return fTracker; |
350 } | 349 } |
351 | 350 |
352 /** | 351 /** |
353 * Returns the document's document listeners. | 352 * Returns the document's document listeners. |
438 | 437 |
439 /* | 438 /* |
440 * @see dwtx.jface.text.IDocument#addDocumentListener(dwtx.jface.text.IDocumentListener) | 439 * @see dwtx.jface.text.IDocument#addDocumentListener(dwtx.jface.text.IDocumentListener) |
441 */ | 440 */ |
442 public void addDocumentListener(IDocumentListener listener) { | 441 public void addDocumentListener(IDocumentListener listener) { |
443 Assert.isNotNull(listener); | 442 Assert.isNotNull(cast(Object)listener); |
444 fDocumentListeners.add(listener); | 443 fDocumentListeners.add(cast(Object)listener); |
445 } | 444 } |
446 | 445 |
447 /* | 446 /* |
448 * @see dwtx.jface.text.IDocument#removeDocumentListener(dwtx.jface.text.IDocumentListener) | 447 * @see dwtx.jface.text.IDocument#removeDocumentListener(dwtx.jface.text.IDocumentListener) |
449 */ | 448 */ |
450 public void removeDocumentListener(IDocumentListener listener) { | 449 public void removeDocumentListener(IDocumentListener listener) { |
451 Assert.isNotNull(listener); | 450 Assert.isNotNull(cast(Object)listener); |
452 fDocumentListeners.remove(listener); | 451 fDocumentListeners.remove(cast(Object)listener); |
453 } | 452 } |
454 | 453 |
455 /* | 454 /* |
456 * @see dwtx.jface.text.IDocument#addPrenotifiedDocumentListener(dwtx.jface.text.IDocumentListener) | 455 * @see dwtx.jface.text.IDocument#addPrenotifiedDocumentListener(dwtx.jface.text.IDocumentListener) |
457 */ | 456 */ |
458 public void addPrenotifiedDocumentListener(IDocumentListener listener) { | 457 public void addPrenotifiedDocumentListener(IDocumentListener listener) { |
459 Assert.isNotNull(listener); | 458 Assert.isNotNull(cast(Object)listener); |
460 fPrenotifiedDocumentListeners.add(listener); | 459 fPrenotifiedDocumentListeners.add(cast(Object)listener); |
461 } | 460 } |
462 | 461 |
463 /* | 462 /* |
464 * @see dwtx.jface.text.IDocument#removePrenotifiedDocumentListener(dwtx.jface.text.IDocumentListener) | 463 * @see dwtx.jface.text.IDocument#removePrenotifiedDocumentListener(dwtx.jface.text.IDocumentListener) |
465 */ | 464 */ |
466 public void removePrenotifiedDocumentListener(IDocumentListener listener) { | 465 public void removePrenotifiedDocumentListener(IDocumentListener listener) { |
467 Assert.isNotNull(listener); | 466 Assert.isNotNull(cast(Object)listener); |
468 fPrenotifiedDocumentListeners.remove(listener); | 467 fPrenotifiedDocumentListeners.remove(cast(Object)listener); |
469 } | 468 } |
470 | 469 |
471 /* | 470 /* |
472 * @see dwtx.jface.text.IDocument#addDocumentPartitioningListener(dwtx.jface.text.IDocumentPartitioningListener) | 471 * @see dwtx.jface.text.IDocument#addDocumentPartitioningListener(dwtx.jface.text.IDocumentPartitioningListener) |
473 */ | 472 */ |
474 public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) { | 473 public void addDocumentPartitioningListener(IDocumentPartitioningListener listener) { |
475 Assert.isNotNull(listener); | 474 Assert.isNotNull(cast(Object)listener); |
476 fDocumentPartitioningListeners.add(listener); | 475 fDocumentPartitioningListeners.add(cast(Object)listener); |
477 } | 476 } |
478 | 477 |
479 /* | 478 /* |
480 * @see dwtx.jface.text.IDocument#removeDocumentPartitioningListener(dwtx.jface.text.IDocumentPartitioningListener) | 479 * @see dwtx.jface.text.IDocument#removeDocumentPartitioningListener(dwtx.jface.text.IDocumentPartitioningListener) |
481 */ | 480 */ |
482 public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) { | 481 public void removeDocumentPartitioningListener(IDocumentPartitioningListener listener) { |
483 Assert.isNotNull(listener); | 482 Assert.isNotNull(cast(Object)listener); |
484 fDocumentPartitioningListeners.remove(listener); | 483 fDocumentPartitioningListeners.remove(cast(Object)listener); |
485 } | 484 } |
486 | 485 |
487 /* | 486 /* |
488 * @see dwtx.jface.text.IDocument#addPosition(java.lang.String, dwtx.jface.text.Position) | 487 * @see dwtx.jface.text.IDocument#addPosition(java.lang.String, dwtx.jface.text.Position) |
489 */ | 488 */ |
796 | 795 |
797 if (fDocumentPartitioners !is null) { | 796 if (fDocumentPartitioners !is null) { |
798 fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this); | 797 fDocumentPartitioningChangedEvent= new DocumentPartitioningChangedEvent(this); |
799 Iterator e= fDocumentPartitioners.keySet().iterator(); | 798 Iterator e= fDocumentPartitioners.keySet().iterator(); |
800 while (e.hasNext()) { | 799 while (e.hasNext()) { |
801 String partitioning= cast(String) e.next(); | 800 String partitioning= stringcast( e.next() ); |
802 IDocumentPartitioner partitioner= cast(IDocumentPartitioner) fDocumentPartitioners.get(partitioning); | 801 IDocumentPartitioner partitioner= cast(IDocumentPartitioner) fDocumentPartitioners.get(partitioning); |
803 | 802 |
804 if ( cast(IDocumentPartitionerExtension3)partitioner ) { | 803 if ( cast(IDocumentPartitionerExtension3)partitioner ) { |
805 IDocumentPartitionerExtension3 extension= cast(IDocumentPartitionerExtension3) partitioner; | 804 IDocumentPartitionerExtension3 extension= cast(IDocumentPartitionerExtension3) partitioner; |
806 if (extension.getActiveRewriteSession() !is null) | 805 if (extension.getActiveRewriteSession() !is null) |
918 */ | 917 */ |
919 public String getContentType(int offset) { | 918 public String getContentType(int offset) { |
920 String contentType= null; | 919 String contentType= null; |
921 try { | 920 try { |
922 contentType= getContentType(DEFAULT_PARTITIONING, offset, false); | 921 contentType= getContentType(DEFAULT_PARTITIONING, offset, false); |
923 Assert.isNotNull(contentType); | 922 //Assert.isNotNull(contentType); |
924 } catch (BadPartitioningException e) { | 923 } catch (BadPartitioningException e) { |
925 Assert.isTrue(false); | 924 Assert.isTrue(false); |
926 } | 925 } |
927 return contentType; | 926 return contentType; |
928 } | 927 } |
932 */ | 931 */ |
933 public String[] getLegalContentTypes() { | 932 public String[] getLegalContentTypes() { |
934 String[] contentTypes= null; | 933 String[] contentTypes= null; |
935 try { | 934 try { |
936 contentTypes= getLegalContentTypes(DEFAULT_PARTITIONING); | 935 contentTypes= getLegalContentTypes(DEFAULT_PARTITIONING); |
937 Assert.isNotNull(contentTypes); | 936 //Assert.isNotNull(contentTypes); |
938 } catch (BadPartitioningException e) { | 937 } catch (BadPartitioningException e) { |
939 Assert.isTrue(false); | 938 Assert.isTrue(false); |
940 } | 939 } |
941 return contentTypes; | 940 return contentTypes; |
942 } | 941 } |
1068 */ | 1067 */ |
1069 public ITypedRegion getPartition(int offset) { | 1068 public ITypedRegion getPartition(int offset) { |
1070 ITypedRegion partition= null; | 1069 ITypedRegion partition= null; |
1071 try { | 1070 try { |
1072 partition= getPartition(DEFAULT_PARTITIONING, offset, false); | 1071 partition= getPartition(DEFAULT_PARTITIONING, offset, false); |
1073 Assert.isNotNull(partition); | 1072 // Assert.isNotNull(cast(Object)partition); |
1074 } catch (BadPartitioningException e) { | 1073 } catch (BadPartitioningException e) { |
1075 Assert.isTrue(false); | 1074 Assert.isTrue(false); |
1076 } | 1075 } |
1077 return partition; | 1076 return partition; |
1078 } | 1077 } |
1082 */ | 1081 */ |
1083 public ITypedRegion[] computePartitioning(int offset, int length) { | 1082 public ITypedRegion[] computePartitioning(int offset, int length) { |
1084 ITypedRegion[] partitioning= null; | 1083 ITypedRegion[] partitioning= null; |
1085 try { | 1084 try { |
1086 partitioning= computePartitioning(DEFAULT_PARTITIONING, offset, length, false); | 1085 partitioning= computePartitioning(DEFAULT_PARTITIONING, offset, length, false); |
1087 Assert.isNotNull(partitioning); | 1086 // Assert.isNotNull(cast(Object)partitioning); |
1088 } catch (BadPartitioningException e) { | 1087 } catch (BadPartitioningException e) { |
1089 Assert.isTrue(false); | 1088 Assert.isTrue(false); |
1090 } | 1089 } |
1091 return partitioning; | 1090 return partitioning; |
1092 } | 1091 } |
1113 */ | 1112 */ |
1114 public String[] getPositionCategories() { | 1113 public String[] getPositionCategories() { |
1115 String[] categories= new String[fPositions.size()]; | 1114 String[] categories= new String[fPositions.size()]; |
1116 Iterator keys= fPositions.keySet().iterator(); | 1115 Iterator keys= fPositions.keySet().iterator(); |
1117 for (int i= 0; i < categories.length; i++) | 1116 for (int i= 0; i < categories.length; i++) |
1118 categories[i]= cast(String) keys.next(); | 1117 categories[i]= stringcast( keys.next()); |
1119 return categories; | 1118 return categories; |
1120 } | 1119 } |
1121 | 1120 |
1122 /* | 1121 /* |
1123 * @see dwtx.jface.text.IDocument#getPositionUpdaters() | 1122 * @see dwtx.jface.text.IDocument#getPositionUpdaters() |
1124 */ | 1123 */ |
1125 public IPositionUpdater[] getPositionUpdaters() { | 1124 public IPositionUpdater[] getPositionUpdaters() { |
1126 IPositionUpdater[] updaters= new IPositionUpdater[fPositionUpdaters.size()]; | 1125 return arraycast!(IPositionUpdater)(fPositionUpdaters.toArray()); |
1127 fPositionUpdaters.toArray(updaters); | |
1128 return updaters; | |
1129 } | 1126 } |
1130 | 1127 |
1131 /* | 1128 /* |
1132 * @see dwtx.jface.text.IDocument#get() | 1129 * @see dwtx.jface.text.IDocument#get() |
1133 */ | 1130 */ |
1149 * @see dwtx.jface.text.IDocument#insertPositionUpdater(dwtx.jface.text.IPositionUpdater, int) | 1146 * @see dwtx.jface.text.IDocument#insertPositionUpdater(dwtx.jface.text.IPositionUpdater, int) |
1150 */ | 1147 */ |
1151 public void insertPositionUpdater(IPositionUpdater updater, int index) { | 1148 public void insertPositionUpdater(IPositionUpdater updater, int index) { |
1152 | 1149 |
1153 for (int i= fPositionUpdaters.size() - 1; i >= 0; i--) { | 1150 for (int i= fPositionUpdaters.size() - 1; i >= 0; i--) { |
1154 if (fPositionUpdaters.get(i) is updater) | 1151 if (fPositionUpdaters.get(i) is cast(Object)updater) |
1155 return; | 1152 return; |
1156 } | 1153 } |
1157 | 1154 |
1158 if (index is fPositionUpdaters.size()) | 1155 if (index is fPositionUpdaters.size()) |
1159 fPositionUpdaters.add(updater); | 1156 fPositionUpdaters.add(cast(Object)updater); |
1160 else | 1157 else |
1161 fPositionUpdaters.add(index, updater); | 1158 fPositionUpdaters.add(index, cast(Object)updater); |
1162 } | 1159 } |
1163 | 1160 |
1164 /* | 1161 /* |
1165 * @see dwtx.jface.text.IDocument#removePosition(java.lang.String, dwtx.jface.text.Position) | 1162 * @see dwtx.jface.text.IDocument#removePosition(java.lang.String, dwtx.jface.text.Position) |
1166 */ | 1163 */ |
1250 /* | 1247 /* |
1251 * @see dwtx.jface.text.IDocument#removePositionUpdater(dwtx.jface.text.IPositionUpdater) | 1248 * @see dwtx.jface.text.IDocument#removePositionUpdater(dwtx.jface.text.IPositionUpdater) |
1252 */ | 1249 */ |
1253 public void removePositionUpdater(IPositionUpdater updater) { | 1250 public void removePositionUpdater(IPositionUpdater updater) { |
1254 for (int i= fPositionUpdaters.size() - 1; i >= 0; i--) { | 1251 for (int i= fPositionUpdaters.size() - 1; i >= 0; i--) { |
1255 if (fPositionUpdaters.get(i) is updater) { | 1252 if (fPositionUpdaters.get(i) is cast(Object)updater) { |
1256 fPositionUpdaters.remove(i); | 1253 fPositionUpdaters.remove(i); |
1257 return; | 1254 return; |
1258 } | 1255 } |
1259 } | 1256 } |
1260 } | 1257 } |
1308 | 1305 |
1309 /* | 1306 /* |
1310 * @see dwtx.jface.text.IDocument#replace(int, int, java.lang.String) | 1307 * @see dwtx.jface.text.IDocument#replace(int, int, java.lang.String) |
1311 */ | 1308 */ |
1312 public void replace(int pos, int length, String text) { | 1309 public void replace(int pos, int length, String text) { |
1313 if (length is 0 && (text is null || text.length() is 0)) | 1310 if (length is 0 && (text is null || text.length is 0)) |
1314 replace(pos, length, text, getModificationStamp()); | 1311 replace(pos, length, text, getModificationStamp()); |
1315 else | 1312 else |
1316 replace(pos, length, text, getNextModificationStamp()); | 1313 replace(pos, length, text, getNextModificationStamp()); |
1317 } | 1314 } |
1318 | 1315 |
1605 * @since 3.0 | 1602 * @since 3.0 |
1606 */ | 1603 */ |
1607 public String[] getPartitionings() { | 1604 public String[] getPartitionings() { |
1608 if (fDocumentPartitioners is null) | 1605 if (fDocumentPartitioners is null) |
1609 return new String[0]; | 1606 return new String[0]; |
1610 String[] partitionings= new String[fDocumentPartitioners.size()]; | 1607 return stringcast(fDocumentPartitioners.keySet().toArray()); |
1611 fDocumentPartitioners.keySet().toArray(partitionings); | |
1612 return partitionings; | |
1613 } | 1608 } |
1614 | 1609 |
1615 /* | 1610 /* |
1616 * @see dwtx.jface.text.IDocumentExtension3#setDocumentPartitioner(java.lang.String, dwtx.jface.text.IDocumentPartitioner) | 1611 * @see dwtx.jface.text.IDocumentExtension3#setDocumentPartitioner(java.lang.String, dwtx.jface.text.IDocumentPartitioner) |
1617 * @since 3.0 | 1612 * @since 3.0 |
1624 fDocumentPartitioners= null; | 1619 fDocumentPartitioners= null; |
1625 } | 1620 } |
1626 } else { | 1621 } else { |
1627 if (fDocumentPartitioners is null) | 1622 if (fDocumentPartitioners is null) |
1628 fDocumentPartitioners= new HashMap(); | 1623 fDocumentPartitioners= new HashMap(); |
1629 fDocumentPartitioners.put(partitioning, partitioner); | 1624 fDocumentPartitioners.put(partitioning, cast(Object)partitioner); |
1630 } | 1625 } |
1631 DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); | 1626 DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); |
1632 event.setPartitionChange(partitioning, 0, getLength()); | 1627 event.setPartitionChange(partitioning, 0, getLength()); |
1633 fireDocumentPartitioningChanged(event); | 1628 fireDocumentPartitioningChanged(event); |
1634 } | 1629 } |
1675 throw new IllegalStateException(); | 1670 throw new IllegalStateException(); |
1676 | 1671 |
1677 | 1672 |
1678 fDocumentRewriteSession= new DocumentRewriteSession(sessionType); | 1673 fDocumentRewriteSession= new DocumentRewriteSession(sessionType); |
1679 if (DEBUG) | 1674 if (DEBUG) |
1680 System.out_.println("AbstractDocument: Starting rewrite session: " + fDocumentRewriteSession); //$NON-NLS-1$ | 1675 System.out_.println(Format("AbstractDocument: Starting rewrite session: {}", fDocumentRewriteSession)); //$NON-NLS-1$ |
1681 | 1676 |
1682 fireRewriteSessionChanged(new DocumentRewriteSessionEvent(this, fDocumentRewriteSession, DocumentRewriteSessionEvent.SESSION_START)); | 1677 fireRewriteSessionChanged(new DocumentRewriteSessionEvent(this, fDocumentRewriteSession, DocumentRewriteSessionEvent.SESSION_START)); |
1683 | 1678 |
1684 startRewriteSessionOnPartitioners(fDocumentRewriteSession); | 1679 startRewriteSessionOnPartitioners(fDocumentRewriteSession); |
1685 | 1680 |
1722 */ | 1717 */ |
1723 public void stopRewriteSession(DocumentRewriteSession session) { | 1718 public void stopRewriteSession(DocumentRewriteSession session) { |
1724 if (fDocumentRewriteSession is session) { | 1719 if (fDocumentRewriteSession is session) { |
1725 | 1720 |
1726 if (DEBUG) | 1721 if (DEBUG) |
1727 System.out_.println("AbstractDocument: Stopping rewrite session: " + session); //$NON-NLS-1$ | 1722 System.out_.println(Format("AbstractDocument: Stopping rewrite session: {}", session)); //$NON-NLS-1$ |
1728 | 1723 |
1729 DocumentRewriteSessionType sessionType= session.getSessionType(); | 1724 DocumentRewriteSessionType sessionType= session.getSessionType(); |
1730 if (DocumentRewriteSessionType.SEQUENTIAL is sessionType || DocumentRewriteSessionType.STRICTLY_SEQUENTIAL is sessionType) | 1725 if (DocumentRewriteSessionType.SEQUENTIAL is sessionType || DocumentRewriteSessionType.STRICTLY_SEQUENTIAL is sessionType) |
1731 stopSequentialRewrite(); | 1726 stopSequentialRewrite(); |
1732 | 1727 |
1752 protected final void stopRewriteSessionOnPartitioners(DocumentRewriteSession session) { | 1747 protected final void stopRewriteSessionOnPartitioners(DocumentRewriteSession session) { |
1753 if (fDocumentPartitioners !is null) { | 1748 if (fDocumentPartitioners !is null) { |
1754 DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); | 1749 DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); |
1755 Iterator e= fDocumentPartitioners.keySet().iterator(); | 1750 Iterator e= fDocumentPartitioners.keySet().iterator(); |
1756 while (e.hasNext()) { | 1751 while (e.hasNext()) { |
1757 String partitioning= cast(String) e.next(); | 1752 String partitioning= stringcast( e.next()); |
1758 IDocumentPartitioner partitioner= cast(IDocumentPartitioner) fDocumentPartitioners.get(partitioning); | 1753 IDocumentPartitioner partitioner= cast(IDocumentPartitioner) fDocumentPartitioners.get(partitioning); |
1759 if ( cast(IDocumentPartitionerExtension3)partitioner ) { | 1754 if ( cast(IDocumentPartitionerExtension3)partitioner ) { |
1760 IDocumentPartitionerExtension3 extension= cast(IDocumentPartitionerExtension3) partitioner; | 1755 IDocumentPartitionerExtension3 extension= cast(IDocumentPartitionerExtension3) partitioner; |
1761 extension.stopRewriteSession(session); | 1756 extension.stopRewriteSession(session); |
1762 event.setPartitionChange(partitioning, 0, getLength()); | 1757 event.setPartitionChange(partitioning, 0, getLength()); |
1770 /* | 1765 /* |
1771 * @see dwtx.jface.text.IDocumentExtension4#addDocumentRewriteSessionListener(dwtx.jface.text.IDocumentRewriteSessionListener) | 1766 * @see dwtx.jface.text.IDocumentExtension4#addDocumentRewriteSessionListener(dwtx.jface.text.IDocumentRewriteSessionListener) |
1772 * @since 3.1 | 1767 * @since 3.1 |
1773 */ | 1768 */ |
1774 public void addDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener) { | 1769 public void addDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener) { |
1775 Assert.isNotNull(listener); | 1770 Assert.isNotNull(cast(Object)listener); |
1776 if (! fDocumentRewriteSessionListeners.contains(listener)) | 1771 if (! fDocumentRewriteSessionListeners.contains(cast(Object)listener)) |
1777 fDocumentRewriteSessionListeners.add(listener); | 1772 fDocumentRewriteSessionListeners.add(cast(Object)listener); |
1778 } | 1773 } |
1779 | 1774 |
1780 /* | 1775 /* |
1781 * @see dwtx.jface.text.IDocumentExtension4#removeDocumentRewriteSessionListener(dwtx.jface.text.IDocumentRewriteSessionListener) | 1776 * @see dwtx.jface.text.IDocumentExtension4#removeDocumentRewriteSessionListener(dwtx.jface.text.IDocumentRewriteSessionListener) |
1782 * @since 3.1 | 1777 * @since 3.1 |
1783 */ | 1778 */ |
1784 public void removeDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener) { | 1779 public void removeDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener) { |
1785 Assert.isNotNull(listener); | 1780 Assert.isNotNull(cast(Object)listener); |
1786 fDocumentRewriteSessionListeners.remove(listener); | 1781 fDocumentRewriteSessionListeners.remove(cast(Object)listener); |
1787 } | 1782 } |
1788 | 1783 |
1789 /** | 1784 /** |
1790 * Checks the state for the given partitioner and stops the | 1785 * Checks the state for the given partitioner and stops the |
1791 * active rewrite session. | 1786 * active rewrite session. |
1802 DocumentRewriteSession session= extension.getActiveRewriteSession(); | 1797 DocumentRewriteSession session= extension.getActiveRewriteSession(); |
1803 if (session !is null) { | 1798 if (session !is null) { |
1804 extension.stopRewriteSession(session); | 1799 extension.stopRewriteSession(session); |
1805 | 1800 |
1806 if (DEBUG) | 1801 if (DEBUG) |
1807 System.out_.println("AbstractDocument: Flushing rewrite session for partition type: " + partitioning); //$NON-NLS-1$ | 1802 System.out_.println(Format("AbstractDocument: Flushing rewrite session for partition type: {}", partitioning)); //$NON-NLS-1$ |
1808 | 1803 |
1809 DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); | 1804 DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); |
1810 event.setPartitionChange(partitioning, 0, getLength()); | 1805 event.setPartitionChange(partitioning, 0, getLength()); |
1811 fireDocumentPartitioningChanged(event); | 1806 fireDocumentPartitioningChanged(event); |
1812 } | 1807 } |