diff dwtx/jface/text/link/LinkedPositionAnnotations.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents f70d9508c95c
children
line wrap: on
line diff
--- a/dwtx/jface/text/link/LinkedPositionAnnotations.d	Wed Aug 27 14:49:30 2008 +0200
+++ b/dwtx/jface/text/link/LinkedPositionAnnotations.d	Mon Sep 08 00:51:37 2008 +0200
@@ -60,11 +60,16 @@
 
     private Annotation fFocusAnnotation= null;
     private Annotation fExitAnnotation= null;
-    private const Map fGroupAnnotations= new HashMap();
-    private const Map fTargetAnnotations= new HashMap();
-    private Position[] fTargets= new Position[0];
+    private const Map fGroupAnnotations;
+    private const Map fTargetAnnotations;
+    private Position[] fTargets;
     private LinkedPosition fExitPosition= null;
 
+    public this(){
+        fGroupAnnotations= new HashMap();
+        fTargetAnnotations= new HashMap();
+    }
+
     /**
      * Sets the position that should be highlighted as the focus position, i.e.
      * as the position whose changes are propagated to all its linked positions
@@ -134,7 +139,7 @@
         }
         fGroupAnnotations.values().removeAll(toRemove);
 
-        replaceAnnotations((Annotation[]) toRemove.toArray(new Annotation[0]), toAdd, false);
+        replaceAnnotations(arraycast!(Annotation)( toRemove.toArray()), toAdd, false);
     }
 
     /**
@@ -168,7 +173,7 @@
         }
         fTargetAnnotations.values().removeAll(toRemove);
 
-        replaceAnnotations((Annotation[]) toRemove.toArray(new Annotation[0]), toAdd, false);
+        replaceAnnotations(arraycast!(Annotation)( toRemove.toArray()), toAdd, false);
     }
 
     /**
@@ -199,12 +204,12 @@
         else
             group= new ArrayList();
 
-        if (position is null || !fDocument.equals(position.getDocument()))
+        if (position is null || !(cast(Object)fDocument).opEquals(cast(Object)position.getDocument()))
             // position is not valid if not in this document
             position= null;
 
         LinkedPosition exit= fExitPosition;
-        if (exit is null || !fDocument.equals(exit.getDocument()))
+        if (exit is null || !(cast(Object)fDocument).opEquals(cast(Object)exit.getDocument()))
             // position is not valid if not in this document
             exit= null;
 
@@ -243,7 +248,7 @@
     private void prune(List list) {
         for (Iterator iter= list.iterator(); iter.hasNext();) {
             LinkedPosition pos= cast(LinkedPosition) iter.next();
-            if (!pos.getDocument().equals(fDocument))
+            if (!(cast(Object)pos.getDocument()).opEquals(cast(Object)fDocument))
                 iter.remove();
         }
     }