Mercurial > projects > dwt-addons
diff dwtx/jface/action/ToolBarManager.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 | 5df4896124c7 |
children |
line wrap: on
line diff
--- a/dwtx/jface/action/ToolBarManager.d Sun Aug 03 17:01:51 2008 +0200 +++ b/dwtx/jface/action/ToolBarManager.d Thu Aug 07 15:01:33 2008 +0200 @@ -17,7 +17,6 @@ import dwtx.jface.action.MenuManager; import dwtx.jface.action.IContributionItem; -import tango.util.collection.ArraySeq; // import java.util.Iterator; import dwt.DWT; @@ -35,6 +34,7 @@ import dwt.widgets.ToolItem; import dwt.dwthelper.utils; +import dwtx.dwtxhelper.Collection; /** * A tool bar manager is a contribution manager which realizes itself and its @@ -254,8 +254,7 @@ // clean contains all active items without double separators IContributionItem[] items = getItems(); - auto clean = new ArraySeq!(Object); - clean.capacity(items.length); + ArrayList clean = new ArrayList(items.length); IContributionItem separator = null; // long cleanStartTime= 0; // if (DEBUG) { @@ -274,11 +273,11 @@ } else { if (separator !is null) { if (clean.size() > 0) { - clean.append(cast(Object)separator); + clean.add(cast(Object)separator); } separator = null; } - clean.append(cast(Object)ci); + clean.add(cast(Object)ci); } } // if (DEBUG) { @@ -288,15 +287,14 @@ // determine obsolete items (removed or non active) ToolItem[] mi = toolBar.getItems(); - auto toRemove = new ArraySeq!(Object); - toRemove.capacity(mi.length); + ArrayList toRemove = new ArrayList(mi.length); for (int i = 0; i < mi.length; i++) { Object data = mi[i].getData(); if (data is null || !clean.contains(data) || (cast(IContributionItem) data && (cast(IContributionItem) data) .isDynamic())) { - toRemove.append(mi[i]); + toRemove.add(mi[i]); } } @@ -331,8 +329,9 @@ mi = toolBar.getItems(); int srcIx = 0; int destIx = 0; - foreach( e; clean ){ - src = cast(IContributionItem) e; + for (Iterator e = clean.iterator(); e.hasNext();) { + src = cast(IContributionItem) e.next(); + // get corresponding item in DWT widget if (srcIx < mi.length) {