diff dwtx/jface/viewers/CheckboxTableViewer.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 7ffeace6c47f
children
line wrap: on
line diff
--- a/dwtx/jface/viewers/CheckboxTableViewer.d	Sun Aug 03 17:01:51 2008 +0200
+++ b/dwtx/jface/viewers/CheckboxTableViewer.d	Thu Aug 07 15:01:33 2008 +0200
@@ -20,8 +20,6 @@
 import dwtx.jface.viewers.ColumnWeightData;
 import dwtx.jface.viewers.CustomHashtable;
 
-import tango.util.collection.ArraySeq;
-import tango.util.collection.model.Seq;
 
 import dwt.DWT;
 import dwt.events.SelectionEvent;
@@ -35,6 +33,7 @@
 import dwtx.jface.util.SafeRunnable;
 
 import dwt.dwthelper.utils;
+import dwtx.dwtxhelper.Collection;
 import dwt.dwthelper.Runnable;
 
 /**
@@ -187,17 +186,9 @@
     private void fireCheckStateChanged(CheckStateChangedEvent event) {
         Object[] array = checkStateListeners.getListeners();
         for (int i = 0; i < array.length; i++) {
-            SafeRunnable.run(new class(cast(ICheckStateListener) array[i], event) SafeRunnable {
-                ICheckStateListener l;
-                CheckStateChangedEvent event_;
-                this(ICheckStateListener a,CheckStateChangedEvent b){
-                    event_=b;
-                    l = a;
-                }
-                public void run() {
-                    l.checkStateChanged(event_);
-                }
-            });
+            SafeRunnable.run( dgSafeRunnable( (ICheckStateListener l, CheckStateChangedEvent event_) {
+                l.checkStateChanged(event_);
+            }, cast(ICheckStateListener) array[i], event ));
         }
     }
 
@@ -225,12 +216,11 @@
      */
     public Object[] getCheckedElements() {
         TableItem[] children = getTable().getItems();
-        auto v = new ArraySeq!(Object);
-        v.capacity(children.length);
+        ArrayList v = new ArrayList(children.length);
         for (int i = 0; i < children.length; i++) {
             TableItem item = children[i];
             if (item.getChecked()) {
-                v.append(item.getData());
+                v.add(item.getData());
             }
         }
         return v.toArray();
@@ -264,12 +254,11 @@
      */
     public Object[] getGrayedElements() {
         TableItem[] children = getTable().getItems();
-        auto v = new ArraySeq!(Object);
-        v.capacity(children.length);
+        ArrayList v = new ArrayList(children.length);
         for (int i = 0; i < children.length; i++) {
             TableItem item = children[i];
             if (item.getGrayed()) {
-                v.append(item.getData());
+                v.add(item.getData());
             }
         }
         return v.toArray();