Mercurial > projects > dwt-addons
diff dwtx/jface/fieldassist/FieldAssistColors.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 | f12d40e7da8f |
children |
line wrap: on
line diff
--- a/dwtx/jface/fieldassist/FieldAssistColors.d Sun Aug 03 17:01:51 2008 +0200 +++ b/dwtx/jface/fieldassist/FieldAssistColors.d Thu Aug 07 15:01:33 2008 +0200 @@ -12,10 +12,6 @@ *******************************************************************************/ module dwtx.jface.fieldassist.FieldAssistColors; -import tango.util.collection.ArraySeq; -import tango.util.collection.HashMap; -import tango.util.collection.model.Map; -import tango.util.collection.model.Seq; import dwt.DWT; import dwt.graphics.Color; @@ -25,6 +21,7 @@ import dwtx.jface.resource.JFaceColors; import dwt.dwthelper.utils; +import dwtx.dwtxhelper.Collection; import dwt.dwthelper.Runnable; import tango.io.Stdout; @@ -53,17 +50,17 @@ * Keys are background colors, values are the color with the alpha value * applied */ - private static Map!(Object,Object) requiredFieldColorMap; + private static Map requiredFieldColorMap; /* * Keys are colors we have created, values are the displays on which they * were created. */ - private static Map!(Object,Object) displays; + private static Map displays; static this(){ - requiredFieldColorMap = new HashMap!(Object,Object); - displays = new HashMap!(Object,Object); + requiredFieldColorMap = new HashMap(); + displays = new HashMap(); } /** @@ -147,10 +144,10 @@ // create the color Color color = new Color(display, destRed, destGreen, destBlue); // record the color in a map using the original color as the key - requiredFieldColorMap.add(dest, color); + requiredFieldColorMap.put(dest, color); // If we have never created a color on this display before, install // a dispose exec on the display. - if (!displays.contains(display)) { + if (!displays.containsKey(display)) { display.disposeExec(new class Runnable { public void run() { disposeColors(display); @@ -158,7 +155,7 @@ }); } // Record the color and its display in a map for later disposal. - displays.add(color, display); + displays.put(color, display); return color; } @@ -166,7 +163,7 @@ * Dispose any colors that were allocated for the given display. */ private static void disposeColors(Display display) { - auto toBeRemoved = new ArraySeq!(Object); + List toBeRemoved = new ArrayList(1); if (DEBUG) { Stdout.formatln("Display map is {}", (cast(Object)displays).toString()); //$NON-NLS-1$ @@ -174,21 +171,22 @@ } // Look for any stored colors that were created on this display - foreach( k, v; displays ){ - Color color = cast(Color) k; + for (Iterator i = displays.keySet().iterator(); i.hasNext();) { + Color color = cast(Color) i.next(); if ((cast(Display) displays.get(color)).opEquals(display)) { // The color is on this display. Mark it for removal. - toBeRemoved.append(color); + toBeRemoved.add(color); // Now look for any references to it in the required field color // map - auto toBeRemovedFromRequiredMap = new ArraySeq!(Object); - foreach( k, v; requiredFieldColorMap ){ - Color bgColor = cast(Color) k; + List toBeRemovedFromRequiredMap = new ArrayList(1); + for (Iterator iter = requiredFieldColorMap.keySet().iterator(); iter + .hasNext();) { + Color bgColor = cast(Color) iter.next(); if ((cast(Color) requiredFieldColorMap.get(bgColor)) .opEquals(color)) { // mark it for removal from the required field color map - toBeRemovedFromRequiredMap.append(bgColor); + toBeRemovedFromRequiredMap.add(bgColor); } } // Remove references in the required field map now that