Mercurial > projects > dwt-addons
comparison dwtx/jface/text/source/AnnotationModel.d @ 138:b6bad70d540a
Regex instanceof changes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:26:23 +0200 |
parents | 25170b5a8951 |
children | 26688fec6d23 |
comparison
equal
deleted
inserted
replaced
137:25170b5a8951 | 138:b6bad70d540a |
---|---|
518 * @see dwtx.jface.text.source.IAnnotationModel#addAnnotationModelListener(dwtx.jface.text.source.IAnnotationModelListener) | 518 * @see dwtx.jface.text.source.IAnnotationModel#addAnnotationModelListener(dwtx.jface.text.source.IAnnotationModelListener) |
519 */ | 519 */ |
520 public void addAnnotationModelListener(IAnnotationModelListener listener) { | 520 public void addAnnotationModelListener(IAnnotationModelListener listener) { |
521 if (!fAnnotationModelListeners.contains(listener)) { | 521 if (!fAnnotationModelListeners.contains(listener)) { |
522 fAnnotationModelListeners.add(listener); | 522 fAnnotationModelListeners.add(listener); |
523 if (listener instanceof IAnnotationModelListenerExtension) { | 523 if ( cast(IAnnotationModelListenerExtension)listener ) { |
524 IAnnotationModelListenerExtension extension= cast(IAnnotationModelListenerExtension) listener; | 524 IAnnotationModelListenerExtension extension= cast(IAnnotationModelListenerExtension) listener; |
525 AnnotationModelEvent event= createAnnotationModelEvent(); | 525 AnnotationModelEvent event= createAnnotationModelEvent(); |
526 event.markSealed(); | 526 event.markSealed(); |
527 extension.modelChanged(event); | 527 extension.modelChanged(event); |
528 } else | 528 } else |
674 | 674 |
675 ArrayList v= new ArrayList(fAnnotationModelListeners); | 675 ArrayList v= new ArrayList(fAnnotationModelListeners); |
676 Iterator e= v.iterator(); | 676 Iterator e= v.iterator(); |
677 while (e.hasNext()) { | 677 while (e.hasNext()) { |
678 IAnnotationModelListener l= cast(IAnnotationModelListener) e.next(); | 678 IAnnotationModelListener l= cast(IAnnotationModelListener) e.next(); |
679 if (l instanceof IAnnotationModelListenerExtension) | 679 if ( cast(IAnnotationModelListenerExtension)l ) |
680 (cast(IAnnotationModelListenerExtension) l).modelChanged(event); | 680 (cast(IAnnotationModelListenerExtension) l).modelChanged(event); |
681 else if (l !is null) | 681 else if (l !is null) |
682 l.modelChanged(this); | 682 l.modelChanged(this); |
683 } | 683 } |
684 } | 684 } |
772 List iterators= new ArrayList(fAttachments.size() + 1); | 772 List iterators= new ArrayList(fAttachments.size() + 1); |
773 iterators.add(regionIterator); | 773 iterators.add(regionIterator); |
774 Iterator it= fAttachments.keySet().iterator(); | 774 Iterator it= fAttachments.keySet().iterator(); |
775 while (it.hasNext()) { | 775 while (it.hasNext()) { |
776 IAnnotationModel attachment= cast(IAnnotationModel) fAttachments.get(it.next()); | 776 IAnnotationModel attachment= cast(IAnnotationModel) fAttachments.get(it.next()); |
777 if (attachment instanceof IAnnotationModelExtension2) | 777 if ( cast(IAnnotationModelExtension2)attachment ) |
778 iterators.add((cast(IAnnotationModelExtension2) attachment).getAnnotationIterator(offset, length, canStartBefore, canEndAfter)); | 778 iterators.add((cast(IAnnotationModelExtension2) attachment).getAnnotationIterator(offset, length, canStartBefore, canEndAfter)); |
779 else | 779 else |
780 iterators.add(new RegionIterator(attachment.getAnnotationIterator(), attachment, offset, length, canStartBefore, canEndAfter)); | 780 iterators.add(new RegionIterator(attachment.getAnnotationIterator(), attachment, offset, length, canStartBefore, canEndAfter)); |
781 } | 781 } |
782 | 782 |
793 * @return an iterator to iterate over annotations in region | 793 * @return an iterator to iterate over annotations in region |
794 * @see IAnnotationModelExtension2#getAnnotationIterator(int, int, bool, bool) | 794 * @see IAnnotationModelExtension2#getAnnotationIterator(int, int, bool, bool) |
795 * @since 3.4 | 795 * @since 3.4 |
796 */ | 796 */ |
797 private Iterator getRegionAnnotationIterator(int offset, int length, bool canStartBefore, bool canEndAfter) { | 797 private Iterator getRegionAnnotationIterator(int offset, int length, bool canStartBefore, bool canEndAfter) { |
798 if (!(fDocument instanceof AbstractDocument)) | 798 if (!( cast(AbstractDocument)fDocument )) |
799 return new RegionIterator(getAnnotationIterator(true), this, offset, length, canStartBefore, canEndAfter); | 799 return new RegionIterator(getAnnotationIterator(true), this, offset, length, canStartBefore, canEndAfter); |
800 | 800 |
801 AbstractDocument document= cast(AbstractDocument) fDocument; | 801 AbstractDocument document= cast(AbstractDocument) fDocument; |
802 cleanup(true); | 802 cleanup(true); |
803 | 803 |