diff dwtx/jface/resource/ResourceManager.d @ 104:04b47443bb01

Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections. These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author Frank Benoit <benoit@tionex.de>
date Thu, 07 Aug 2008 15:01:33 +0200
parents 6c14e54dfc11
children
line wrap: on
line diff
--- a/dwtx/jface/resource/ResourceManager.d	Sun Aug 03 17:01:51 2008 +0200
+++ b/dwtx/jface/resource/ResourceManager.d	Thu Aug 07 15:01:33 2008 +0200
@@ -20,8 +20,6 @@
 import dwtx.jface.resource.RGBColorDescriptor;
 
 // import java.util.ArrayList;
-import tango.util.collection.model.Seq;
-import tango.util.collection.ArraySeq;
 
 import dwt.DWTException;
 import dwt.graphics.Color;
@@ -35,6 +33,7 @@
 import dwtx.jface.util.Policy;
 
 import dwt.dwthelper.utils;
+import dwtx.dwtxhelper.Collection;
 import dwt.dwthelper.Runnable;
 
 /**
@@ -58,7 +57,7 @@
      * List of Runnables scheduled to run when the ResourceManager is disposed.
      * null if empty.
      */
-    private Seq!(Runnable) disposeExecs = null;
+    private List disposeExecs = null;
 
     /**
      * Returns the Device for which this ResourceManager will create resources
@@ -339,7 +338,7 @@
         // here and throw it at the end of the method.
         RuntimeException foundException = null;
 
-        Runnable[] execs = disposeExecs.toArray();
+        Runnable[] execs = arraycast!(Runnable)(disposeExecs.toArray());
         for (int i = 0; i < execs.length; i++) {
             Runnable exec = execs[i];
 
@@ -380,10 +379,10 @@
         Assert.isNotNull(cast(Object)r);
 
         if (disposeExecs is null) {
-            disposeExecs = new ArraySeq!(Runnable);
+            disposeExecs = new ArrayList();
         }
 
-        disposeExecs.append(r);
+        disposeExecs.add(cast(Object)r);
     }
 
     /**
@@ -400,9 +399,9 @@
             return;
         }
 
-        disposeExecs.remove(r);
+        disposeExecs.remove(cast(Object)r);
 
-        if (disposeExecs.drained()) {
+        if (disposeExecs.isEmpty()) {
             disposeExecs = null;
         }
     }