Mercurial > projects > dwt-addons
diff dwtx/jface/wizard/WizardDialog.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 | 4878bef4a38e |
children | a521c486e142 |
line wrap: on
line diff
--- a/dwtx/jface/wizard/WizardDialog.d Sun Aug 03 17:01:51 2008 +0200 +++ b/dwtx/jface/wizard/WizardDialog.d Thu Aug 07 15:01:33 2008 +0200 @@ -19,9 +19,6 @@ import dwtx.jface.wizard.ProgressMonitorPart; // import java.lang.reflect.InvocationTargetException; -import tango.util.collection.ArraySeq; -import tango.util.collection.HashMap; -import tango.util.collection.model.Map; // import java.util.HashMap; // import java.util.Map; @@ -63,6 +60,7 @@ import dwtx.jface.util.SafeRunnable; import dwt.dwthelper.utils; +import dwtx.dwtxhelper.Collection; import dwt.dwthelper.Runnable; /** @@ -96,10 +94,10 @@ private IWizard wizard; // Wizards to dispose - private ArraySeq!(Object) createdWizards; + private ArrayList createdWizards; // Current nested wizards - private ArraySeq!(Object) nestedWizards; + private ArrayList nestedWizards; // The currently displayed page. private IWizardPage currentPage = null; @@ -294,8 +292,8 @@ * the wizard this dialog is working on */ public this(Shell parentShell, IWizard newWizard) { - createdWizards = new ArraySeq!(Object); - nestedWizards = new ArraySeq!(Object); + createdWizards = new ArrayList(); + nestedWizards = new ArrayList(); pageChangedListeners = new ListenerList(); pageChangingListeners = new ListenerList(); @@ -323,7 +321,7 @@ * @return the saved UI state */ private Object aboutToStart(bool enableCancelButton) { - Map!(Object,Object) savedState = null; + Map savedState = null; if (getShell() !is null) { // Save focus control Control focusControl = getShell().getDisplay().getFocusControl(); @@ -342,7 +340,7 @@ // Deactivate shell savedState = saveUIState(needsProgressMonitor && enableCancelButton); if (focusControl !is null) { - savedState.add(stringcast(FOCUS_CONTROL), focusControl); + savedState.put(stringcast(FOCUS_CONTROL), focusControl); } // Attach the progress monitor part to the cancel button if (needsProgressMonitor) { @@ -893,7 +891,7 @@ * the key * @see #saveEnableStateAndSet */ - private void restoreEnableState(Control w, Map!(Object,Object) h, String key) { + private void restoreEnableState(Control w, Map h, String key) { if (w !is null) { Boolean b = cast(Boolean) h.get(stringcast(key)); if (b !is null) { @@ -911,7 +909,7 @@ * <code>saveUIState</code> * @see #saveUIState */ - private void restoreUIState(Map!(Object,Object) state) { + private void restoreUIState(Map state) { restoreEnableState(backButton, state, "back"); //$NON-NLS-1$ restoreEnableState(nextButton, state, "next"); //$NON-NLS-1$ restoreEnableState(finishButton, state, "finish"); //$NON-NLS-1$ @@ -980,10 +978,10 @@ * <code>false</code> to disable it * @see #restoreEnableState(Control, Map, String) */ - private void saveEnableStateAndSet(Control w, Map!(Object,Object) h, String key, + private void saveEnableStateAndSet(Control w, Map h, String key, bool enabled) { if (w !is null) { - h.add(stringcast(key), w.getEnabled() ? Boolean.TRUE : Boolean.FALSE); + h.put(stringcast(key), w.getEnabled() ? Boolean.TRUE : Boolean.FALSE); w.setEnabled(enabled); } } @@ -1001,8 +999,8 @@ * with <code>restoreUIState</code> * @see #restoreUIState */ - private Map!(Object,Object) saveUIState(bool keepCancelEnabled) { - Map!(Object,Object) savedState = new HashMap!(Object,Object); + private Map saveUIState(bool keepCancelEnabled) { + Map savedState = new HashMap(10); saveEnableStateAndSet(backButton, savedState, "back", false); //$NON-NLS-1$ saveEnableStateAndSet(nextButton, savedState, "next", false); //$NON-NLS-1$ saveEnableStateAndSet(finishButton, savedState, "finish", false); //$NON-NLS-1$ @@ -1010,7 +1008,7 @@ "cancel", keepCancelEnabled); //$NON-NLS-1$ saveEnableStateAndSet(helpButton, savedState, "help", false); //$NON-NLS-1$ if (currentPage !is null) { - savedState.add(stringcast("page"), ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$ + savedState.put(stringcast("page"), ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$ } return savedState; } @@ -1092,9 +1090,9 @@ wizard = newWizard; wizard.setContainer(this); if (!createdWizards.contains(cast(Object)wizard)) { - createdWizards.append(cast(Object)wizard); + createdWizards.add(cast(Object)wizard); // New wizard so just add it to the end of our nested list - nestedWizards.append(cast(Object)wizard); + nestedWizards.add(cast(Object)wizard); if (pageContainer !is null) { // Dialog is already open // Allow the wizard pages to precreate their page controls @@ -1110,10 +1108,10 @@ // the last wizard from the list int size = nestedWizards.size(); if (size >= 2 && nestedWizards.get(size - 2) is cast(Object)wizard) { - nestedWizards.removeAt(size - 1); + nestedWizards.remove(size - 1); } else { // Assume we are going forward to revisit a wizard - nestedWizards.append(cast(Object)wizard); + nestedWizards.add(cast(Object)wizard); } } } @@ -1225,7 +1223,7 @@ progressMonitorPart.setVisible(false); progressMonitorPart.removeFromCancelComponent(cancelButton); } - Map!(Object,Object) state = cast(Map!(Object,Object)) savedState; + Map state = cast(Map) savedState; restoreUIState(state); cancelButton.addSelectionListener(cancelListener); setDisplayCursor(null);