Mercurial > projects > dwt-addons
diff dwtx/jface/action/LegacyActionTools.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 | da5ad8eedf5d |
children |
line wrap: on
line diff
--- a/dwtx/jface/action/LegacyActionTools.d Sun Aug 03 17:01:51 2008 +0200 +++ b/dwtx/jface/action/LegacyActionTools.d Thu Aug 07 15:01:33 2008 +0200 @@ -13,13 +13,12 @@ module dwtx.jface.action.LegacyActionTools; -import tango.util.collection.HashMap; -import tango.util.collection.model.Map; import dwt.DWT; import dwtx.jface.resource.JFaceResources; import dwt.dwthelper.utils; +import dwtx.dwtxhelper.Collection; static import tango.text.Text; alias tango.text.Text.Text!(char) StringBuffer; @@ -42,7 +41,7 @@ * * @see #findKeyCode */ - private static Map!(String,Object) keyCodes = null; + private static Map keyCodes = null; /** * Table of string representations of keys (key type: <code>Integer</code>, @@ -51,7 +50,7 @@ * * @see #findKeyString */ - private static Map!(Object,String) keyStrings = null; + private static Map keyStrings = null; /** * The localized uppercase version of ALT @@ -75,7 +74,7 @@ * * @see #findLocalizedKeyCode */ - private static Map!(String,Object) localizedKeyCodes = null; + private static Map localizedKeyCodes = null; /** * The localized uppercase version of SHIFT @@ -310,7 +309,7 @@ } int i = keyCode & ~(DWT.CTRL | DWT.ALT | DWT.SHIFT | DWT.COMMAND); Integer integer = new Integer(i); - String result = keyStrings.get(integer); + String result = stringcast(keyStrings.get(integer)); if (result !is null) { return result; } @@ -483,178 +482,178 @@ * Initializes the internal key code table. */ private static final void initKeyCodes() { - keyCodes = new HashMap!(String,Object); + keyCodes = new HashMap(); - keyCodes.add("BACKSPACE", new Integer(8)); //$NON-NLS-1$ - keyCodes.add("TAB", new Integer(9)); //$NON-NLS-1$ - keyCodes.add("RETURN", new Integer(13)); //$NON-NLS-1$ - keyCodes.add("ENTER", new Integer(13)); //$NON-NLS-1$ - keyCodes.add("ESCAPE", new Integer(27)); //$NON-NLS-1$ - keyCodes.add("ESC", new Integer(27)); //$NON-NLS-1$ - keyCodes.add("DELETE", new Integer(127)); //$NON-NLS-1$ + keyCodes.put(stringcast("BACKSPACE"), new Integer(8)); //$NON-NLS-1$ + keyCodes.put(stringcast("TAB"), new Integer(9)); //$NON-NLS-1$ + keyCodes.put(stringcast("RETURN"), new Integer(13)); //$NON-NLS-1$ + keyCodes.put(stringcast("ENTER"), new Integer(13)); //$NON-NLS-1$ + keyCodes.put(stringcast("ESCAPE"), new Integer(27)); //$NON-NLS-1$ + keyCodes.put(stringcast("ESC"), new Integer(27)); //$NON-NLS-1$ + keyCodes.put(stringcast("DELETE"), new Integer(127)); //$NON-NLS-1$ - keyCodes.add("SPACE", new Integer(' ')); //$NON-NLS-1$ - keyCodes.add("ARROW_UP", new Integer(DWT.ARROW_UP)); //$NON-NLS-1$ - keyCodes.add("ARROW_DOWN", new Integer(DWT.ARROW_DOWN)); //$NON-NLS-1$ - keyCodes.add("ARROW_LEFT", new Integer(DWT.ARROW_LEFT)); //$NON-NLS-1$ - keyCodes.add("ARROW_RIGHT", new Integer(DWT.ARROW_RIGHT)); //$NON-NLS-1$ - keyCodes.add("PAGE_UP", new Integer(DWT.PAGE_UP)); //$NON-NLS-1$ - keyCodes.add("PAGE_DOWN", new Integer(DWT.PAGE_DOWN)); //$NON-NLS-1$ - keyCodes.add("HOME", new Integer(DWT.HOME)); //$NON-NLS-1$ - keyCodes.add("END", new Integer(DWT.END)); //$NON-NLS-1$ - keyCodes.add("INSERT", new Integer(DWT.INSERT)); //$NON-NLS-1$ - keyCodes.add("F1", new Integer(DWT.F1)); //$NON-NLS-1$ - keyCodes.add("F2", new Integer(DWT.F2)); //$NON-NLS-1$ - keyCodes.add("F3", new Integer(DWT.F3)); //$NON-NLS-1$ - keyCodes.add("F4", new Integer(DWT.F4)); //$NON-NLS-1$ - keyCodes.add("F5", new Integer(DWT.F5)); //$NON-NLS-1$ - keyCodes.add("F6", new Integer(DWT.F6)); //$NON-NLS-1$ - keyCodes.add("F7", new Integer(DWT.F7)); //$NON-NLS-1$ - keyCodes.add("F8", new Integer(DWT.F8)); //$NON-NLS-1$ - keyCodes.add("F9", new Integer(DWT.F9)); //$NON-NLS-1$ - keyCodes.add("F10", new Integer(DWT.F10)); //$NON-NLS-1$ - keyCodes.add("F11", new Integer(DWT.F11)); //$NON-NLS-1$ - keyCodes.add("F12", new Integer(DWT.F12)); //$NON-NLS-1$ + keyCodes.put(stringcast("SPACE"), new Integer(' ')); //$NON-NLS-1$ + keyCodes.put(stringcast("ARROW_UP"), new Integer(DWT.ARROW_UP)); //$NON-NLS-1$ + keyCodes.put(stringcast("ARROW_DOWN"), new Integer(DWT.ARROW_DOWN)); //$NON-NLS-1$ + keyCodes.put(stringcast("ARROW_LEFT"), new Integer(DWT.ARROW_LEFT)); //$NON-NLS-1$ + keyCodes.put(stringcast("ARROW_RIGHT"), new Integer(DWT.ARROW_RIGHT)); //$NON-NLS-1$ + keyCodes.put(stringcast("PAGE_UP"), new Integer(DWT.PAGE_UP)); //$NON-NLS-1$ + keyCodes.put(stringcast("PAGE_DOWN"), new Integer(DWT.PAGE_DOWN)); //$NON-NLS-1$ + keyCodes.put(stringcast("HOME"), new Integer(DWT.HOME)); //$NON-NLS-1$ + keyCodes.put(stringcast("END"), new Integer(DWT.END)); //$NON-NLS-1$ + keyCodes.put(stringcast("INSERT"), new Integer(DWT.INSERT)); //$NON-NLS-1$ + keyCodes.put(stringcast("F1"), new Integer(DWT.F1)); //$NON-NLS-1$ + keyCodes.put(stringcast("F2"), new Integer(DWT.F2)); //$NON-NLS-1$ + keyCodes.put(stringcast("F3"), new Integer(DWT.F3)); //$NON-NLS-1$ + keyCodes.put(stringcast("F4"), new Integer(DWT.F4)); //$NON-NLS-1$ + keyCodes.put(stringcast("F5"), new Integer(DWT.F5)); //$NON-NLS-1$ + keyCodes.put(stringcast("F6"), new Integer(DWT.F6)); //$NON-NLS-1$ + keyCodes.put(stringcast("F7"), new Integer(DWT.F7)); //$NON-NLS-1$ + keyCodes.put(stringcast("F8"), new Integer(DWT.F8)); //$NON-NLS-1$ + keyCodes.put(stringcast("F9"), new Integer(DWT.F9)); //$NON-NLS-1$ + keyCodes.put(stringcast("F10"), new Integer(DWT.F10)); //$NON-NLS-1$ + keyCodes.put(stringcast("F11"), new Integer(DWT.F11)); //$NON-NLS-1$ + keyCodes.put(stringcast("F12"), new Integer(DWT.F12)); //$NON-NLS-1$ } /** * Initializes the internal key string table. */ private static void initKeyStrings() { - keyStrings = new HashMap!(Object,String); + keyStrings = new HashMap(); - keyStrings.add(new Integer(8), JFaceResources.getString("Backspace")); //$NON-NLS-1$ - keyStrings.add(new Integer(9), JFaceResources.getString("Tab")); //$NON-NLS-1$ - keyStrings.add(new Integer(13), JFaceResources.getString("Return")); //$NON-NLS-1$ - keyStrings.add(new Integer(13), JFaceResources.getString("Enter")); //$NON-NLS-1$ - keyStrings.add(new Integer(27), JFaceResources.getString("Escape")); //$NON-NLS-1$ - keyStrings.add(new Integer(27), JFaceResources.getString("Esc")); //$NON-NLS-1$ - keyStrings.add(new Integer(127), JFaceResources.getString("Delete")); //$NON-NLS-1$ + keyStrings.put(new Integer(8), stringcast(JFaceResources.getString("Backspace"))); //$NON-NLS-1$ + keyStrings.put(new Integer(9), stringcast(JFaceResources.getString("Tab"))); //$NON-NLS-1$ + keyStrings.put(new Integer(13), stringcast(JFaceResources.getString("Return"))); //$NON-NLS-1$ + keyStrings.put(new Integer(13), stringcast(JFaceResources.getString("Enter"))); //$NON-NLS-1$ + keyStrings.put(new Integer(27), stringcast(JFaceResources.getString("Escape"))); //$NON-NLS-1$ + keyStrings.put(new Integer(27), stringcast(JFaceResources.getString("Esc"))); //$NON-NLS-1$ + keyStrings.put(new Integer(127), stringcast(JFaceResources.getString("Delete"))); //$NON-NLS-1$ - keyStrings.add(new Integer(' '), JFaceResources.getString("Space")); //$NON-NLS-1$ + keyStrings.put(new Integer(cast(int)' '), stringcast(JFaceResources.getString("Space"))); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.ARROW_UP), JFaceResources - .getString("Arrow_Up")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.ARROW_DOWN), JFaceResources - .getString("Arrow_Down")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.ARROW_LEFT), JFaceResources - .getString("Arrow_Left")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.ARROW_RIGHT), JFaceResources - .getString("Arrow_Right")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.PAGE_UP), JFaceResources - .getString("Page_Up")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.PAGE_DOWN), JFaceResources - .getString("Page_Down")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.HOME), JFaceResources.getString("Home")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.END), JFaceResources.getString("End")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.INSERT), JFaceResources - .getString("Insert")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F1), JFaceResources.getString("F1")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F2), JFaceResources.getString("F2")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F3), JFaceResources.getString("F3")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F4), JFaceResources.getString("F4")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F5), JFaceResources.getString("F5")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F6), JFaceResources.getString("F6")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F7), JFaceResources.getString("F7")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F8), JFaceResources.getString("F8")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F9), JFaceResources.getString("F9")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F10), JFaceResources.getString("F10")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F11), JFaceResources.getString("F11")); //$NON-NLS-1$ - keyStrings.add(new Integer(DWT.F12), JFaceResources.getString("F12")); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.ARROW_UP), stringcast(JFaceResources + .getString("Arrow_Up"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.ARROW_DOWN), stringcast(JFaceResources + .getString("Arrow_Down"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.ARROW_LEFT), stringcast(JFaceResources + .getString("Arrow_Left"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.ARROW_RIGHT), stringcast(JFaceResources + .getString("Arrow_Right"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.PAGE_UP), stringcast(JFaceResources + .getString("Page_Up"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.PAGE_DOWN), stringcast(JFaceResources + .getString("Page_Down"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.HOME), stringcast(JFaceResources.getString("Home"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.END), stringcast(JFaceResources.getString("End"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.INSERT), stringcast(JFaceResources + .getString("Insert"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F1), stringcast(JFaceResources.getString("F1"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F2), stringcast(JFaceResources.getString("F2"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F3), stringcast(JFaceResources.getString("F3"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F4), stringcast(JFaceResources.getString("F4"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F5), stringcast(JFaceResources.getString("F5"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F6), stringcast(JFaceResources.getString("F6"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F7), stringcast(JFaceResources.getString("F7"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F8), stringcast(JFaceResources.getString("F8"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F9), stringcast(JFaceResources.getString("F9"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F10), stringcast(JFaceResources.getString("F10"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F11), stringcast(JFaceResources.getString("F11"))); //$NON-NLS-1$ + keyStrings.put(new Integer(DWT.F12), stringcast(JFaceResources.getString("F12"))); //$NON-NLS-1$ } /** * Initializes the localized internal key code table. */ private static void initLocalizedKeyCodes() { - localizedKeyCodes = new HashMap!(String,Object); + localizedKeyCodes = new HashMap(); - localizedKeyCodes.add(JFaceResources - .getString("Backspace").toUpperCase(), new Integer(8)); //$NON-NLS-1$ - localizedKeyCodes.add( - JFaceResources.getString("Tab").toUpperCase(), new Integer(9)); //$NON-NLS-1$ + localizedKeyCodes.put(stringcast(JFaceResources + .getString("Backspace").toUpperCase()), new Integer(8)); //$NON-NLS-1$ + localizedKeyCodes.put( + stringcast(JFaceResources.getString("Tab").toUpperCase()), new Integer(9)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Return").toUpperCase(), new Integer(13)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Return").toUpperCase()), new Integer(13)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Enter").toUpperCase(), new Integer(13)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Enter").toUpperCase()), new Integer(13)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Escape").toUpperCase(), new Integer(27)); //$NON-NLS-1$ - localizedKeyCodes.add( - JFaceResources.getString("Esc").toUpperCase(), new Integer(27)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Escape").toUpperCase()), new Integer(27)); //$NON-NLS-1$ + localizedKeyCodes.put( + stringcast(JFaceResources.getString("Esc").toUpperCase()), new Integer(27)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Delete").toUpperCase(), new Integer(127)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Delete").toUpperCase()), new Integer(127)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Space").toUpperCase(), new Integer(' ')); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Space").toUpperCase()), new Integer(' ')); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Arrow_Up").toUpperCase(), new Integer(DWT.ARROW_UP)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Arrow_Up").toUpperCase()), new Integer(DWT.ARROW_UP)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Arrow_Down").toUpperCase(), new Integer(DWT.ARROW_DOWN)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Arrow_Down").toUpperCase()), new Integer(DWT.ARROW_DOWN)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Arrow_Left").toUpperCase(), new Integer(DWT.ARROW_LEFT)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Arrow_Left").toUpperCase()), new Integer(DWT.ARROW_LEFT)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Arrow_Right").toUpperCase(), new Integer(DWT.ARROW_RIGHT)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Arrow_Right").toUpperCase()), new Integer(DWT.ARROW_RIGHT)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Page_Up").toUpperCase(), new Integer(DWT.PAGE_UP)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Page_Up").toUpperCase()), new Integer(DWT.PAGE_UP)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Page_Down").toUpperCase(), new Integer(DWT.PAGE_DOWN)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Page_Down").toUpperCase()), new Integer(DWT.PAGE_DOWN)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Home").toUpperCase(), new Integer(DWT.HOME)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Home").toUpperCase()), new Integer(DWT.HOME)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("End").toUpperCase(), new Integer(DWT.END)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("End").toUpperCase()), new Integer(DWT.END)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("Insert").toUpperCase(), new Integer(DWT.INSERT)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("Insert").toUpperCase()), new Integer(DWT.INSERT)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F1").toUpperCase(), new Integer(DWT.F1)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F1").toUpperCase()), new Integer(DWT.F1)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F2").toUpperCase(), new Integer(DWT.F2)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F2").toUpperCase()), new Integer(DWT.F2)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F3").toUpperCase(), new Integer(DWT.F3)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F3").toUpperCase()), new Integer(DWT.F3)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F4").toUpperCase(), new Integer(DWT.F4)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F4").toUpperCase()), new Integer(DWT.F4)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F5").toUpperCase(), new Integer(DWT.F5)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F5").toUpperCase()), new Integer(DWT.F5)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F6").toUpperCase(), new Integer(DWT.F6)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F6").toUpperCase()), new Integer(DWT.F6)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F7").toUpperCase(), new Integer(DWT.F7)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F7").toUpperCase()), new Integer(DWT.F7)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F8").toUpperCase(), new Integer(DWT.F8)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F8").toUpperCase()), new Integer(DWT.F8)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F9").toUpperCase(), new Integer(DWT.F9)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F9").toUpperCase()), new Integer(DWT.F9)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F10").toUpperCase(), new Integer(DWT.F10)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F10").toUpperCase()), new Integer(DWT.F10)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F11").toUpperCase(), new Integer(DWT.F11)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F11").toUpperCase()), new Integer(DWT.F11)); //$NON-NLS-1$ localizedKeyCodes - .add( - JFaceResources.getString("F12").toUpperCase(), new Integer(DWT.F12)); //$NON-NLS-1$ + .put( + stringcast(JFaceResources.getString("F12").toUpperCase()), new Integer(DWT.F12)); //$NON-NLS-1$ } /**