Mercurial > projects > dwt-addons
diff dwtx/jface/text/source/AnnotationModel.d @ 145:02cd5f1224d3
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 22:31:00 +0200 |
parents | 26688fec6d23 |
children | 75302ef3f92f |
line wrap: on
line diff
--- a/dwtx/jface/text/source/AnnotationModel.d Sun Aug 24 21:34:15 2008 +0200 +++ b/dwtx/jface/text/source/AnnotationModel.d Sun Aug 24 22:31:00 2008 +0200 @@ -109,26 +109,26 @@ /** * Iterator that returns the annotations for a given region. - * + * * @since 3.4 * @see AnnotationModel.RegionIterator#RegionIterator(Iterator, IAnnotationModel, int, int, bool, bool) */ private static final class RegionIterator : Iterator { - + private final Iterator fParentIterator; private final bool fCanEndAfter; private final bool fCanStartBefore; private final IAnnotationModel fModel; private Object fNext; private Position fRegion; - + /** * Iterator that returns all annotations from the parent iterator which * have a position in the given model inside the given region. * <p> * See {@link IAnnotationModelExtension2} for a definition of inside. * </p> - * + * * @param parentIterator iterator containing all annotations * @param model the model to use to retrieve positions from for each * annotation @@ -146,33 +146,33 @@ fCanStartBefore= canStartBefore; fNext= findNext(); } - + /* * @see java.util.Iterator#hasNext() */ public bool hasNext() { return fNext !is null; } - + /* * @see java.util.Iterator#next() */ public Object next() { if (!hasNext()) throw new NoSuchElementException(); - + Object result= fNext; fNext= findNext(); return result; } - + /* * @see java.util.Iterator#remove() */ public void remove() { throw new UnsupportedOperationException(); } - + private Object findNext() { while (fParentIterator.hasNext()) { Annotation next= cast(Annotation) fParentIterator.next(); @@ -197,20 +197,20 @@ return fRegion.includes(start) && fRegion.includes(start + length - 1); } } - + /** * An iterator iteration over a Positions and mapping positions to * annotations using a provided map if the provided map contains the element. - * + * * @since 3.4 */ private static final class AnnotationsInterator : Iterator { - + private Object fNext; private final Position[] fPositions; private int fIndex; private final Map fMap; - + /** * @param positions positions to iterate over * @param map a map to map positions to annotations @@ -221,14 +221,14 @@ fMap= map; fNext= findNext(); } - + /* (non-Javadoc) * @see java.util.Iterator#hasNext() */ public bool hasNext() { return fNext !is null; } - + /* (non-Javadoc) * @see java.util.Iterator#next() */ @@ -237,14 +237,14 @@ fNext= findNext(); return result; } - + /* (non-Javadoc) * @see java.util.Iterator#remove() */ public void remove() { throw new UnsupportedOperationException(); } - + private Object findNext() { while (fIndex < fPositions.length) { Position position= fPositions[fIndex]; @@ -252,7 +252,7 @@ if (fMap.containsKey(position)) return fMap.get(position); } - + return null; } } @@ -740,11 +740,7 @@ removeAnnotations(deleted, false, false); synchronized (getLockObject()) { if (fModelEvent !is null) - new class() Thread { - public void run() { - fireModelChanged(); - } - }.start(); + (new Thread ( &fireModelChanged() )).start(); } } else removeAnnotations(deleted, fireModelChanged, false); @@ -760,15 +756,15 @@ /** * {@inheritDoc} - * + * * @since 3.4 */ public Iterator getAnnotationIterator(int offset, int length, bool canStartBefore, bool canEndAfter) { Iterator regionIterator= getRegionAnnotationIterator(offset, length, canStartBefore, canEndAfter); - + if (fAttachments.isEmpty()) return regionIterator; - + List iterators= new ArrayList(fAttachments.size() + 1); iterators.add(regionIterator); Iterator it= fAttachments.keySet().iterator(); @@ -779,13 +775,13 @@ else iterators.add(new RegionIterator(attachment.getAnnotationIterator(), attachment, offset, length, canStartBefore, canEndAfter)); } - + return new MetaIterator(iterators.iterator()); } - + /** * Returns an iterator as specified in {@link IAnnotationModelExtension2#getAnnotationIterator(int, int, bool, bool)} - * + * * @param offset region start * @param length region length * @param canStartBefore position can start before region @@ -797,10 +793,10 @@ private Iterator getRegionAnnotationIterator(int offset, int length, bool canStartBefore, bool canEndAfter) { if (!( cast(AbstractDocument)fDocument )) return new RegionIterator(getAnnotationIterator(true), this, offset, length, canStartBefore, canEndAfter); - + AbstractDocument document= cast(AbstractDocument) fDocument; cleanup(true); - + try { Position[] positions= document.getPositions(IDocument.DEFAULT_CATEGORY, offset, length, canStartBefore, canEndAfter); return new AnnotationsInterator(positions, fPositions);