Mercurial > projects > dwt-addons
comparison dwtx/jface/text/rules/DefaultPartitioner.d @ 162:1a5b8f8129df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 08 Sep 2008 00:51:37 +0200 |
parents | 3678e4f1a766 |
children | eb98a5cbfd78 |
comparison
equal
deleted
inserted
replaced
161:f8d52b926852 | 162:1a5b8f8129df |
---|---|
126 * @param legalContentTypes the legal content types of this partitioner | 126 * @param legalContentTypes the legal content types of this partitioner |
127 */ | 127 */ |
128 public this(IPartitionTokenScanner scanner, String[] legalContentTypes) { | 128 public this(IPartitionTokenScanner scanner, String[] legalContentTypes) { |
129 fScanner= scanner; | 129 fScanner= scanner; |
130 fLegalContentTypes= TextUtilities.copy(legalContentTypes); | 130 fLegalContentTypes= TextUtilities.copy(legalContentTypes); |
131 fPositionCategory= CONTENT_TYPES_CATEGORY + toHash(); | 131 fPositionCategory= CONTENT_TYPES_CATEGORY ~ Integer.toString(toHash()); |
132 fPositionUpdater= new DefaultPositionUpdater(fPositionCategory); | 132 fPositionUpdater= new DefaultPositionUpdater(fPositionCategory); |
133 } | 133 } |
134 | 134 |
135 /* | 135 /* |
136 * @see dwtx.jface.text.IDocumentPartitionerExtension2#getManagingPositionCategories() | 136 * @see dwtx.jface.text.IDocumentPartitionerExtension2#getManagingPositionCategories() |
150 /* | 150 /* |
151 * @see dwtx.jface.text.IDocumentPartitionerExtension3#connect(dwtx.jface.text.IDocument, bool) | 151 * @see dwtx.jface.text.IDocumentPartitionerExtension3#connect(dwtx.jface.text.IDocument, bool) |
152 * @since 3.1 | 152 * @since 3.1 |
153 */ | 153 */ |
154 public void connect(IDocument document, bool delayInitialization) { | 154 public void connect(IDocument document, bool delayInitialization) { |
155 Assert.isNotNull(document); | 155 Assert.isNotNull(cast(Object)document); |
156 Assert.isTrue(!document.containsPositionCategory(fPositionCategory)); | 156 Assert.isTrue(!document.containsPositionCategory(fPositionCategory)); |
157 | 157 |
158 fDocument= document; | 158 fDocument= document; |
159 fDocument.addPositionCategory(fPositionCategory); | 159 fDocument.addPositionCategory(fPositionCategory); |
160 | 160 |
556 * @param token the token whose content type is to be determined | 556 * @param token the token whose content type is to be determined |
557 * @return the token's content type | 557 * @return the token's content type |
558 */ | 558 */ |
559 protected String getTokenContentType(IToken token) { | 559 protected String getTokenContentType(IToken token) { |
560 Object data= token.getData(); | 560 Object data= token.getData(); |
561 if ( cast(String)data ) | 561 if ( auto str = cast(ArrayWrapperString)data ) |
562 return cast(String) data; | 562 return str.array; |
563 return null; | 563 return null; |
564 } | 564 } |
565 | 565 |
566 /* zero-length partition support */ | 566 /* zero-length partition support */ |
567 | 567 |
651 list.add(new TypedRegion(offset, length, IDocument.DEFAULT_CONTENT_TYPE)); | 651 list.add(new TypedRegion(offset, length, IDocument.DEFAULT_CONTENT_TYPE)); |
652 | 652 |
653 } catch (BadPositionCategoryException x) { | 653 } catch (BadPositionCategoryException x) { |
654 } | 654 } |
655 | 655 |
656 TypedRegion[] result= new TypedRegion[list.size()]; | 656 return arraycast!(ITypedRegion)(list.toArray()); |
657 list.toArray(result); | |
658 return result; | |
659 } | 657 } |
660 | 658 |
661 /** | 659 /** |
662 * Returns <code>true</code> if the given ranges overlap with or touch each other. | 660 * Returns <code>true</code> if the given ranges overlap with or touch each other. |
663 * | 661 * |