diff dwtx/core/commands/operations/AbstractOperation.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 46a6e0e6ccd4
children
line wrap: on
line diff
--- a/dwtx/core/commands/operations/AbstractOperation.d	Sun Aug 03 17:01:51 2008 +0200
+++ b/dwtx/core/commands/operations/AbstractOperation.d	Thu Aug 07 15:01:33 2008 +0200
@@ -12,9 +12,6 @@
  *******************************************************************************/
 module dwtx.core.commands.operations.AbstractOperation;
 
-import tango.util.collection.ArraySeq;
-import tango.util.collection.model.Seq;
-
 import dwtx.core.commands.ExecutionException;
 import dwtx.core.runtime.Assert;
 import dwtx.core.runtime.IAdaptable;
@@ -25,6 +22,7 @@
 import dwtx.core.commands.operations.IUndoContext;
 
 import dwt.dwthelper.utils;
+import dwtx.dwtxhelper.Collection;
 static import tango.text.Text;
 alias tango.text.Text.Text!(char) StringBuffer;
 
@@ -43,7 +41,7 @@
  * @since 3.1
  */
 public abstract class AbstractOperation : IUndoableOperation {
-    Seq!(IUndoContext) contexts;
+    List contexts;
 
     private String label = ""; //$NON-NLS-1$
 
@@ -57,7 +55,7 @@
     public this(String label) {
         Assert.isNotNull(label);
         this.label = label;
-        contexts = new ArraySeq!(IUndoContext);
+        contexts = new ArrayList();
     }
 
     /*
@@ -68,8 +66,8 @@
      * <p> Subclasses may override this method. </p>
      */
     public void addContext(IUndoContext context) {
-        if (!contexts.contains(context)) {
-            contexts.append(context);
+        if (!contexts.contains(cast(Object)context)) {
+            contexts.add(cast(Object)context);
         }
     }
 
@@ -127,7 +125,7 @@
     public abstract IStatus execute(IProgressMonitor monitor, IAdaptable info);
 
     public final IUndoContext[] getContexts() {
-        return contexts.toArray();
+        return arraycast!(IUndoContext)(contexts.toArray());
     }
 
     /*
@@ -160,7 +158,7 @@
     public final bool hasContext(IUndoContext context) {
         Assert.isNotNull(cast(Object)context);
         for (int i = 0; i < contexts.size(); i++) {
-            IUndoContext otherContext = contexts.get(i);
+            IUndoContext otherContext = cast(IUndoContext)contexts.get(i);
             // have to check both ways because one context may be more general
             // in
             // its matching rules than another.
@@ -188,7 +186,7 @@
      */
 
     public void removeContext(IUndoContext context) {
-        contexts.remove(context);
+        contexts.remove(cast(Object)context);
     }
 
     /*