diff dwtx/jface/text/source/AnnotationModel.d @ 134:51e6e63f930e

Regex fix for casts
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 01:46:20 +0200
parents 7d818bd32d63
children 65801ad2b265
line wrap: on
line diff
--- a/dwtx/jface/text/source/AnnotationModel.d	Sun Aug 24 01:29:22 2008 +0200
+++ b/dwtx/jface/text/source/AnnotationModel.d	Sun Aug 24 01:46:20 2008 +0200
@@ -175,7 +175,7 @@
         
         private Object findNext() {
             while (fParentIterator.hasNext()) {
-                Annotation next= (Annotation) fParentIterator.next();
+                Annotation next= cast(Annotation) fParentIterator.next();
                 Position position= fModel.getPosition(next);
                 if (position !is null) {
                     int offset= position.getOffset();
@@ -274,7 +274,7 @@
 
         public this(Iterator iterator) {
             fSuperIterator= iterator;
-            fCurrent= (Iterator) fSuperIterator.next(); // there is at least one.
+            fCurrent= cast(Iterator) fSuperIterator.next(); // there is at least one.
         }
 
         public void remove() {
@@ -289,7 +289,7 @@
                 fCurrentElement= fCurrent.next();
                 return true;
             } else if (fSuperIterator.hasNext()) {
-                fCurrent= (Iterator) fSuperIterator.next();
+                fCurrent= cast(Iterator) fSuperIterator.next();
                 return hasNext();
             } else
                 return false;
@@ -396,7 +396,7 @@
      * @since 3.0
      */
     protected IAnnotationMap getAnnotationMap() {
-        return (IAnnotationMap) fAnnotations;
+        return cast(IAnnotationMap) fAnnotations;
     }
 
     /*
@@ -478,8 +478,8 @@
             Iterator iter= annotationsToAdd.entrySet().iterator();
             while (iter.hasNext()) {
                 Map.Entry mapEntry= (Map.Entry) iter.next();
-                Annotation annotation= (Annotation) mapEntry.getKey();
-                Position position= (Position) mapEntry.getValue();
+                Annotation annotation= cast(Annotation) mapEntry.getKey();
+                Position position= cast(Position) mapEntry.getValue();
                 addAnnotation(annotation, position, false);
             }
         }
@@ -521,7 +521,7 @@
         if (!fAnnotationModelListeners.contains(listener)) {
             fAnnotationModelListeners.add(listener);
             if (listener instanceof IAnnotationModelListenerExtension) {
-                IAnnotationModelListenerExtension extension= (IAnnotationModelListenerExtension) listener;
+                IAnnotationModelListenerExtension extension= cast(IAnnotationModelListenerExtension) listener;
                 AnnotationModelEvent event= createAnnotationModelEvent();
                 event.markSealed();
                 extension.modelChanged(event);
@@ -568,7 +568,7 @@
             Iterator e= getAnnotationMap().valuesIterator();
             while (e.hasNext())
                 try {
-                    addPosition(fDocument, (Position) e.next());
+                    addPosition(fDocument, cast(Position) e.next());
                 } catch (BadLocationException x) {
                     // ignore invalid position
                 }
@@ -581,7 +581,7 @@
         }
 
         for (Iterator it= fAttachments.keySet().iterator(); it.hasNext();) {
-            IAnnotationModel model= (IAnnotationModel) fAttachments.get(it.next());
+            IAnnotationModel model= cast(IAnnotationModel) fAttachments.get(it.next());
             model.connect(document);
         }
     }
@@ -608,7 +608,7 @@
         Assert.isTrue(fDocument is document);
 
         for (Iterator it= fAttachments.keySet().iterator(); it.hasNext();) {
-            IAnnotationModel model= (IAnnotationModel) fAttachments.get(it.next());
+            IAnnotationModel model= cast(IAnnotationModel) fAttachments.get(it.next());
             model.disconnect(document);
         }
 
@@ -621,7 +621,7 @@
             if (fDocument !is null) {
                 Iterator e= getAnnotationMap().valuesIterator();
                 while (e.hasNext()) {
-                    Position p= (Position) e.next();
+                    Position p= cast(Position) e.next();
                     removePosition(fDocument, p);
                 }
                 fDocument= null;
@@ -675,9 +675,9 @@
         ArrayList v= new ArrayList(fAnnotationModelListeners);
         Iterator e= v.iterator();
         while (e.hasNext()) {
-            IAnnotationModelListener l= (IAnnotationModelListener) e.next();
+            IAnnotationModelListener l= cast(IAnnotationModelListener) e.next();
             if (l instanceof IAnnotationModelListenerExtension)
-                ((IAnnotationModelListenerExtension) l).modelChanged(event);
+                (cast(IAnnotationModelListenerExtension) l).modelChanged(event);
             else if (l !is null)
                 l.modelChanged(this);
         }
@@ -697,7 +697,7 @@
         if (annotations.size() > 0) {
             Iterator e= annotations.iterator();
             while (e.hasNext())
-                removeAnnotation((Annotation) e.next(), false);
+                removeAnnotation(cast(Annotation) e.next(), false);
 
             if (fireModelChanged)
                 fireModelChanged();
@@ -730,8 +730,8 @@
             ArrayList deleted= new ArrayList();
             Iterator e= getAnnotationMap().keySetIterator();
             while (e.hasNext()) {
-                Annotation a= (Annotation) e.next();
-                Position p= (Position) fAnnotations.get(a);
+                Annotation a= cast(Annotation) e.next();
+                Position p= cast(Position) fAnnotations.get(a);
                 if (p is null || p.isDeleted())
                     deleted.add(a);
             }
@@ -773,9 +773,9 @@
         iterators.add(regionIterator);
         Iterator it= fAttachments.keySet().iterator();
         while (it.hasNext()) {
-            IAnnotationModel attachment= (IAnnotationModel) fAttachments.get(it.next());
+            IAnnotationModel attachment= cast(IAnnotationModel) fAttachments.get(it.next());
             if (attachment instanceof IAnnotationModelExtension2)
-                iterators.add(((IAnnotationModelExtension2) attachment).getAnnotationIterator(offset, length, canStartBefore, canEndAfter));
+                iterators.add((cast(IAnnotationModelExtension2) attachment).getAnnotationIterator(offset, length, canStartBefore, canEndAfter));
             else
                 iterators.add(new RegionIterator(attachment.getAnnotationIterator(), attachment, offset, length, canStartBefore, canEndAfter));
         }
@@ -798,7 +798,7 @@
         if (!(fDocument instanceof AbstractDocument))
             return new RegionIterator(getAnnotationIterator(true), this, offset, length, canStartBefore, canEndAfter);
         
-        AbstractDocument document= (AbstractDocument) fDocument;
+        AbstractDocument document= cast(AbstractDocument) fDocument;
         cleanup(true);
         
         try {
@@ -831,7 +831,7 @@
         iterators.add(iter);
         Iterator it= fAttachments.keySet().iterator();
         while (it.hasNext())
-            iterators.add(((IAnnotationModel) fAttachments.get(it.next())).getAnnotationIterator());
+            iterators.add((cast(IAnnotationModel) fAttachments.get(it.next())).getAnnotationIterator());
 
         return new MetaIterator(iterators.iterator());
     }
@@ -855,13 +855,13 @@
      * @see dwtx.jface.text.source.IAnnotationModel#getPosition(dwtx.jface.text.source.Annotation)
      */
     public Position getPosition(Annotation annotation) {
-        Position position= (Position) fAnnotations.get(annotation);
+        Position position= cast(Position) fAnnotations.get(annotation);
         if (position !is null)
             return position;
 
         Iterator it= fAttachments.values().iterator();
         while (position is null && it.hasNext())
-            position= ((IAnnotationModel) it.next()).getPosition(annotation);
+            position= (cast(IAnnotationModel) it.next()).getPosition(annotation);
         return position;
     }
 
@@ -884,8 +884,8 @@
         if (fDocument !is null) {
             Iterator e= getAnnotationMap().keySetIterator();
             while (e.hasNext()) {
-                Annotation a= (Annotation) e.next();
-                Position p= (Position) fAnnotations.get(a);
+                Annotation a= cast(Annotation) e.next();
+                Position p= cast(Position) fAnnotations.get(a);
                 removePosition(fDocument, p);
 //              p.delete();
                 synchronized (getLockObject()) {
@@ -919,7 +919,7 @@
         if (fAnnotations.containsKey(annotation)) {
 
             Position p= null;
-            p= (Position) fAnnotations.get(annotation);
+            p= cast(Position) fAnnotations.get(annotation);
             if (fDocument !is null) {
                 removePosition(fDocument, p);
 //              p.delete();
@@ -964,7 +964,7 @@
         if (position is null) {
             removeAnnotation(annotation, fireModelChanged);
         } else {
-            Position p= (Position) fAnnotations.get(annotation);
+            Position p= cast(Position) fAnnotations.get(annotation);
             if (p !is null) {
 
                 if (position.getOffset() !is p.getOffset() || position.getLength() !is p.getLength()) {
@@ -1040,7 +1040,7 @@
      * @since 3.0
      */
     public IAnnotationModel getAnnotationModel(Object key) {
-        return (IAnnotationModel) fAttachments.get(key);
+        return cast(IAnnotationModel) fAttachments.get(key);
     }
 
     /*
@@ -1048,7 +1048,7 @@
      * @since 3.0
      */
     public IAnnotationModel removeAnnotationModel(Object key) {
-        IAnnotationModel ret= (IAnnotationModel) fAttachments.remove(key);
+        IAnnotationModel ret= cast(IAnnotationModel) fAttachments.remove(key);
         if (ret !is null) {
             for (int i= 0; i < fOpenConnections; i++)
                 ret.disconnect(fDocument);