changeset 35:ef4534de0cf9

remaining files
author Frank Benoit <benoit@tionex.de>
date Sat, 05 Apr 2008 04:49:22 +0200
parents b3c8e32d406f
children b9ec89a5809c
files dwtx/jface/fieldassist/DecoratedField.d dwtx/jface/internal/provisional/action/CoolBarManager2.d dwtx/jface/internal/provisional/action/ICoolBarManager2.d dwtx/jface/internal/provisional/action/IToolBarManager2.d dwtx/jface/internal/provisional/action/ToolBarContributionItem2.d dwtx/jface/internal/provisional/action/ToolBarManager2.d dwtx/jface/window/ApplicationWindow.d dwtx/jface/wizard/IWizard.d dwtx/jface/wizard/IWizardContainer.d dwtx/jface/wizard/IWizardContainer2.d dwtx/jface/wizard/IWizardNode.d dwtx/jface/wizard/IWizardPage.d dwtx/jface/wizard/ProgressMonitorPart.d dwtx/jface/wizard/Wizard.d dwtx/jface/wizard/WizardDialog.d dwtx/jface/wizard/WizardPage.d dwtx/jface/wizard/WizardSelectionPage.d
diffstat 17 files changed, 3043 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/dwtx/jface/fieldassist/DecoratedField.d	Sat Apr 05 01:45:47 2008 +0200
+++ b/dwtx/jface/fieldassist/DecoratedField.d	Sat Apr 05 04:49:22 2008 +0200
@@ -74,7 +74,9 @@
     /**
      * Cached platform flags for dealing with platform-specific issues.
      */
-    private static bool CARBON = "carbon".equals(DWT.getPlatform()); //$NON-NLS-1$
+    private static bool CARBON(){
+        return "carbon".equals(DWT.getPlatform()); //$NON-NLS-1$
+    }
 
     /**
      * Constants describing the array indices used to hold the decorations in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/internal/provisional/action/CoolBarManager2.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ ******************************************************************************/
+
+module dwtx.jface.internal.provisional.action.CoolBarManager2;
+
+import dwtx.jface.action.IContributionItem;
+import dwtx.jface.internal.provisional.action.ICoolBarManager2;
+
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.CoolBar;
+import dwtx.jface.action.CoolBarManager;
+
+import dwt.dwthelper.utils;
+
+/**
+ * Extends <code>CoolBarManager</code> to implement <code>ICoolBarManager2</code>
+ *
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is a guarantee neither that this API will
+ * work nor that it will remain the same. Please do not use this API without
+ * consulting with the Platform/UI team.
+ * </p>
+ *
+ * @since 3.2
+*/
+public class CoolBarManager2 : CoolBarManager, ICoolBarManager2 {
+
+    // delegate to super
+    public override void refresh(){
+        super.refresh();
+    }
+    public override void dispose(){
+        super.dispose();
+    }
+    public override void setItems(IContributionItem[] newItems){
+        super.setItems(newItems);
+    }
+    public override void resetItemOrder(){
+        super.resetItemOrder();
+    }
+
+    /**
+     * Creates a new cool bar manager with the default style. Equivalent to
+     * <code>CoolBarManager(DWT.NONE)</code>.
+     */
+    public this() {
+        super();
+    }
+
+    /**
+     * Creates a cool bar manager for an existing cool bar control. This
+     * manager becomes responsible for the control, and will dispose of it when
+     * the manager is disposed.
+     *
+     * @param coolBar
+     *            the cool bar control
+     */
+    public this(CoolBar coolBar) {
+        super(coolBar);
+    }
+
+    /**
+     * Creates a cool bar manager with the given DWT style. Calling <code>createControl</code>
+     * will create the cool bar control.
+     *
+     * @param style
+     *            the cool bar item style; see
+     *            {@link dwt.widgets.CoolBar CoolBar}for for valid
+     *            style bits
+     */
+    public this(int style) {
+       super(style);
+    }
+
+    /**
+     * Creates and returns this manager's cool bar control. Does not create a
+     * new control if one already exists.
+     *
+     * @param parent
+     *            the parent control
+     * @return the cool bar control
+     * @since 3.2
+     */
+    public Control createControl2(Composite parent) {
+        return createControl(parent);
+    }
+
+    /**
+     * Returns the control for this manager.
+     *
+     * @return the control, or <code>null</code> if none
+     * @since 3.2
+     */
+    public Control getControl2() {
+        return getControl();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/internal/provisional/action/ICoolBarManager2.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.internal.provisional.action.ICoolBarManager2;
+
+
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwtx.jface.action.IContributionItem;
+import dwtx.jface.action.ICoolBarManager;
+
+import dwt.dwthelper.utils;
+
+/**
+ * Extends <code>ICoolBarManager</code> to allow clients to be decoupled
+ * from the actual kind of control used.
+ *
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is a guarantee neither that this API will
+ * work nor that it will remain the same. Please do not use this API without
+ * consulting with the Platform/UI team.
+ * </p>
+ *
+ * @since 3.2
+ */
+public interface ICoolBarManager2 : ICoolBarManager {
+
+    /**
+     * Creates and returns this manager's control. Does not create a
+     * new control if one already exists.
+     *
+     *
+     * @param parent
+     *            the parent control
+     * @return the control
+     * @since 3.2
+     */
+    public Control createControl2(Composite parent);
+
+    /**
+     * Returns the bar control for this manager.
+     *
+     * <p>
+     * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+     * part of a work in progress. There is a guarantee neither that this API will
+     * work nor that it will remain the same. Please do not use this API without
+     * consulting with the Platform/UI team.
+     * </p>
+     *
+     * @return the bar control, or <code>null</code> if none
+     * @since 3.2
+     */
+    public Control getControl2();
+
+    /**
+     * Synchronizes the visual order of the cool items in the control with this
+     * manager's internal data structures. This method should be called before
+     * requesting the order of the contribution items to ensure that the order
+     * is accurate.
+     * <p>
+     * Note that <code>update()</code> and <code>refresh()</code> are
+     * converses: <code>update()</code> changes the visual order to match the
+     * internal structures, and <code>refresh</code> changes the internal
+     * structures to match the visual order.
+     * </p>
+     *
+     * <p>
+     * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+     * part of a work in progress. There is a guarantee neither that this API will
+     * work nor that it will remain the same. Please do not use this API without
+     * consulting with the Platform/UI team.
+     * </p>
+     *
+     * @since 3.2
+     */
+    public void refresh();
+
+    /**
+     * Disposes the resources for this manager.
+     *
+     * <p>
+     * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+     * part of a work in progress. There is a guarantee neither that this API will
+     * work nor that it will remain the same. Please do not use this API without
+     * consulting with the Platform/UI team.
+     * </p>
+     *
+     * @since 3.2
+     */
+    public void dispose();
+
+    /**
+     * Restores the canonical order of this cool bar manager. The canonical
+     * order is the order in which the contribution items where added.
+     *
+     * <p>
+     * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+     * part of a work in progress. There is a guarantee neither that this API will
+     * work nor that it will remain the same. Please do not use this API without
+     * consulting with the Platform/UI team.
+     * </p>
+     *
+     * @since 3.2
+     */
+    public void resetItemOrder();
+
+    /**
+     * Replaces the current items with the given items.
+     * Forces an update.
+     *
+     * <p>
+     * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+     * part of a work in progress. There is a guarantee neither that this API will
+     * work nor that it will remain the same. Please do not use this API without
+     * consulting with the Platform/UI team.
+     * </p>
+     *
+     * @param newItems the items with which to replace the current items
+     * @since 3.2
+     */
+    public void setItems(IContributionItem[] newItems);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/internal/provisional/action/IToolBarManager2.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.internal.provisional.action.IToolBarManager2;
+
+
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.ToolBar;
+import dwtx.jface.action.IContributionManagerOverrides;
+import dwtx.jface.action.IToolBarManager;
+import dwtx.jface.util.IPropertyChangeListener;
+
+import dwt.dwthelper.utils;
+
+/**
+ * The <code>IToolBarManager2</code> extends <code>IToolBarManager</code> to
+ * allow clients to be isolated from the actual kind of DWT control used by the
+ * manager.
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is a guarantee neither that this API will
+ * work nor that it will remain the same. Please do not use this API without
+ * consulting with the Platform/UI team.
+ * </p>
+ *
+ * @since 3.2
+ */
+public interface IToolBarManager2 : IToolBarManager {
+
+    /**
+     * The property id for changes to the control's layout
+     */
+    public static final String PROP_LAYOUT = "PROP_LAYOUT"; //$NON-NLS-1$
+
+    /**
+     * Creates and returns this manager's toolbar control. Does not create a new
+     * control if one already exists.
+     *
+     * @param parent
+     *            the parent control
+     * @return the toolbar control
+     */
+    public ToolBar createControl(Composite parent);
+
+    /**
+     * Creates and returns this manager's control. Does not create a new control
+     * if one already exists.
+     *
+     * @param parent
+     *            the parent control
+     * @return the control
+     */
+    public Control createControl2(Composite parent);
+
+    /**
+     * Returns the toolbar control for this manager.
+     *
+     * @return the toolbar control, or <code>null</code> if none
+     */
+    public ToolBar getControl();
+
+    /**
+     * Returns the control for this manager.
+     *
+     * @return the control, or <code>null</code> if none
+     */
+    public Control getControl2();
+
+    /**
+     * Disposes the resources for this manager.
+     */
+    public void dispose();
+
+    /**
+     * Returns the item count of the control used by this manager.
+     *
+     * @return the number of items in the control
+     */
+    public int getItemCount();
+
+    /**
+     * Registers a property change listner with this manager.
+     *
+     * @param listener
+     */
+    public void addPropertyChangeListener(IPropertyChangeListener listener);
+
+    /**
+     * Removes a property change listner from this manager.
+     *
+     * @param listener
+     */
+    public void removePropertyChangeListener(IPropertyChangeListener listener);
+
+    /**
+     * Sets the overrides for this contribution manager
+     *
+     * @param newOverrides
+     *            the overrides for the items of this manager
+     */
+    public void setOverrides(IContributionManagerOverrides newOverrides);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/internal/provisional/action/ToolBarContributionItem2.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ ******************************************************************************/
+
+module dwtx.jface.internal.provisional.action.ToolBarContributionItem2;
+
+import dwtx.jface.internal.provisional.action.IToolBarContributionItem;
+import dwtx.jface.action.IToolBarManager;
+import dwtx.jface.action.IContributionManager;
+
+import dwtx.jface.action.IToolBarManager;
+import dwtx.jface.action.ToolBarContributionItem;
+
+import dwt.dwthelper.utils;
+
+/**
+ * Extends <code>ToolBarContributionItem</code> to implement <code>IToolBarContributionItem</code>.
+ *
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is a guarantee neither that this API will
+ * work nor that it will remain the same. Please do not use this API without
+ * consulting with the Platform/UI team.
+ * </p>
+ *
+ * @since 3.2
+ */
+public class ToolBarContributionItem2 : ToolBarContributionItem,
+        IToolBarContributionItem {
+
+    // delegate to super
+    public override int getCurrentHeight(){
+        return super.getCurrentHeight();
+    }
+    public override int getCurrentWidth(){
+        return super.getCurrentWidth();
+    }
+    public override int getMinimumItemsToShow(){
+        return super.getMinimumItemsToShow();
+    }
+    public override bool getUseChevron(){
+        return super.getUseChevron();
+    }
+    public override void setCurrentHeight(int currentHeight){
+        super.setCurrentHeight(currentHeight);
+    }
+    public override void setCurrentWidth(int currentWidth){
+        super.setCurrentWidth(currentWidth);
+    }
+    public override void setMinimumItemsToShow(int minimumItemsToShow){
+        super.setMinimumItemsToShow(minimumItemsToShow);
+    }
+    public override void setUseChevron(bool value){
+        super.setUseChevron(value);
+    }
+    public override IToolBarManager getToolBarManager(){
+        return super.getToolBarManager();
+    }
+    public override IContributionManager getParent(){
+        return super.getParent();
+    }
+
+
+    /**
+     *
+     */
+    public this() {
+        super();
+    }
+
+    /**
+     * @param toolBarManager
+     */
+    public this(IToolBarManager toolBarManager) {
+        super(toolBarManager);
+    }
+
+    /**
+     * @param toolBarManager
+     * @param id
+     */
+    public this(IToolBarManager toolBarManager, String id) {
+        super(toolBarManager, id);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/internal/provisional/action/ToolBarManager2.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ ******************************************************************************/
+
+module dwtx.jface.internal.provisional.action.ToolBarManager2;
+
+import dwtx.jface.internal.provisional.action.IToolBarManager2;
+import dwtx.jface.action.IContributionManagerOverrides;
+
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.ToolBar;
+import dwtx.core.runtime.ListenerList;
+import dwtx.jface.action.ToolBarManager;
+import dwtx.jface.util.IPropertyChangeListener;
+import dwtx.jface.util.PropertyChangeEvent;
+
+import dwt.dwthelper.utils;
+
+/**
+ * Extends <code>ToolBarManager</code> to implement <code>IToolBarManager2</code>.
+ *
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
+ * part of a work in progress. There is a guarantee neither that this API will
+ * work nor that it will remain the same. Please do not use this API without
+ * consulting with the Platform/UI team.
+ * </p>
+ *
+ * @since 3.2
+ */
+public class ToolBarManager2 : ToolBarManager, IToolBarManager2 {
+
+    // delegate to super
+    public ToolBar createControl(Composite parent) {
+        return super.createControl(parent);
+    }
+    public ToolBar getControl() {
+        return super.getControl();
+    }
+    public void dispose() {
+        super.dispose();
+    }
+    public void setOverrides(IContributionManagerOverrides newOverrides) {
+        super.setOverrides(newOverrides);
+    }
+
+    /**
+     * A collection of objects listening to changes to this manager. This
+     * collection is <code>null</code> if there are no listeners.
+     */
+    private /+transient+/ ListenerList listenerList = null;
+
+    /**
+     * Creates a new tool bar manager with the default DWT button style. Use the
+     * <code>createControl</code> method to create the tool bar control.
+     */
+    public this() {
+        super();
+    }
+
+    /**
+     * Creates a tool bar manager with the given DWT button style. Use the
+     * <code>createControl</code> method to create the tool bar control.
+     *
+     * @param style
+     *            the tool bar item style
+     * @see dwt.widgets.ToolBar for valid style bits
+     */
+    public this(int style) {
+        super(style);
+    }
+
+    /**
+     * Creates a tool bar manager for an existing tool bar control. This manager
+     * becomes responsible for the control, and will dispose of it when the
+     * manager is disposed.
+     *
+     * @param toolbar
+     *            the tool bar control
+     */
+    public this(ToolBar toolbar) {
+        super(toolbar);
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.action.IToolBarManager2#createControl2(dwt.widgets.Composite)
+     */
+    public Control createControl2(Composite parent) {
+        return createControl(parent);
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.action.IToolBarManager2#getControl2()
+     */
+    public Control getControl2() {
+        return getControl();
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.action.IToolBarManager2#getItemCount()
+     */
+    public int getItemCount() {
+        ToolBar toolBar = getControl();
+        if (toolBar is null || toolBar.isDisposed()) {
+            return 0;
+        }
+        return toolBar.getItemCount();
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.action.IToolBarManager2#addPropertyChangeListener(dwtx.jface.util.IPropertyChangeListener)
+     */
+    public void addPropertyChangeListener(IPropertyChangeListener listener) {
+        if (listenerList is null) {
+            listenerList = new ListenerList(ListenerList.IDENTITY);
+        }
+
+        listenerList.add(cast(Object)listener);
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.action.IToolBarManager2#removePropertyChangeListener(dwtx.jface.util.IPropertyChangeListener)
+     */
+    public void removePropertyChangeListener(IPropertyChangeListener listener) {
+        if (listenerList !is null) {
+            listenerList.remove(cast(Object)listener);
+
+            if (listenerList.isEmpty()) {
+                listenerList = null;
+            }
+        }
+    }
+
+    /**
+     * @return the listeners attached to this event manager.
+     * The listeners currently attached; may be empty, but never
+     * null.
+     *
+     */
+    protected final Object[] getListeners() {
+        final ListenerList list = listenerList;
+        if (list is null) {
+            return new Object[0];
+        }
+
+        return list.getListeners();
+    }
+
+    /*
+     * Notifies any property change listeners that a property has changed. Only
+     * listeners registered at the time this method is called are notified.
+     */
+    private void firePropertyChange(PropertyChangeEvent event) {
+        Object[] list = getListeners();
+        for (int i = 0; i < list.length; ++i) {
+            (cast(IPropertyChangeListener) list[i]).propertyChange(event);
+        }
+    }
+
+    /*
+     * Notifies any property change listeners that a property has changed. Only
+     * listeners registered at the time this method is called are notified. This
+     * method avoids creating an event object if there are no listeners
+     * registered, but calls firePropertyChange(PropertyChangeEvent) if there are.
+     */
+    private void firePropertyChange(String propertyName,
+            Object oldValue, Object newValue) {
+        if (listenerList !is null) {
+            firePropertyChange(new PropertyChangeEvent(this, propertyName,
+                    oldValue, newValue));
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.action.ToolBarManager#relayout(dwt.widgets.ToolBar, int, int)
+     */
+    protected void relayout(ToolBar layoutBar, int oldCount, int newCount) {
+        super.relayout(layoutBar, oldCount, newCount);
+        firePropertyChange(PROP_LAYOUT, new Integer(oldCount), new Integer(newCount));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/window/ApplicationWindow.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,872 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     Roman Dawydkin - bug 55116
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+
+module dwtx.jface.window.ApplicationWindow;
+
+import dwtx.jface.window.Window;
+
+// import java.lang.reflect.InvocationTargetException;
+
+import dwt.DWT;
+import dwt.custom.BusyIndicator;
+import dwt.graphics.Font;
+import dwt.graphics.Point;
+import dwt.graphics.Rectangle;
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.CoolBar;
+import dwt.widgets.Decorations;
+import dwt.widgets.Display;
+import dwt.widgets.Label;
+import dwt.widgets.Layout;
+import dwt.widgets.Menu;
+import dwt.widgets.Shell;
+import dwt.widgets.ToolBar;
+import dwtx.core.runtime.NullProgressMonitor;
+import dwtx.jface.action.CoolBarManager;
+import dwtx.jface.action.ICoolBarManager;
+import dwtx.jface.action.IToolBarManager;
+import dwtx.jface.action.MenuManager;
+import dwtx.jface.action.StatusLineManager;
+import dwtx.jface.action.ToolBarManager;
+import dwtx.jface.internal.provisional.action.ICoolBarManager2;
+import dwtx.jface.internal.provisional.action.IToolBarManager2;
+import dwtx.jface.operation.IRunnableContext;
+import dwtx.jface.operation.IRunnableWithProgress;
+import dwtx.jface.operation.ModalContext;
+import dwtx.jface.resource.JFaceResources;
+
+import dwt.dwthelper.utils;
+import dwt.dwthelper.Runnable;
+
+/**
+ * An application window is a high-level "main window", with built-in
+ * support for an optional menu bar with standard menus, an optional toolbar,
+ * and an optional status line.
+ * <p>
+ * Creating an application window involves the following steps:
+ * <ul>
+ *   <li>creating an instance of <code>ApplicationWindow</code>
+ *   </li>
+ *   <li>assigning the window to a window manager (optional)
+ *   </li>
+ *   <li>opening the window by calling <code>open</code>
+ *   </li>
+ * </ul>
+ * Only on the last step, when the window is told to open, are
+ * the window's shell and widget tree created. When the window is
+ * closed, the shell and widget tree are disposed of and are no longer
+ * referenced, and the window is automatically removed from its window
+ * manager. Like all windows, an application window may be reopened.
+ * </p>
+ * <p>
+ * An application window is also a suitable context in which to perform
+ * long-running operations (that is, it implements <code>IRunnableContext</code>).
+ * </p>
+ */
+public class ApplicationWindow : Window, IRunnableContext {
+
+    /**
+     * Menu bar manager, or <code>null</code> if none (default).
+     *
+     * @see #addMenuBar
+     */
+    private MenuManager menuBarManager = null;
+
+    /**
+     * Tool bar manager, or <code>null</code> if none (default).
+     *
+     * @see #addToolBar
+     */
+    private IToolBarManager toolBarManager = null;
+
+    /**
+     * Status line manager, or <code>null</code> if none (default).
+     *
+     * @see #addStatusLine
+     */
+    private StatusLineManager statusLineManager = null;
+
+    /**
+     * Cool bar manager, or <code>null</code> if none (default).
+     *
+     * @see #addCoolBar
+     * @since 3.0
+     */
+    private ICoolBarManager coolBarManager = null;
+
+    /**
+     * The seperator between the menu bar and the rest of the window.
+     */
+    protected Label seperator1;
+
+    /**
+     * A flag indicating that an operation is running.
+     */
+    private bool operationInProgress = false;
+
+    /**
+     * Internal application window layout class.
+     * This vertical layout supports a tool bar area (fixed size),
+     * a separator line, the content area (variable size), and a
+     * status line (fixed size).
+     */
+    /*package*/class ApplicationWindowLayout : Layout {
+
+        static final int VGAP = 2;
+
+        static final int BAR_SIZE = 23;
+
+        protected Point computeSize(Composite composite, int wHint, int hHint,
+                bool flushCache) {
+            if (wHint !is DWT.DEFAULT && hHint !is DWT.DEFAULT) {
+                return new Point(wHint, hHint);
+            }
+
+            Point result = new Point(0, 0);
+            Control[] ws = composite.getChildren();
+            for (int i = 0; i < ws.length; i++) {
+                Control w = ws[i];
+
+                bool hide = false;
+                if (getToolBarControl() is w) {
+                    if (!toolBarChildrenExist()) {
+                        hide = true;
+                        result.y += BAR_SIZE; // REVISIT
+                    }
+                } else if (getCoolBarControl() is w) {
+                    if (!coolBarChildrenExist()) {
+                        hide = true;
+                        result.y += BAR_SIZE;
+                    }
+                } else if (statusLineManager !is null
+                        && statusLineManager.getControl() is w) {
+                } else if (i > 0) { /* we assume this window is contents */
+                    hide = false;
+                }
+
+                if (!hide) {
+                    Point e = w.computeSize(wHint, hHint, flushCache);
+                    result.x = Math.max(result.x, e.x);
+                    result.y += e.y + VGAP;
+                }
+            }
+
+            if (wHint !is DWT.DEFAULT) {
+                result.x = wHint;
+            }
+            if (hHint !is DWT.DEFAULT) {
+                result.y = hHint;
+            }
+            return result;
+        }
+
+        protected void layout(Composite composite, bool flushCache) {
+            Rectangle clientArea = composite.getClientArea();
+
+            Control[] ws = composite.getChildren();
+
+            // Lay out the separator, the tool bar control, the cool bar control, the status line, and the page composite.
+            // The following code assumes that the page composite is the last child, and that there are no unexpected other controls.
+
+            for (int i = 0; i < ws.length; i++) {
+                Control w = ws[i];
+
+                if (w is seperator1) { // Separator
+                    Point e = w.computeSize(DWT.DEFAULT, DWT.DEFAULT,
+                            flushCache);
+                    w.setBounds(clientArea.x, clientArea.y, clientArea.width,
+                            e.y);
+                    clientArea.y += e.y;
+                    clientArea.height -= e.y;
+                } else if (getToolBarControl() is w) {
+                    if (toolBarChildrenExist()) {
+                        Point e = w.computeSize(DWT.DEFAULT, DWT.DEFAULT,
+                                flushCache);
+                        w.setBounds(clientArea.x, clientArea.y,
+                                clientArea.width, e.y);
+                        clientArea.y += e.y + VGAP;
+                        clientArea.height -= e.y + VGAP;
+                    }
+                } else if (getCoolBarControl() is w) {
+                    if (coolBarChildrenExist()) {
+                        Point e = w.computeSize(clientArea.width, DWT.DEFAULT,
+                                flushCache);
+                        w.setBounds(clientArea.x, clientArea.y,
+                                clientArea.width, e.y);
+                        clientArea.y += e.y + VGAP;
+                        clientArea.height -= e.y + VGAP;
+                    }
+                } else if (statusLineManager !is null
+                        && statusLineManager.getControl() is w) {
+                    Point e = w.computeSize(DWT.DEFAULT, DWT.DEFAULT,
+                            flushCache);
+                    w.setBounds(clientArea.x, clientArea.y + clientArea.height
+                            - e.y, clientArea.width, e.y);
+                    clientArea.height -= e.y + VGAP;
+                } else {
+                    w.setBounds(clientArea.x, clientArea.y + VGAP,
+                            clientArea.width, clientArea.height - VGAP);
+                }
+            }
+        }
+    }
+
+    /**
+     * Return the top seperator.
+     * @return Label
+     */
+    protected Label getSeperator1() {
+        return seperator1;
+    }
+
+    /**
+     * Create an application window instance, whose shell will be created under the
+     * given parent shell.
+     * Note that the window will have no visual representation (no widgets)
+     * until it is told to open. By default, <code>open</code> does not block.
+     *
+     * @param parentShell the parent shell, or <code>null</code> to create a top-level shell
+     */
+    public this(Shell parentShell) {
+        super(parentShell);
+    }
+
+    /**
+     * Configures this window to have a menu bar.
+     * Does nothing if it already has one.
+     * This method must be called before this window's shell is created.
+     */
+    protected void addMenuBar() {
+        if ((getShell() is null) && (menuBarManager is null)) {
+            menuBarManager = createMenuManager();
+        }
+    }
+
+    /**
+     * Configures this window to have a status line.
+     * Does nothing if it already has one.
+     * This method must be called before this window's shell is created.
+     */
+    protected void addStatusLine() {
+        if ((getShell() is null) && (statusLineManager is null)) {
+            statusLineManager = createStatusLineManager();
+        }
+    }
+
+    /**
+     * Configures this window to have a tool bar.
+     * Does nothing if it already has one.
+     * This method must be called before this window's shell is created.
+     * @param style swt style bits used to create the Toolbar
+     * @see ToolBarManager#ToolBarManager(int)
+     * @see ToolBar for style bits
+     */
+    protected void addToolBar(int style) {
+        if ((getShell() is null) && (toolBarManager is null)
+                && (coolBarManager is null)) {
+            toolBarManager = createToolBarManager2(style);
+        }
+    }
+
+    /**
+     * Configures this window to have a cool bar.
+     * Does nothing if it already has one.
+     * This method must be called before this window's shell is created.
+     *
+     * @param style the cool bar style
+     * @since 3.0
+     */
+    protected void addCoolBar(int style) {
+        if ((getShell() is null) && (toolBarManager is null)
+                && (coolBarManager is null)) {
+            coolBarManager = createCoolBarManager2(style);
+        }
+    }
+
+    /* (non-Javadoc)
+     * Method declared on Window.
+     */
+    protected bool canHandleShellCloseEvent() {
+        return super.canHandleShellCloseEvent() && !operationInProgress;
+    }
+
+    /* (non-Javadoc)
+     * Method declared on Window.
+     */
+    public bool close() {
+        if (operationInProgress) {
+            return false;
+        }
+
+        if (super.close()) {
+            if (menuBarManager !is null) {
+                menuBarManager.dispose();
+                menuBarManager = null;
+            }
+            if (toolBarManager !is null) {
+                if (cast(IToolBarManager2)toolBarManager ) {
+                    (cast(IToolBarManager2) toolBarManager).dispose();
+                } else if (cast(ToolBarManager)toolBarManager ) {
+                    (cast(ToolBarManager) toolBarManager).dispose();
+                }
+                toolBarManager = null;
+            }
+            if (statusLineManager !is null) {
+                statusLineManager.dispose();
+                statusLineManager = null;
+            }
+            if (coolBarManager !is null) {
+                if (cast(ICoolBarManager2)coolBarManager ) {
+                    (cast(ICoolBarManager2) coolBarManager).dispose();
+                } else if (cast(CoolBarManager)coolBarManager ) {
+                    (cast(CoolBarManager) coolBarManager).dispose();
+                }
+                coolBarManager = null;
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Extends the super implementation by creating the trim widgets using <code>createTrimWidgets</code>.
+     */
+    protected void configureShell(Shell shell) {
+
+        super.configureShell(shell);
+
+        createTrimWidgets(shell);
+    }
+
+    /**
+     * Creates the trim widgets around the content area.
+     *
+     * @param shell the shell
+     * @since 3.0
+     */
+    protected void createTrimWidgets(Shell shell) {
+        if (menuBarManager !is null) {
+            menuBarManager.updateAll(true);
+            shell.setMenuBar(menuBarManager.createMenuBar(cast(Decorations) shell));
+        }
+
+        if (showTopSeperator()) {
+            seperator1 = new Label(shell, DWT.SEPARATOR | DWT.HORIZONTAL);
+        }
+
+        // will create either a cool bar or a tool bar
+        createToolBarControl(shell);
+        createCoolBarControl(shell);
+        createStatusLine(shell);
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.jface.window.Window#getLayout()
+     */
+    protected Layout getLayout() {
+        return new ApplicationWindowLayout();
+    }
+
+    /**
+     * Returns whether to show a top separator line between the menu bar
+     * and the rest of the window contents.  On some platforms such as the Mac,
+     * the menu is separated from the main window already, so a separator line
+     * is not desired.
+     *
+     * @return <code>true</code> to show the top separator, <code>false</code>
+     *   to not show it
+     * @since 3.0
+     */
+    protected bool showTopSeperator() {
+        return !"carbon".equals(DWT.getPlatform()); //$NON-NLS-1$
+    }
+
+    /**
+     * Create the status line if required.
+     * @param shell
+     */
+    protected void createStatusLine(Shell shell) {
+        if (statusLineManager !is null) {
+            statusLineManager.createControl(shell, DWT.NONE);
+        }
+    }
+
+    /**
+     * Returns a new menu manager for the window.
+     * <p>
+     * Subclasses may override this method to customize the menu manager.
+     * </p>
+     * @return a menu manager
+     */
+    protected MenuManager createMenuManager() {
+        return new MenuManager();
+    }
+
+    /**
+     * Returns a new status line manager for the window.
+     * <p>
+     * Subclasses may override this method to customize the status line manager.
+     * </p>
+     * @return a status line manager
+     */
+    protected StatusLineManager createStatusLineManager() {
+        return new StatusLineManager();
+    }
+
+    /**
+     * Returns a new tool bar manager for the window.
+     * <p>
+     * Subclasses may override this method to customize the tool bar manager.
+     * </p>
+     * @param style swt style bits used to create the Toolbar
+     *
+     * @return a tool bar manager
+     * @see ToolBarManager#ToolBarManager(int)
+     * @see ToolBar for style bits
+     */
+    protected ToolBarManager createToolBarManager(int style) {
+        return new ToolBarManager(style);
+    }
+
+    /**
+     * Returns a new tool bar manager for the window.
+     * <p>
+     * By default this method calls <code>createToolBarManager</code>.  Subclasses
+     * may override this method to provide an alternative implementation for the
+     * tool bar manager.
+     * </p>
+     *
+     * @param style swt style bits used to create the Toolbar
+     *
+     * @return a tool bar manager
+     * @since 3.2
+     * @see #createToolBarManager(int)
+     */
+    protected IToolBarManager createToolBarManager2(int style) {
+        return createToolBarManager(style);
+    }
+
+    /**
+     * Returns a new cool bar manager for the window.
+     * <p>
+     * Subclasses may override this method to customize the cool bar manager.
+     * </p>
+     *
+     * @param style swt style bits used to create the Coolbar
+     *
+     * @return a cool bar manager
+     * @since 3.0
+     * @see CoolBarManager#CoolBarManager(int)
+     * @see CoolBar for style bits
+     */
+    protected CoolBarManager createCoolBarManager(int style) {
+        return new CoolBarManager(style);
+    }
+
+    /**
+     * Returns a new cool bar manager for the window.
+     * <p>
+     * By default this method calls <code>createCoolBarManager</code>.  Subclasses
+     * may override this method to provide an alternative implementation for the
+     * cool bar manager.
+     * </p>
+     *
+     * @param style swt style bits used to create the Coolbar
+     *
+     * @return a cool bar manager
+     * @since 3.2
+     * @see #createCoolBarManager(int)
+     */
+    protected ICoolBarManager createCoolBarManager2(int style) {
+        return createCoolBarManager(style);
+    }
+
+    /**
+     * Creates the control for the tool bar manager.
+     * <p>
+     * Subclasses may override this method to customize the tool bar manager.
+     * </p>
+     * @param parent the parent used for the control
+     * @return a Control
+     */
+    protected Control createToolBarControl(Composite parent) {
+        if (toolBarManager !is null) {
+            if (cast(IToolBarManager2)toolBarManager ) {
+                return (cast(IToolBarManager2) toolBarManager).createControl2(parent);
+            }
+            if (cast(ToolBarManager)toolBarManager ) {
+                return (cast(ToolBarManager) toolBarManager).createControl(parent);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Creates the control for the cool bar manager.
+     * <p>
+     * Subclasses may override this method to customize the cool bar manager.
+     * </p>
+     * @param composite the parent used for the control
+     *
+     * @return an instance of <code>CoolBar</code>
+     * @since 3.0
+     */
+    protected Control createCoolBarControl(Composite composite) {
+        if (coolBarManager !is null) {
+            if (cast(ICoolBarManager2)coolBarManager ) {
+                return (cast(ICoolBarManager2) coolBarManager).createControl2(composite);
+            }
+            if (cast(CoolBarManager)coolBarManager ) {
+                return (cast(CoolBarManager) coolBarManager).createControl(composite);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the default font used for this window.
+     * <p>
+     * The default implementation of this framework method
+     * obtains the symbolic name of the font from the
+     * <code>getSymbolicFontName</code> framework method
+     * and retrieves this font from JFace's font
+     * registry using <code>JFaceResources.getFont</code>.
+     * Subclasses may override to use a different registry,
+     * etc.
+     * </p>
+     *
+     * @return the default font, or <code>null</code> if none
+     */
+    protected Font getFont() {
+        return JFaceResources.getFont(getSymbolicFontName());
+    }
+
+    /**
+     * Returns the menu bar manager for this window (if it has one).
+     *
+     * @return the menu bar manager, or <code>null</code> if
+     *   this window does not have a menu bar
+     * @see #addMenuBar()
+     */
+    public MenuManager getMenuBarManager() {
+        return menuBarManager;
+    }
+
+    /**
+     * Returns the status line manager for this window (if it has one).
+     *
+     * @return the status line manager, or <code>null</code> if
+     *   this window does not have a status line
+     * @see #addStatusLine
+     */
+    protected StatusLineManager getStatusLineManager() {
+        return statusLineManager;
+    }
+
+    /**
+     * Returns the symbolic font name of the font to be
+     * used to display text in this window.
+     * This is not recommended and is included for backwards
+     * compatability.
+     * It is recommended to use the default font provided by
+     * DWT (that is, do not set the font).
+     *
+     * @return the symbolic font name
+     */
+    public String getSymbolicFontName() {
+        return JFaceResources.TEXT_FONT;
+    }
+
+    /**
+     * Returns the tool bar manager for this window (if it has one).
+     *
+     * @return the tool bar manager, or <code>null</code> if
+     *   this window does not have a tool bar
+     * @see #addToolBar(int)
+     */
+    public ToolBarManager getToolBarManager() {
+        if (cast(ToolBarManager)toolBarManager ) {
+            return cast(ToolBarManager)toolBarManager;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the tool bar manager for this window (if it has one).
+     *
+     * @return the tool bar manager, or <code>null</code> if
+     *   this window does not have a tool bar
+     * @see #addToolBar(int)
+     * @since 3.2
+     */
+    public IToolBarManager getToolBarManager2() {
+        return toolBarManager;
+    }
+
+    /**
+     * Returns the cool bar manager for this window.
+     *
+     * @return the cool bar manager, or <code>null</code> if
+     *   this window does not have a cool bar
+     * @see #addCoolBar(int)
+     * @since 3.0
+     */
+    public CoolBarManager getCoolBarManager() {
+        if (cast(CoolBarManager)coolBarManager ) {
+            return cast(CoolBarManager)coolBarManager;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the cool bar manager for this window.
+     *
+     * @return the cool bar manager, or <code>null</code> if
+     *   this window does not have a cool bar
+     * @see #addCoolBar(int)
+     * @since 3.2
+     */
+    public ICoolBarManager getCoolBarManager2() {
+        return coolBarManager;
+    }
+
+    /**
+     * Returns the control for the window's toolbar.
+     * <p>
+     * Subclasses may override this method to customize the tool bar manager.
+     * </p>
+     * @return a Control
+     */
+    protected Control getToolBarControl() {
+        if (toolBarManager !is null) {
+            if (cast(IToolBarManager2)toolBarManager ) {
+                return (cast(IToolBarManager2) toolBarManager).getControl2();
+            }
+            if (cast(ToolBarManager)toolBarManager ) {
+                return (cast(ToolBarManager) toolBarManager).getControl();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the control for the window's cool bar.
+     * <p>
+     * Subclasses may override this method to customize the cool bar manager.
+     * </p>
+     *
+     * @return an instance of <code>CoolBar</code>
+     * @since 3.0
+     */
+    protected Control getCoolBarControl() {
+        if (coolBarManager !is null) {
+            if (cast(ICoolBarManager2)coolBarManager ) {
+                return (cast(ICoolBarManager2) coolBarManager).getControl2();
+            }
+            if (cast(CoolBarManager)coolBarManager ) {
+                return (cast(CoolBarManager) coolBarManager).getControl();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * This implementation of IRunnableContext#run(bool, bool,
+     * IRunnableWithProgress) blocks until the runnable has been run,
+     * regardless of the value of <code>fork</code>.
+     * It is recommended that <code>fork</code> is set to
+     * true in most cases. If <code>fork</code> is set to <code>false</code>,
+     * the runnable will run in the UI thread and it is the runnable's
+     * responsibility to call <code>Display.readAndDispatch()</code>
+     * to ensure UI responsiveness.
+     */
+    public void run(bool fork, bool cancelable,
+            IRunnableWithProgress runnable) {
+        try {
+            operationInProgress = true;
+            StatusLineManager mgr = getStatusLineManager();
+            if (mgr is null) {
+                runnable.run(new NullProgressMonitor());
+                return;
+            }
+            bool cancelWasEnabled = mgr.isCancelEnabled();
+
+            Control contents = getContents();
+            Display display = contents.getDisplay();
+            Shell shell = getShell();
+            bool contentsWasEnabled = contents.getEnabled();
+            MenuManager manager = getMenuBarManager();
+            Menu menuBar = null;
+            if (manager !is null) {
+                menuBar = manager.getMenu();
+                manager = null;
+            }
+            bool menuBarWasEnabled = false;
+            if (menuBar !is null) {
+                menuBarWasEnabled = menuBar.getEnabled();
+            }
+
+            Control toolbarControl = getToolBarControl();
+            bool toolbarWasEnabled = false;
+            if (toolbarControl !is null) {
+                toolbarWasEnabled = toolbarControl.getEnabled();
+            }
+
+            Control coolbarControl = getCoolBarControl();
+            bool coolbarWasEnabled = false;
+            if (coolbarControl !is null) {
+                coolbarWasEnabled = coolbarControl.getEnabled();
+            }
+
+            // Disable the rest of the shells on the current display
+            Shell[] shells = display.getShells();
+            bool[] enabled = new bool[shells.length];
+            for (int i = 0; i < shells.length; i++) {
+                Shell current = shells[i];
+                if (current is shell) {
+                    continue;
+                }
+                if (current !is null && !current.isDisposed()) {
+                    enabled[i] = current.getEnabled();
+                    current.setEnabled(false);
+                }
+            }
+
+            Control currentFocus = display.getFocusControl();
+            try {
+                contents.setEnabled(false);
+                if (menuBar !is null) {
+                    menuBar.setEnabled(false);
+                }
+                if (toolbarControl !is null) {
+                    toolbarControl.setEnabled(false);
+                }
+                if (coolbarControl !is null) {
+                    coolbarControl.setEnabled(false);
+                }
+                mgr.setCancelEnabled(cancelable);
+                Exception[1] holder;
+                BusyIndicator.showWhile(display, new class Runnable {
+                    bool fork_;
+                    IRunnableWithProgress runnable_;
+                    StatusLineManager mgr_;
+                    Display display_;
+                    this(){
+                        fork_=fork;
+                        runnable_=runnable;
+                        mgr_=mgr;
+                        display_=display;
+                    }
+                    public void run() {
+                        try {
+                            ModalContext.run(runnable_, fork_, mgr_
+                                    .getProgressMonitor(), display_);
+                        } catch (InvocationTargetException ite) {
+                            holder[0] = ite;
+                        } catch (InterruptedException ie) {
+                            holder[0] = ie;
+                        }
+                    }
+                });
+
+                if (holder[0] !is null) {
+                    if (cast(InvocationTargetException)holder[0] ) {
+                        throw cast(InvocationTargetException) holder[0];
+                    } else if (cast(InterruptedException)holder[0] ) {
+                        throw cast(InterruptedException) holder[0];
+                    }
+                }
+            } finally {
+                operationInProgress = false;
+                // Enable the rest of the shells on the current display
+                for (int i = 0; i < shells.length; i++) {
+                    Shell current = shells[i];
+                    if (current is shell) {
+                        continue;
+                    }
+                    if (current !is null && !current.isDisposed()) {
+                        current.setEnabled(enabled[i]);
+                    }
+                }
+                if (!contents.isDisposed()) {
+                    contents.setEnabled(contentsWasEnabled);
+                }
+                if (menuBar !is null && !menuBar.isDisposed()) {
+                    menuBar.setEnabled(menuBarWasEnabled);
+                }
+                if (toolbarControl !is null && !toolbarControl.isDisposed()) {
+                    toolbarControl.setEnabled(toolbarWasEnabled);
+                }
+                if (coolbarControl !is null && !coolbarControl.isDisposed()) {
+                    coolbarControl.setEnabled(coolbarWasEnabled);
+                }
+                mgr.setCancelEnabled(cancelWasEnabled);
+                if (currentFocus !is null && !currentFocus.isDisposed()) {
+                    // It's necessary to restore focus after reenabling the controls
+                    // because disabling them causes focus to jump elsewhere.
+                    // Use forceFocus rather than setFocus to avoid DWT's
+                    // search for children which can take focus, so focus
+                    // ends up back on the actual control that previously had it.
+                    currentFocus.forceFocus();
+                }
+            }
+        } finally {
+            operationInProgress = false;
+        }
+    }
+
+    /**
+     * Sets or clears the message displayed in this window's status
+     * line (if it has one). This method has no effect if the
+     * window does not have a status line.
+     *
+     * @param message the status message, or <code>null</code> to clear it
+     */
+    public void setStatus(String message) {
+        if (statusLineManager !is null) {
+            statusLineManager.setMessage(message);
+        }
+    }
+
+    /**
+     * Returns whether or not children exist for the Application Window's
+     * toolbar control.
+     * <p>
+     * @return bool true if children exist, false otherwise
+     */
+    protected bool toolBarChildrenExist() {
+        Control toolControl = getToolBarControl();
+        if (cast(ToolBar)toolControl ) {
+            return (cast(ToolBar) toolControl).getItemCount() > 0;
+        }
+        return false;
+    }
+
+    /**
+     * Returns whether or not children exist for this application window's
+     * cool bar control.
+     *
+     * @return bool true if children exist, false otherwise
+     * @since 3.0
+     */
+    protected bool coolBarChildrenExist() {
+        Control coolControl = getCoolBarControl();
+        if (cast(CoolBar)coolControl ) {
+            return (cast(CoolBar) coolControl).getItemCount() > 0;
+        }
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/IWizard.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.IWizard;
+
+import dwtx.jface.wizard.IWizardContainer;
+import dwtx.jface.wizard.IWizardPage;
+
+import dwt.graphics.Image;
+import dwt.graphics.RGB;
+import dwt.widgets.Composite;
+import dwtx.jface.dialogs.IDialogSettings;
+
+import dwt.dwthelper.utils;
+
+/**
+ * Interface for a wizard.  A wizard maintains a list of wizard pages,
+ * stacked on top of each other in card layout fashion.
+ * <p>
+ * The class <code>Wizard</code> provides an abstract implementation
+ * of this interface. However, clients are also free to implement this
+ * interface if <code>Wizard</code> does not suit their needs.
+ * </p>
+ * @see Wizard
+ */
+public interface IWizard {
+    /**
+     * Adds any last-minute pages to this wizard.
+     * <p>
+     * This method is called just before the wizard becomes visible, to give the
+     * wizard the opportunity to add any lazily created pages.
+     * </p>
+     */
+    public void addPages();
+
+    /**
+     * Returns whether this wizard could be finished without further user
+     * interaction.
+     * <p>
+     * The result of this method is typically used by the wizard container to enable
+     * or disable the Finish button.
+     * </p>
+     *
+     * @return <code>true</code> if the wizard could be finished,
+     *   and <code>false</code> otherwise
+     */
+    public bool canFinish();
+
+    /**
+     * Creates this wizard's controls in the given parent control.
+     * <p>
+     * The wizard container calls this method to create the controls
+     * for the wizard's pages before the wizard is opened. This allows
+     * the wizard to size correctly; otherwise a resize may occur when
+     * moving to a new page.
+     * </p>
+     *
+     * @param pageContainer the parent control
+     */
+    public void createPageControls(Composite pageContainer);
+
+    /**
+     * Disposes of this wizard and frees all DWT resources.
+     */
+    public void dispose();
+
+    /**
+     * Returns the container of this wizard.
+     *
+     * @return the wizard container, or <code>null</code> if this
+     *   wizard has yet to be added to a container
+     */
+    public IWizardContainer getContainer();
+
+    /**
+     * Returns the default page image for this wizard.
+     * <p>
+     * This image can be used for pages which do not
+     * supply their own image.
+     * </p>
+     *
+     * @return the default page image
+     */
+    public Image getDefaultPageImage();
+
+    /**
+     * Returns the dialog settings for this wizard.
+     * <p>
+     * The dialog store is used to record state between
+     * wizard invocations (for example, radio button selections,
+     * last directory, etc.).
+     * </p>
+     *
+     * @return the dialog settings, or <code>null</code> if none
+     */
+    public IDialogSettings getDialogSettings();
+
+    /**
+     * Returns the successor of the given page.
+     * <p>
+     * This method is typically called by a wizard page
+     * </p>
+     *
+     * @param page the page
+     * @return the next page, or <code>null</code> if none
+     */
+    public IWizardPage getNextPage(IWizardPage page);
+
+    /**
+     * Returns the wizard page with the given name belonging to this wizard.
+     *
+     * @param pageName the name of the wizard page
+     * @return the wizard page with the given name, or <code>null</code> if none
+     */
+    public IWizardPage getPage(String pageName);
+
+    /**
+     * Returns the number of pages in this wizard.
+     *
+     * @return the number of wizard pages
+     */
+    public int getPageCount();
+
+    /**
+     * Returns all the pages in this wizard.
+     *
+     * @return a list of pages
+     */
+    public IWizardPage[] getPages();
+
+    /**
+     * Returns the predecessor of the given page.
+     * <p>
+     * This method is typically called by a wizard page
+     * </p>
+     *
+     * @param page the page
+     * @return the previous page, or <code>null</code> if none
+     */
+    public IWizardPage getPreviousPage(IWizardPage page);
+
+    /**
+     * Returns the first page to be shown in this wizard.
+     *
+     * @return the first wizard page
+     */
+    public IWizardPage getStartingPage();
+
+    /**
+     * Returns the title bar color for this wizard.
+     *
+     * @return the title bar color
+     */
+    public RGB getTitleBarColor();
+
+    /**
+     * Returns the window title string for this wizard.
+     *
+     * @return the window title string, or <code>null</code> for no title
+     */
+    public String getWindowTitle();
+
+    /**
+     * Returns whether help is available for this wizard.
+     * <p>
+     * The result of this method is typically used by the container to
+     * show or hide the Help button.
+     * </p>
+     *
+     * @return <code>true</code> if help is available,
+     *   and <code>false</code> if this wizard is helpless
+     */
+    public bool isHelpAvailable();
+
+    /**
+     * Returns whether this wizard needs Previous and Next buttons.
+     * <p>
+     * The result of this method is typically used by the container.
+     * </p>
+     *
+     * @return <code>true</code> if Previous and Next buttons are required,
+     *   and <code>false</code> if none are needed
+     */
+    public bool needsPreviousAndNextButtons();
+
+    /**
+     * Returns whether this wizard needs a progress monitor.
+     * <p>
+     * The result of this method is typically used by the container.
+     * </p>
+     *
+     * @return <code>true</code> if a progress monitor is required,
+     *   and <code>false</code> if none is needed
+     */
+    public bool needsProgressMonitor();
+
+    /**
+     * Performs any actions appropriate in response to the user
+     * having pressed the Cancel button, or refuse if canceling
+     * now is not permitted.
+     *
+     * @return <code>true</code> to indicate the cancel request
+     *   was accepted, and <code>false</code> to indicate
+     *   that the cancel request was refused
+     */
+    public bool performCancel();
+
+    /**
+     * Performs any actions appropriate in response to the user
+     * having pressed the Finish button, or refuse if finishing
+     * now is not permitted.
+     *
+     * Normally this method is only called on the container's
+     * current wizard. However if the current wizard is a nested wizard
+     * this method will also be called on all wizards in its parent chain.
+     * Such parents may use this notification to save state etc. However,
+     * the value the parents return from this method is ignored.
+     *
+     * @return <code>true</code> to indicate the finish request
+     *   was accepted, and <code>false</code> to indicate
+     *   that the finish request was refused
+     */
+    public bool performFinish();
+
+    /**
+     * Sets or clears the container of this wizard.
+     *
+     * @param wizardContainer the wizard container, or <code>null</code>
+     */
+    public void setContainer(IWizardContainer wizardContainer);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/IWizardContainer.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.IWizardContainer;
+
+import dwtx.jface.wizard.IWizardPage;
+
+import dwt.widgets.Shell;
+import dwtx.jface.operation.IRunnableContext;
+
+/**
+ * Interface for containers that can host a wizard. It displays
+ * wizard pages, at most one of which is considered
+ * the current page. <code>getCurrentPage</code> returns the
+ * current page; <code>showPage</code> programmatically changes the
+ * the current page. Note that the pages need not all belong
+ * to the same wizard.
+ * <p>
+ * The class <code>WizardDialog</code> provides a fully functional
+ * implementation of this interface which will meet the needs of
+ * most clients. However, clients are also free to implement this
+ * interface if <code>WizardDialog</code> does not suit their needs.
+ * </p>
+ * <p>
+ * Implementors are responsible for disposing of their wizards.
+ * </p>
+ *
+ * @see dwtx.jface.wizard.IWizardContainer2
+ */
+public interface IWizardContainer : IRunnableContext {
+    /**
+     * Returns the current wizard page for this container.
+     *
+     * @return the current wizard page, or <code>null</code> if the container
+     *   is not yet showing the wizard
+     * @see #showPage
+     */
+    public IWizardPage getCurrentPage();
+
+    /**
+     * Returns the shell for this wizard container.
+     *
+     * @return the shell, or <code>null</code> if this wizard
+     *   container does not have a shell
+     */
+    public Shell getShell();
+
+    /**
+     * Makes the given page visible.
+     * <p>
+     * This method should not be use for normal page
+     * sequencing (back, next) which is handled by the
+     * container itself. It may, however, be used to
+     * move to another page in response to some custom
+     * action such as double clicking in a list.
+     * </p>
+     *
+     * @param page the page to show
+     * @see #getCurrentPage
+     */
+    public void showPage(IWizardPage page);
+
+    /**
+     * Adjusts the enable state of the Back, Next, and Finish
+     * buttons to reflect the state of the currently active
+     * page in this container.
+     * <p>
+     * This method is called by the container itself
+     * when its wizard page changes and may be called
+     * by the page at other times to force a button state
+     * update.
+     * </p>
+     */
+    public void updateButtons();
+
+    /**
+     * Updates the message (or error message) shown in the message line to
+     * reflect the state of the currently active page in this container.
+     * <p>
+     * This method is called by the container itself
+     * when its wizard page changes and may be called
+     * by the page at other times to force a message
+     * update.
+     * </p>
+     */
+    public void updateMessage();
+
+    /**
+     * Updates the title bar (title, description, and image) to
+     * reflect the state of the currently active page in this container.
+     * <p>
+     * This method is called by the container itself
+     * when its wizard page changes and may be called
+     * by the page at other times to force a title bar
+     * update.
+     * </p>
+     */
+    public void updateTitleBar();
+
+    /**
+     * Updates the window title to reflect the state of the current wizard.
+     * <p>
+     * This method is called by the container itself
+     * when its wizard changes and may be called
+     * by the wizard at other times to force a window
+     * title change.
+     * </p>
+     */
+    public void updateWindowTitle();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/IWizardContainer2.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+
+module dwtx.jface.wizard.IWizardContainer2;
+
+import dwtx.jface.wizard.IWizardContainer;
+
+/**
+ * <p><code>IWizardContainer2</code> is a supplement to
+ * <code>IWizardContainer</code> that adds a method for updating the size of
+ * the wizard shell based on the contents of the current page.</p>
+ *
+ * <p>The class <code>WizardDialog</code> provides a fully functional
+ * implementation of this interface which will meet the needs of
+ * most clients. However, clients are also free to implement this
+ * interface if <code>WizardDialog</code> does not suit their needs.
+ * </p>
+ *
+ * @see dwtx.jface.wizard.IWizardContainer
+ * @since 3.0
+ */
+public interface IWizardContainer2 : IWizardContainer {
+
+    /**
+     * Updates the window size to reflect the state of the current wizard.
+     * <p>
+     * This method is called by the container itself
+     * when its wizard changes and may be called
+     * by the wizard at other times to force a window
+     * size change.
+     * </p>
+     */
+    public void updateSize();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/IWizardNode.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.IWizardNode;
+
+import dwtx.jface.wizard.IWizard;
+
+import dwt.graphics.Point;
+
+import dwt.dwthelper.utils;
+
+/**
+ * A wizard node acts a placeholder for a real wizard in a wizard
+ * selection page. It is done in such a way that the actual creation
+ * of a wizard can be deferred until the wizard is really needed.
+ * <p>
+ * When a wizard node comes into existence, its wizard may or may
+ * not have been created yet; <code>isContentCreated</code> can
+ * be used to determine which. A node may be asked for its wizard
+ * using <code>getWizard</code>, which will force it to be created
+ * if required. Once the client is done with a wizard node, its
+ * <code>dispose</code>method must be called to free up the wizard;
+ * once disposes, the node should no longer be used.
+ * </p>
+ * <p>
+ * This interface should be implemented by clients wishing to
+ * support this kind of wizard placeholder in a wizard selection page.
+ * </p>
+ *
+ * @see WizardSelectionPage
+ */
+public interface IWizardNode {
+    /**
+     * Disposes the wizard managed by this node. Does nothing
+     * if the wizard has not been created.
+     * <p>
+     * This is the last message that should ever be sent to this node.
+     * </p>
+     */
+    public void dispose();
+
+    /**
+     * Returns the extent of the wizard for this node.
+     * <p>
+     * If the content has not yet been created, calling this method
+     * does not trigger the creation of the wizard. This allows
+     * this node to suggest an extent in advance of actually creating
+     * the wizard.
+     * </p>
+     *
+     * @return the extent, or <code>(-1, -1)</code> extent is not known
+     */
+    public Point getExtent();
+
+    /**
+     * Returns the wizard this node stands for.
+     * <p>
+     * If the content has not been created beforehand, calling this
+     * method triggers the creation of the wizard and caches it so that
+     * the identical wizard object is returned on subsequent calls.
+     * </p>
+     *
+     * @return the wizard
+     */
+    public IWizard getWizard();
+
+    /**
+     * Returns whether a wizard has been created for this node.
+     *
+     * @return <code>true</code> if a wizard has been created,
+     *   and <code>false</code> otherwise
+     */
+    public bool isContentCreated();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/IWizardPage.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.IWizardPage;
+
+import dwtx.jface.wizard.IWizard;
+
+import dwtx.jface.dialogs.IDialogPage;
+
+import dwt.dwthelper.utils;
+
+/**
+ * Interface for a wizard page.
+ * <p>
+ * The class <code>WizardPage</code> provides an abstract implementation
+ * of this interface. However, clients are also free to implement this
+ * interface if <code>WizardPage</code> does not suit their needs.
+ * </p>
+ */
+public interface IWizardPage : IDialogPage {
+    /**
+     * Returns whether the next page could be displayed.
+     *
+     * @return <code>true</code> if the next page could be displayed,
+     *   and <code>false</code> otherwise
+     */
+    public bool canFlipToNextPage();
+
+    /**
+     * Returns this page's name.
+     *
+     * @return the name of this page
+     */
+    public String getName();
+
+    /**
+     * Returns the wizard page that would to be shown if the user was to
+     * press the Next button.
+     *
+     * @return the next wizard page, or <code>null</code> if none
+     */
+    public IWizardPage getNextPage();
+
+    /**
+     * Returns the wizard page that would to be shown if the user was to
+     * press the Back button.
+     *
+     * @return the previous wizard page, or <code>null</code> if none
+     */
+    public IWizardPage getPreviousPage();
+
+    /**
+     * Returns the wizard that hosts this wizard page.
+     *
+     * @return the wizard, or <code>null</code> if this page has not been
+     *   added to any wizard
+     * @see #setWizard
+     */
+    public IWizard getWizard();
+
+    /**
+     * Returns whether this page is complete or not.
+     * <p>
+     * This information is typically used by the wizard to decide
+     * when it is okay to finish.
+     * </p>
+     *
+     * @return <code>true</code> if this page is complete, and
+     *  <code>false</code> otherwise
+     */
+    public bool isPageComplete();
+
+    /**
+     * Sets the wizard page that would typically be shown
+     * if the user was to press the Back button.
+     * <p>
+     * This method is called by the container.
+     * </p>
+     *
+     * @param page the previous wizard page
+     */
+    public void setPreviousPage(IWizardPage page);
+
+    /**
+     * Sets the wizard that hosts this wizard page.
+     * Once established, a page's wizard cannot be changed
+     * to a different wizard.
+     *
+     * @param newWizard the wizard
+     * @see #getWizard
+     */
+    public void setWizard(IWizard newWizard);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/ProgressMonitorPart.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,317 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.ProgressMonitorPart;
+
+
+import dwt.DWT;
+import dwt.graphics.Font;
+import dwt.graphics.FontMetrics;
+import dwt.graphics.GC;
+import dwt.layout.GridData;
+import dwt.layout.GridLayout;
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.Event;
+import dwt.widgets.Label;
+import dwt.widgets.Layout;
+import dwt.widgets.Listener;
+import dwtx.core.runtime.Assert;
+import dwtx.core.runtime.IProgressMonitor;
+import dwtx.core.runtime.IProgressMonitorWithBlocking;
+import dwtx.core.runtime.IStatus;
+import dwtx.jface.dialogs.ProgressIndicator;
+import dwtx.jface.resource.JFaceResources;
+
+import dwt.dwthelper.utils;
+
+/**
+ * A standard implementation of an IProgressMonitor. It consists
+ * of a label displaying the task and subtask name, and a
+ * progress indicator to show progress. In contrast to
+ * <code>ProgressMonitorDialog</code> this class only implements
+ * <code>IProgressMonitor</code>.
+ */
+public class ProgressMonitorPart : Composite,
+        IProgressMonitorWithBlocking {
+
+    /** the label */
+    protected Label fLabel;
+
+    /** the current task name */
+    protected String fTaskName;
+
+    /** the current sub task name */
+    protected String fSubTaskName;
+
+    /** the progress indicator */
+    protected ProgressIndicator fProgressIndicator;
+
+    /** the cancel component */
+    protected Control fCancelComponent;
+
+    /** true if cancled */
+    protected bool fIsCanceled;
+
+    /** current blocked status */
+    protected IStatus blockedStatus;
+
+    /** the cancle lister attached to the cancle component */
+    protected Listener fCancelListener;
+    private void init_fCancelListener(){
+        fCancelListener = new class Listener {
+            public void handleEvent(Event e) {
+                setCanceled(true);
+                if (fCancelComponent !is null) {
+                    fCancelComponent.setEnabled(false);
+                }
+            }
+        };
+    }
+    /**
+     * Creates a ProgressMonitorPart.
+     * @param parent The DWT parent of the part.
+     * @param layout The DWT grid bag layout used by the part. A client
+     * can supply the layout to control how the progress monitor part
+     * is layed out. If null is passed the part uses its default layout.
+     */
+    public this(Composite parent, Layout layout) {
+        this(parent, layout, DWT.DEFAULT);
+    }
+
+    /**
+     * Creates a ProgressMonitorPart.
+     * @param parent The DWT parent of the part.
+     * @param layout The DWT grid bag layout used by the part. A client
+     * can supply the layout to control how the progress monitor part
+     * is layed out. If null is passed the part uses its default layout.
+     * @param progressIndicatorHeight The height of the progress indicator in pixel.
+     */
+    public this(Composite parent, Layout layout,
+            int progressIndicatorHeight) {
+        init_fCancelListener();
+        super(parent, DWT.NONE);
+        initialize(layout, progressIndicatorHeight);
+    }
+
+    /**
+     * Attaches the progress monitor part to the given cancel
+     * component.
+     * @param cancelComponent the control whose selection will
+     * trigger a cancel
+     */
+    public void attachToCancelComponent(Control cancelComponent) {
+        Assert.isNotNull(cancelComponent);
+        fCancelComponent = cancelComponent;
+        fCancelComponent.addListener(DWT.Selection, fCancelListener);
+    }
+
+    /**
+     * Implements <code>IProgressMonitor.beginTask</code>.
+     * @see IProgressMonitor#beginTask(java.lang.String, int)
+     */
+    public void beginTask(String name, int totalWork) {
+        fTaskName = name;
+        updateLabel();
+        if (totalWork is IProgressMonitor.UNKNOWN || totalWork is 0) {
+            fProgressIndicator.beginAnimatedTask();
+        } else {
+            fProgressIndicator.beginTask(totalWork);
+        }
+    }
+
+    /**
+     * Implements <code>IProgressMonitor.done</code>.
+     * @see IProgressMonitor#done()
+     */
+    public void done() {
+        fLabel.setText("");//$NON-NLS-1$
+        fProgressIndicator.sendRemainingWork();
+        fProgressIndicator.done();
+    }
+
+    /**
+     * Escapes any occurrence of '&' in the given String so that
+     * it is not considered as a mnemonic
+     * character in DWT ToolItems, MenuItems, Button and Labels.
+     * @param in the original String
+     * @return The converted String
+     */
+    protected static String escapeMetaCharacters(String in_) {
+        if (in_ is null || in_.indexOf('&') < 0) {
+            return in_;
+        }
+        int length = in_.length;
+        StringBuffer out_ = new StringBuffer(length + 1);
+        for (int i = 0; i < length; i++) {
+            char c = in_.charAt(i);
+            if (c is '&') {
+                out_.append("&&");//$NON-NLS-1$
+            } else {
+                out_.append(c);
+            }
+        }
+        return out_.toString();
+    }
+
+    /**
+     * Creates the progress monitor's UI parts and layouts them
+     * according to the given layout. If the layou is <code>null</code>
+     * the part's default layout is used.
+     * @param layout The layoutfor the receiver.
+     * @param progressIndicatorHeight The suggested height of the indicator
+     */
+    protected void initialize(Layout layout, int progressIndicatorHeight) {
+        if (layout is null) {
+            GridLayout l = new GridLayout();
+            l.marginWidth = 0;
+            l.marginHeight = 0;
+            l.numColumns = 1;
+            layout = l;
+        }
+        setLayout(layout);
+
+        fLabel = new Label(this, DWT.LEFT);
+        fLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        if (progressIndicatorHeight is DWT.DEFAULT) {
+            GC gc = new GC(fLabel);
+            FontMetrics fm = gc.getFontMetrics();
+            gc.dispose();
+            progressIndicatorHeight = fm.getHeight();
+        }
+
+        fProgressIndicator = new ProgressIndicator(this);
+        GridData gd = new GridData();
+        gd.horizontalAlignment = GridData.FILL;
+        gd.grabExcessHorizontalSpace = true;
+        gd.verticalAlignment = GridData.CENTER;
+        gd.heightHint = progressIndicatorHeight;
+        fProgressIndicator.setLayoutData(gd);
+    }
+
+    /**
+     * Implements <code>IProgressMonitor.internalWorked</code>.
+     * @see IProgressMonitor#internalWorked(double)
+     */
+    public void internalWorked(double work) {
+        fProgressIndicator.worked(work);
+    }
+
+    /**
+     * Implements <code>IProgressMonitor.isCanceled</code>.
+     * @see IProgressMonitor#isCanceled()
+     */
+    public bool isCanceled() {
+        return fIsCanceled;
+    }
+
+    /**
+     * Detach the progress monitor part from the given cancel
+     * component
+     * @param cc
+     */
+    public void removeFromCancelComponent(Control cc) {
+        Assert.isTrue(fCancelComponent is cc && fCancelComponent !is null);
+        fCancelComponent.removeListener(DWT.Selection, fCancelListener);
+        fCancelComponent = null;
+    }
+
+    /**
+     * Implements <code>IProgressMonitor.setCanceled</code>.
+     * @see IProgressMonitor#setCanceled(bool)
+     */
+    public void setCanceled(bool b) {
+        fIsCanceled = b;
+    }
+
+    /**
+     * Sets the progress monitor part's font.
+     */
+    public void setFont(Font font) {
+        super.setFont(font);
+        fLabel.setFont(font);
+        fProgressIndicator.setFont(font);
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see dwtx.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
+     */
+    public void setTaskName(String name) {
+        fTaskName = name;
+        updateLabel();
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see dwtx.core.runtime.IProgressMonitor#subTask(java.lang.String)
+     */
+    public void subTask(String name) {
+        fSubTaskName = name;
+        updateLabel();
+    }
+
+    /**
+     * Updates the label with the current task and subtask names.
+     */
+    protected void updateLabel() {
+        if (blockedStatus is null) {
+            String text = taskLabel();
+            fLabel.setText(text);
+        } else {
+            fLabel.setText(blockedStatus.getMessage());
+        }
+
+        //Force an update as we are in the UI Thread
+        fLabel.update();
+    }
+
+    /**
+     * Return the label for showing tasks
+     * @return String
+     */
+    private String taskLabel() {
+        String text = fSubTaskName is null ? "" : fSubTaskName; //$NON-NLS-1$
+        if (fTaskName !is null && fTaskName.length > 0) {
+            text = JFaceResources.format(
+                    "Set_SubTask", [ fTaskName, text ]);//$NON-NLS-1$
+        }
+        return escapeMetaCharacters(text);
+    }
+
+    /**
+     * Implements <code>IProgressMonitor.worked</code>.
+     * @see IProgressMonitor#worked(int)
+     */
+    public void worked(int work) {
+        internalWorked(work);
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.core.runtime.IProgressMonitorWithBlocking#clearBlocked()
+     */
+    public void clearBlocked() {
+        blockedStatus = null;
+        updateLabel();
+
+    }
+
+    /* (non-Javadoc)
+     * @see dwtx.core.runtime.IProgressMonitorWithBlocking#setBlocked(dwtx.core.runtime.IStatus)
+     */
+    public void setBlocked(IStatus reason) {
+        blockedStatus = reason;
+        updateLabel();
+
+    }
+}
--- a/dwtx/jface/wizard/Wizard.d	Sat Apr 05 01:45:47 2008 +0200
+++ b/dwtx/jface/wizard/Wizard.d	Sat Apr 05 04:49:22 2008 +0200
@@ -12,14 +12,11 @@
  *******************************************************************************/
 module dwtx.jface.wizard.Wizard;
 
-import dwt.dwthelper.utils;
-pragma( msg, "FIXME dwtx.jface.wizard.Wizard");
-class Wizard {
-    public static final String DEFAULT_IMAGE = "dwtx.jface.wizard.Wizard.pageImage";//$NON-NLS-1$
-}
-/++
-import java.util.ArrayList;
-import java.util.List;
+import dwtx.jface.wizard.IWizard;
+import dwtx.jface.wizard.IWizardPage;
+import dwtx.jface.wizard.IWizardContainer;
+
+import tango.util.collection.ArraySeq;
 
 import dwt.graphics.Image;
 import dwt.graphics.RGB;
@@ -30,6 +27,8 @@
 import dwtx.jface.resource.ImageDescriptor;
 import dwtx.jface.resource.JFaceResources;
 
+import dwt.dwthelper.utils;
+
 /**
  * An abstract base implementation of a wizard. A typical client subclasses
  * <code>Wizard</code> to implement a particular wizard.
@@ -62,7 +61,7 @@
  * <code>IWizardPage</code>.
  * </p>
  */
-public abstract class Wizard implements IWizard {
+public abstract class Wizard : IWizard {
     /**
      * Image registry key of the default image for wizard pages (value
      * <code>"dwtx.jface.wizard.Wizard.pageImage"</code>).
@@ -77,12 +76,12 @@
     /**
      * This wizard's list of pages (element type: <code>IWizardPage</code>).
      */
-    private List pages = new ArrayList();
+    private ArraySeq!(Object) pages;
 
     /**
      * Indicates whether this wizard needs a progress monitor.
      */
-    private bool needsProgressMonitor = false;
+    private bool needsProgressMonitor_ = false;
 
     /**
      * Indicates whether this wizard needs previous and next buttons even if the
@@ -93,7 +92,7 @@
     /**
      * Indicates whether this wizard supports help.
      */
-    private bool isHelpAvailable = false;
+    private bool isHelpAvailable_ = false;
 
     /**
      * The default page image for pages without one of their one;
@@ -105,7 +104,7 @@
      * The default page image descriptor, used for creating a default page image
      * if required; <code>null</code> if none.
      */
-    private ImageDescriptor defaultImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE);
+    private ImageDescriptor defaultImageDescriptor;
 
     /**
      * The color of the wizard title bar; <code>null</code> if none.
@@ -125,8 +124,10 @@
     /**
      * Creates a new empty wizard.
      */
-    protected Wizard() {
-        super();
+    protected this() {
+        //super();
+        pages = new ArraySeq!(Object);
+        defaultImageDescriptor = JFaceResources.getImageRegistry().getDescriptor(DEFAULT_IMAGE);
     }
 
     /**
@@ -137,7 +138,7 @@
      *            the new page
      */
     public void addPage(IWizardPage page) {
-        pages.add(page);
+        pages.append(cast(Object)page);
         page.setWizard(this);
     }
 
@@ -156,7 +157,7 @@
     public bool canFinish() {
         // Default implementation is to check if all pages are complete.
         for (int i = 0; i < pages.size(); i++) {
-            if (!((IWizardPage) pages.get(i)).isPageComplete()) {
+            if (!(cast(IWizardPage) pages.get(i)).isPageComplete()) {
                 return false;
             }
         }
@@ -174,7 +175,7 @@
     public void createPageControls(Composite pageContainer) {
         // the default behavior is to create all the pages controls
         for (int i = 0; i < pages.size(); i++) {
-            IWizardPage page = (IWizardPage) pages.get(i);
+            IWizardPage page = cast(IWizardPage) pages.get(i);
             page.createControl(pageContainer);
             // page is responsible for ensuring the created control is
             // accessable
@@ -193,7 +194,7 @@
     public void dispose() {
         // notify pages
         for (int i = 0; i < pages.size(); i++) {
-            ((IWizardPage) pages.get(i)).dispose();
+            (cast(IWizardPage) pages.get(i)).dispose();
         }
         // dispose of image
         if (defaultImage !is null) {
@@ -231,12 +232,12 @@
      * return the page that was added to this wizard after the given page.
      */
     public IWizardPage getNextPage(IWizardPage page) {
-        int index = pages.indexOf(page);
+        int index = seqIndexOf(pages,cast(Object)page );
         if (index is pages.size() - 1 || index is -1) {
             // last page or page not found
             return null;
         }
-        return (IWizardPage) pages.get(index + 1);
+        return cast(IWizardPage) pages.get(index + 1);
     }
 
     /*
@@ -244,7 +245,7 @@
      */
     public IWizardPage getPage(String name) {
         for (int i = 0; i < pages.size(); i++) {
-            IWizardPage page = (IWizardPage) pages.get(i);
+            IWizardPage page = cast(IWizardPage) pages.get(i);
             String pageName = page.getName();
             if (pageName.equals(name)) {
                 return page;
@@ -264,7 +265,7 @@
      * (non-Javadoc) Method declared on IWizard.
      */
     public IWizardPage[] getPages() {
-        return (IWizardPage[]) pages.toArray(new IWizardPage[pages.size()]);
+        return arraycast!(IWizardPage)( pages.toArray());
     }
 
     /*
@@ -272,12 +273,12 @@
      * return the page that was added to this wizard before the given page.
      */
     public IWizardPage getPreviousPage(IWizardPage page) {
-        int index = pages.indexOf(page);
+        int index = seqIndexOf(pages,cast(Object)page);
         if (index is 0 || index is -1) {
             // first page or page not found
             return null;
         }
-        return (IWizardPage) pages.get(index - 1);
+        return cast(IWizardPage) pages.get(index - 1);
     }
 
     /**
@@ -301,7 +302,7 @@
         if (pages.size() is 0) {
             return null;
         }
-        return (IWizardPage) pages.get(0);
+        return cast(IWizardPage) pages.get(0);
     }
 
     /*
@@ -322,7 +323,7 @@
      * (non-Javadoc) Method declared on IWizard.
      */
     public bool isHelpAvailable() {
-        return isHelpAvailable;
+        return isHelpAvailable_;
     }
 
     /*
@@ -336,7 +337,7 @@
      * (non-Javadoc) Method declared on IWizard.
      */
     public bool needsProgressMonitor() {
-        return needsProgressMonitor;
+        return needsProgressMonitor_;
     }
 
     /**
@@ -422,7 +423,7 @@
      * @see #isHelpAvailable()
      */
     public void setHelpAvailable(bool b) {
-        isHelpAvailable = b;
+        isHelpAvailable_ = b;
     }
 
     /**
@@ -434,7 +435,7 @@
      * @see #needsProgressMonitor()
      */
     public void setNeedsProgressMonitor(bool b) {
-        needsProgressMonitor = b;
+        needsProgressMonitor_ = b;
     }
 
     /**
@@ -461,4 +462,3 @@
         }
     }
 }
-++/
\ No newline at end of file
--- a/dwtx/jface/wizard/WizardDialog.d	Sat Apr 05 01:45:47 2008 +0200
+++ b/dwtx/jface/wizard/WizardDialog.d	Sat Apr 05 04:49:22 2008 +0200
@@ -12,16 +12,18 @@
  *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
 module dwtx.jface.wizard.WizardDialog;
-pragma( msg, "FIXME dwtx.jface.wizard.WizardDialog");
-class WizardDialog {
-}
 
+import dwtx.jface.wizard.IWizardContainer2;
+import dwtx.jface.wizard.IWizard;
+import dwtx.jface.wizard.IWizardPage;
+import dwtx.jface.wizard.ProgressMonitorPart;
 
-/++
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
+// 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;
 
 import dwt.DWT;
 import dwt.custom.BusyIndicator;
@@ -60,6 +62,9 @@
 import dwtx.jface.resource.JFaceResources;
 import dwtx.jface.util.SafeRunnable;
 
+import dwt.dwthelper.utils;
+import dwt.dwthelper.Runnable;
+
 /**
  * A dialog to show a wizard to the end user.
  * <p>
@@ -79,22 +84,22 @@
  * required.
  * </p>
  */
-public class WizardDialog extends TitleAreaDialog implements IWizardContainer2,
+public class WizardDialog : TitleAreaDialog, IWizardContainer2,
         IPageChangeProvider {
     /**
      * Image registry key for error message image (value
      * <code>"dialog_title_error_image"</code>).
      */
-    public static final String WIZ_IMG_ERROR = "dialog_title_error_image"; //$NON-NLS-1$
+    public static const String WIZ_IMG_ERROR = "dialog_title_error_image"; //$NON-NLS-1$
 
     // The wizard the dialog is currently showing.
     private IWizard wizard;
 
     // Wizards to dispose
-    private ArrayList createdWizards = new ArrayList();
+    private ArraySeq!(Object) createdWizards;
 
     // Current nested wizards
-    private ArrayList nestedWizards = new ArrayList();
+    private ArraySeq!(Object) nestedWizards;
 
     // The currently displayed page.
     private IWizardPage currentPage = null;
@@ -135,20 +140,19 @@
 
     private Composite pageContainer;
 
-    private PageContainerFillLayout pageContainerLayout = new PageContainerFillLayout(
-            5, 5, 300, 225);
+    private PageContainerFillLayout pageContainerLayout;
 
     private int pageWidth = DWT.DEFAULT;
 
     private int pageHeight = DWT.DEFAULT;
 
-    private static final String FOCUS_CONTROL = "focusControl"; //$NON-NLS-1$
+    private static const String FOCUS_CONTROL = "focusControl"; //$NON-NLS-1$
 
     private bool lockedUI = false;
 
-    private ListenerList pageChangedListeners = new ListenerList();
+    private ListenerList pageChangedListeners;
 
-    private ListenerList pageChangingListeners = new ListenerList();
+    private ListenerList pageChangingListeners;
 
     /**
      * A layout for a container which includes several pages, like a notebook,
@@ -156,7 +160,7 @@
      * maximum width and height of all pages currently inserted into the
      * container.
      */
-    protected class PageContainerFillLayout extends Layout {
+    protected class PageContainerFillLayout : Layout {
         /**
          * The margin width; <code>5</code> pixels by default.
          */
@@ -189,7 +193,8 @@
          * @param minH
          *            the minimum height
          */
-        public PageContainerFillLayout(int mw, int mh, int minW, int minH) {
+        public this(int mw, int mh, int minW, int minH) {
+            pageContainerLayout = new PageContainerFillLayout( 5, 5, 300, 225);
             marginWidth = mw;
             marginHeight = mh;
             minimumWidth = minW;
@@ -288,14 +293,19 @@
      * @param newWizard
      *            the wizard this dialog is working on
      */
-    public WizardDialog(Shell parentShell, IWizard newWizard) {
+    public this(Shell parentShell, IWizard newWizard) {
+        createdWizards = new ArraySeq!(Object);
+        nestedWizards = new ArraySeq!(Object);
+        pageChangedListeners = new ListenerList();
+        pageChangingListeners = new ListenerList();
+
         super(parentShell);
         setShellStyle(DWT.CLOSE | DWT.MAX | DWT.TITLE | DWT.BORDER
                 | DWT.APPLICATION_MODAL | DWT.RESIZE | getDefaultOrientation());
         setWizard(newWizard);
         // since VAJava can't initialize an instance var with an anonymous
         // class outside a constructor we do it here:
-        cancelListener = new SelectionAdapter() {
+        cancelListener = new class SelectionAdapter {
             public void widgetSelected(SelectionEvent e) {
                 cancelPressed();
             }
@@ -313,7 +323,7 @@
      * @return the saved UI state
      */
     private Object aboutToStart(bool enableCancelButton) {
-        Map savedState = null;
+        Map!(Object,Object) savedState = null;
         if (getShell() !is null) {
             // Save focus control
             Control focusControl = getShell().getDisplay().getFocusControl();
@@ -332,7 +342,7 @@
             // Deactivate shell
             savedState = saveUIState(needsProgressMonitor && enableCancelButton);
             if (focusControl !is null) {
-                savedState.put(FOCUS_CONTROL, focusControl);
+                savedState.add(stringcast(FOCUS_CONTROL), focusControl);
             }
             // Attach the progress monitor part to the cancel button
             if (needsProgressMonitor) {
@@ -340,7 +350,7 @@
                 progressMonitorPart.setVisible(true);
             }
         }
-        return savedState;
+        return cast(Object) savedState;
     }
 
     /**
@@ -442,7 +452,7 @@
     protected void configureShell(Shell newShell) {
         super.configureShell(newShell);
         // Register help listener on the shell
-        newShell.addHelpListener(new HelpListener() {
+        newShell.addHelpListener(new class HelpListener {
             public void helpRequested(HelpEvent event) {
                 // call perform help on the current page
                 if (currentPage !is null) {
@@ -464,7 +474,7 @@
      *            the parent composite to contain the buttons
      */
     protected void createButtonsForButtonBar(Composite parent) {
-        ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false;
+        (cast(GridLayout) parent.getLayout()).makeColumnsEqualWidth = false;
         if (wizard.isHelpAvailable()) {
             helpButton = createButton(parent, IDialogConstants.HELP_ID,
                     IDialogConstants.HELP_LABEL, false);
@@ -507,7 +517,7 @@
      */
     private Button createCancelButton(Composite parent) {
         // increment the number of columns in the button bar
-        ((GridLayout) parent.getLayout()).numColumns++;
+        (cast(GridLayout) parent.getLayout()).numColumns++;
         Button button = new Button(parent, DWT.PUSH);
         button.setText(IDialogConstants.CANCEL_LABEL);
         setButtonLayoutData(button);
@@ -557,7 +567,7 @@
      * (non-Javadoc) Method declared on Dialog.
      */
     protected Control createDialogArea(Composite parent) {
-        Composite composite = (Composite) super.createDialogArea(parent);
+        Composite composite = cast(Composite) super.createDialogArea(parent);
         // Build the Page container
         pageContainer = createPageContainer(composite);
         GridData gd = new GridData(GridData.FILL_BOTH);
@@ -589,9 +599,14 @@
      */
     protected ProgressMonitorPart createProgressMonitorPart(
             Composite composite, GridLayout pmlayout) {
-        return new ProgressMonitorPart(composite, pmlayout, DWT.DEFAULT) {
+        return new class(composite, pmlayout, DWT.DEFAULT) ProgressMonitorPart {
+
             String currentTask = null;
 
+            this(Composite c, Layout l, int s ){
+                super(c,l,s);
+            }
+
             /*
              * (non-Javadoc)
              *
@@ -697,7 +712,7 @@
      */
     private Composite createPreviousAndNextButtons(Composite parent) {
         // increment the number of columns in the button bar
-        ((GridLayout) parent.getLayout()).numColumns++;
+        (cast(GridLayout) parent.getLayout()).numColumns++;
         Composite composite = new Composite(parent, DWT.NONE);
         // create a layout with spacing and margins appropriate for the font
         // size.
@@ -730,7 +745,7 @@
                 null,
                 JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$
                 MessageDialog.QUESTION,
-                new String[] { IDialogConstants.OK_LABEL }, 0);
+                [ IDialogConstants.OK_LABEL ], 0);
         return result;
     }
 
@@ -750,7 +765,7 @@
             // Call perform finish on outer wizards in the nested chain
             // (to allow them to save state for example)
             for (int i = 0; i < nestedWizards.size() - 1; i++) {
-                ((IWizard) nestedWizards.get(i)).performFinish();
+                (cast(IWizard) nestedWizards.get(i)).performFinish();
             }
             // Hard close the dialog.
             setReturnCode(OK);
@@ -793,7 +808,7 @@
     private bool hardClose() {
         // inform wizards
         for (int i = 0; i < createdWizards.size(); i++) {
-            IWizard createdWizard = (IWizard) createdWizards.get(i);
+            IWizard createdWizard = cast(IWizard) createdWizards.get(i);
             createdWizard.dispose();
             // Remove this dialog as a parent from the managed wizard.
             // Note that we do this after calling dispose as the wizard or
@@ -836,8 +851,8 @@
      *         successfully, <code>false</code> otherwise
      */
     private bool doPageChanging(IWizardPage targetPage) {
-        PageChangingEvent e = new PageChangingEvent(this, getCurrentPage(),
-                targetPage);
+        PageChangingEvent e = new PageChangingEvent(this, cast(Object)getCurrentPage(),
+                cast(Object)targetPage);
         firePageChanging(e);
         // Prevent navigation if necessary
         return e.doit;
@@ -878,9 +893,9 @@
      *            the key
      * @see #saveEnableStateAndSet
      */
-    private void restoreEnableState(Control w, Map h, String key) {
+    private void restoreEnableState(Control w, Map!(Object,Object) h, String key) {
         if (w !is null) {
-            bool b = (bool) h.get(key);
+            auto b = cast(Boolean) h.get(stringcast(key));
             if (b !is null) {
                 w.setEnabled(b.booleanValue());
             }
@@ -896,15 +911,15 @@
      *            <code>saveUIState</code>
      * @see #saveUIState
      */
-    private void restoreUIState(Map state) {
+    private void restoreUIState(Map!(Object,Object) state) {
         restoreEnableState(backButton, state, "back"); //$NON-NLS-1$
         restoreEnableState(nextButton, state, "next"); //$NON-NLS-1$
         restoreEnableState(finishButton, state, "finish"); //$NON-NLS-1$
         restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$
         restoreEnableState(helpButton, state, "help"); //$NON-NLS-1$
-        Object pageValue = state.get("page"); //$NON-NLS-1$
+        Object pageValue = state.get(stringcast("page")); //$NON-NLS-1$
         if (pageValue !is null) {
-            ((ControlEnableState) pageValue).restore();
+            (cast(ControlEnableState) pageValue).restore();
         }
     }
 
@@ -924,8 +939,7 @@
      *
      */
     public void run(bool fork, bool cancelable,
-            IRunnableWithProgress runnable) throws InvocationTargetException,
-            InterruptedException {
+            IRunnableWithProgress runnable) {
         // The operation can only be canceled if it is executed in a separate
         // thread.
         // Otherwise the UI is blocked anyway.
@@ -966,10 +980,10 @@
      *            <code>false</code> to disable it
      * @see #restoreEnableState(Control, Map, String)
      */
-    private void saveEnableStateAndSet(Control w, Map h, String key,
+    private void saveEnableStateAndSet(Control w, Map!(Object,Object) h, String key,
             bool enabled) {
         if (w !is null) {
-            h.put(key, w.getEnabled() ? bool.TRUE : bool.FALSE);
+            h.add(stringcast(key), w.getEnabled() ? Boolean.TRUE : Boolean.FALSE);
             w.setEnabled(enabled);
         }
     }
@@ -987,8 +1001,8 @@
      *         with <code>restoreUIState</code>
      * @see #restoreUIState
      */
-    private Map saveUIState(bool keepCancelEnabled) {
-        Map savedState = new HashMap(10);
+    private Map!(Object,Object) saveUIState(bool keepCancelEnabled) {
+        Map!(Object,Object) savedState = new HashMap!(Object,Object);
         saveEnableStateAndSet(backButton, savedState, "back", false); //$NON-NLS-1$
         saveEnableStateAndSet(nextButton, savedState, "next", false); //$NON-NLS-1$
         saveEnableStateAndSet(finishButton, savedState, "finish", false); //$NON-NLS-1$
@@ -996,9 +1010,7 @@
                 "cancel", keepCancelEnabled); //$NON-NLS-1$
         saveEnableStateAndSet(helpButton, savedState, "help", false); //$NON-NLS-1$
         if (currentPage !is null) {
-            savedState
-                    .put(
-                            "page", ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$
+            savedState.add(stringcast("page"), ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$
         }
         return savedState;
     }
@@ -1079,10 +1091,10 @@
     protected void setWizard(IWizard newWizard) {
         wizard = newWizard;
         wizard.setContainer(this);
-        if (!createdWizards.contains(wizard)) {
-            createdWizards.add(wizard);
+        if (!createdWizards.contains(cast(Object)wizard)) {
+            createdWizards.append(cast(Object)wizard);
             // New wizard so just add it to the end of our nested list
-            nestedWizards.add(wizard);
+            nestedWizards.append(cast(Object)wizard);
             if (pageContainer !is null) {
                 // Dialog is already open
                 // Allow the wizard pages to precreate their page controls
@@ -1097,11 +1109,11 @@
             // on the nested list then we assume we have gone back and remove
             // the last wizard from the list
             int size = nestedWizards.size();
-            if (size >= 2 && nestedWizards.get(size - 2) is wizard) {
-                nestedWizards.remove(size - 1);
+            if (size >= 2 && nestedWizards.get(size - 2) is cast(Object)wizard) {
+                nestedWizards.removeAt(size - 1);
             } else {
                 // Assume we are going forward to revisit a wizard
-                nestedWizards.add(wizard);
+                nestedWizards.append(cast(Object)wizard);
             }
         }
     }
@@ -1130,7 +1142,7 @@
             updateForPage(page);
         } else {
             final IWizardPage finalPage = page;
-            BusyIndicator.showWhile(getContents().getDisplay(), new Runnable() {
+            BusyIndicator.showWhile(getContents().getDisplay(), new class Runnable {
                 public void run() {
                     updateForPage(finalPage);
                 }
@@ -1157,7 +1169,7 @@
             // via getControl.
             Assert.isNotNull(page.getControl(), JFaceResources.format(
                     JFaceResources.getString("WizardDialog.missingSetControl"), //$NON-NLS-1$
-                    new Object[] { page.getName() }));
+                    [ page.getName() ]));
             // ensure the dialog is large enough for this page
             updateSize(page);
         }
@@ -1213,7 +1225,7 @@
                 progressMonitorPart.setVisible(false);
                 progressMonitorPart.removeFromCancelComponent(cancelButton);
             }
-            Map state = (Map) savedState;
+            Map!(Object,Object) state = cast(Map!(Object,Object)) savedState;
             restoreUIState(state);
             cancelButton.addSelectionListener(cancelListener);
             setDisplayCursor(null);
@@ -1222,7 +1234,7 @@
             waitCursor = null;
             arrowCursor.dispose();
             arrowCursor = null;
-            Control focusControl = (Control) state.get(FOCUS_CONTROL);
+            Control focusControl = cast(Control) state.get(stringcast(FOCUS_CONTROL));
             if (focusControl !is null) {
                 focusControl.setFocus();
             }
@@ -1241,7 +1253,7 @@
         updateButtons();
 
         // Fires the page change event
-        firePageChanged(new PageChangedEvent(this, getCurrentPage()));
+        firePageChanged(new PageChangedEvent(this, cast(Object)getCurrentPage()));
     }
 
     /*
@@ -1287,8 +1299,8 @@
         }
 
         pageMessage = currentPage.getMessage();
-        if (pageMessage !is null && currentPage instanceof IMessageProvider) {
-            pageMessageType = ((IMessageProvider) currentPage).getMessageType();
+        if (pageMessage !is null && cast(IMessageProvider)currentPage ) {
+            pageMessageType = (cast(IMessageProvider) currentPage).getMessageType();
         } else {
             pageMessageType = IMessageProvider.NONE;
         }
@@ -1424,7 +1436,7 @@
      * @see dwtx.jface.dialogs.IPageChangeProvider#getSelectedPage()
      */
     public Object getSelectedPage() {
-        return getCurrentPage();
+        return cast(Object)getCurrentPage();
     }
 
     /*
@@ -1433,7 +1445,7 @@
      * @see dwtx.jface.dialog.IPageChangeProvider#addPageChangedListener()
      */
     public void addPageChangedListener(IPageChangedListener listener) {
-        pageChangedListeners.add(listener);
+        pageChangedListeners.add(cast(Object)listener);
     }
 
     /*
@@ -1442,7 +1454,7 @@
      * @see dwtx.jface.dialog.IPageChangeProvider#removePageChangedListener()
      */
     public void removePageChangedListener(IPageChangedListener listener) {
-        pageChangedListeners.remove(listener);
+        pageChangedListeners.remove(cast(Object)listener);
     }
 
     /**
@@ -1457,13 +1469,18 @@
      *
      * @since 3.1
      */
-    protected void firePageChanged(final PageChangedEvent event) {
+    protected void firePageChanged(PageChangedEvent event) {
         Object[] listeners = pageChangedListeners.getListeners();
         for (int i = 0; i < listeners.length; ++i) {
-            final IPageChangedListener l = (IPageChangedListener) listeners[i];
-            SafeRunnable.run(new SafeRunnable() {
+            SafeRunnable.run(new class SafeRunnable {
+                PageChangedEvent event_;
+                IPageChangedListener l;
+                this(){
+                    l = cast(IPageChangedListener) listeners[i];
+                    event_=event;
+                }
                 public void run() {
-                    l.pageChanged(event);
+                    l.pageChanged(event_);
                 }
             });
         }
@@ -1479,7 +1496,7 @@
      * @since 3.3
      */
     public void addPageChangingListener(IPageChangingListener listener) {
-        pageChangingListeners.add(listener);
+        pageChangingListeners.add(cast(Object)listener);
     }
 
     /**
@@ -1491,7 +1508,7 @@
      * @since 3.3
      */
     public void removePageChangingListener(IPageChangingListener listener) {
-        pageChangingListeners.remove(listener);
+        pageChangingListeners.remove(cast(Object)listener);
     }
 
     /**
@@ -1505,16 +1522,20 @@
      * @see IPageChangingListener#handlePageChanging(PageChangingEvent)
      * @since 3.3
      */
-    protected void firePageChanging(final PageChangingEvent event) {
+    protected void firePageChanging(PageChangingEvent event) {
         Object[] listeners = pageChangingListeners.getListeners();
         for (int i = 0; i < listeners.length; ++i) {
-            final IPageChangingListener l = (IPageChangingListener) listeners[i];
-            SafeRunnable.run(new SafeRunnable() {
+            SafeRunnable.run(new class SafeRunnable {
+                PageChangingEvent event_;
+                IPageChangingListener l;
+                this(){
+                    l = cast(IPageChangingListener) listeners[i];
+                    event_=event;
+                }
                 public void run() {
-                    l.handlePageChanging(event);
+                    l.handlePageChanging(event_);
                 }
             });
         }
     }
 }
-++/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/WizardPage.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.WizardPage;
+
+import dwtx.jface.wizard.IWizardPage;
+import dwtx.jface.wizard.IWizard;
+import dwtx.jface.wizard.IWizardContainer;
+
+import dwt.graphics.Image;
+import dwt.widgets.Shell;
+import dwtx.core.runtime.Assert;
+import dwtx.jface.dialogs.DialogPage;
+import dwtx.jface.dialogs.IDialogSettings;
+import dwtx.jface.resource.ImageDescriptor;
+
+import dwt.dwthelper.utils;
+
+/**
+ * An abstract base implementation of a wizard page.
+ * <p>
+ * Subclasses must implement the <code>createControl</code> method
+ * to create the specific controls for the wizard page.
+ * </p>
+ * <p>
+ * Subclasses may call the following methods to configure the wizard page:
+ * <ul>
+ *  <li><code>setDescription</code></li>
+ *  <li><code>setErrorMessage</code></li>
+ *  <li><code>setImageDescriptor</code></li>
+ *  <li><code>setMessage</code></li>
+ *  <li><code>setPageComplete</code></li>
+ *  <li><code>setPreviousPage</code></li>
+ *  <li><code>setTitle</code></li>
+ * </ul>
+ * </p>
+ * <p>
+ * Subclasses may override these methods if required:
+ * <ul>
+ *  <li><code>performHelp</code> - may be reimplemented to display help for the page</li>
+ * <li><code>canFlipToNextPage</code> - may be extended or reimplemented</li>
+ *  <li><code>isPageComplete</code> - may be extended </li>
+ *  <li><code>setDescription</code> - may be extended </li>
+ *  <li><code>setTitle</code> - may be extended </li>
+ *  <li><code>dispose</code> - may be extended to dispose additional allocated DWT resources</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Note that clients are free to implement <code>IWizardPage</code> from scratch
+ * instead of subclassing <code>WizardPage</code>. Correct implementations of
+ * <code>IWizardPage</code> will work with any correct implementation of
+ * <code>IWizard</code>.
+ * </p>
+ */
+public abstract class WizardPage : DialogPage, IWizardPage {
+
+    /**
+     * This page's name.
+     */
+    private String name;
+
+    /**
+     * The wizard to which this page belongs; <code>null</code>
+     * if this page has yet to be added to a wizard.
+     */
+    private IWizard wizard = null;
+
+    /**
+     * Indicates whether this page is complete.
+     */
+    private bool isPageComplete_ = true;
+
+    /**
+     * The page that was shown right before this page became visible;
+     * <code>null</code> if none.
+     */
+    private IWizardPage previousPage = null;
+
+    /**
+     * Creates a new wizard page with the given name, and
+     * with no title or image.
+     *
+     * @param pageName the name of the page
+     */
+    protected this(String pageName) {
+        this(pageName, null, cast(ImageDescriptor) null);
+    }
+
+    /**
+     * Creates a new wizard page with the given name, title, and image.
+     *
+     * @param pageName the name of the page
+     * @param title the title for this wizard page,
+     *   or <code>null</code> if none
+     * @param titleImage the image descriptor for the title of this wizard page,
+     *   or <code>null</code> if none
+     */
+    protected this(String pageName, String title,
+            ImageDescriptor titleImage) {
+        super(title, titleImage);
+        Assert.isNotNull(pageName); // page name must not be null
+        name = pageName;
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this <code>IWizardPage</code>
+     * method returns <code>true</code> if this page is complete (<code>isPageComplete</code>)
+     * and there is a next page to flip to. Subclasses may override (extend or reimplement).
+     *
+     * @see #getNextPage
+     * @see #isPageComplete()
+     */
+    public bool canFlipToNextPage() {
+        return isPageComplete() && getNextPage() !is null;
+    }
+
+    /**
+     * Returns the wizard container for this wizard page.
+     *
+     * @return the wizard container, or <code>null</code> if this
+     *   wizard page has yet to be added to a wizard, or the
+     *   wizard has yet to be added to a container
+     */
+    protected IWizardContainer getContainer() {
+        if (wizard is null) {
+            return null;
+        }
+        return wizard.getContainer();
+    }
+
+    /**
+     * Returns the dialog settings for this wizard page.
+     *
+     * @return the dialog settings, or <code>null</code> if none
+     */
+    protected IDialogSettings getDialogSettings() {
+        if (wizard is null) {
+            return null;
+        }
+        return wizard.getDialogSettings();
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IDialogPage.
+     */
+    public Image getImage() {
+        Image result = super.getImage();
+
+        if (result is null && wizard !is null) {
+            return wizard.getDefaultPageImage();
+        }
+
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IWizardPage.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IWizardPage.
+     * The default behavior is to ask the wizard for the next page.
+     */
+    public IWizardPage getNextPage() {
+        if (wizard is null) {
+            return null;
+        }
+        return wizard.getNextPage(this);
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IWizardPage.
+     * The default behavior is return the cached previous back or,
+     * lacking that, to ask the wizard for the previous page.
+     */
+    public IWizardPage getPreviousPage() {
+        if (previousPage !is null) {
+            return previousPage;
+        }
+
+        if (wizard is null) {
+            return null;
+        }
+
+        return wizard.getPreviousPage(this);
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this method declared on
+     * <code>DialogPage</code> returns the shell of the container.
+     * The advantage of this implementation is that the shell is accessable
+     * once the container is created even though this page's control may not
+     * yet be created.
+     */
+    public Shell getShell() {
+
+        IWizardContainer container = getContainer();
+        if (container is null) {
+            return null;
+        }
+
+        // Ask the wizard since our contents may not have been created.
+        return container.getShell();
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IWizardPage.
+     */
+    public IWizard getWizard() {
+        return wizard;
+    }
+
+    /**
+     * Returns whether this page is the current one in the wizard's container.
+     *
+     * @return <code>true</code> if the page is active,
+     *  and <code>false</code> otherwise
+     */
+    protected bool isCurrentPage() {
+        return (getContainer() !is null && this is getContainer()
+                .getCurrentPage());
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this <code>IWizard</code> method
+     * returns the value of an internal state variable set by
+     * <code>setPageComplete</code>. Subclasses may extend.
+     */
+    public bool isPageComplete() {
+        return isPageComplete_;
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this <code>IDialogPage</code>
+     * method extends the <code>DialogPage</code> implementation to update
+     * the wizard container title bar. Subclasses may extend.
+     */
+    public void setDescription(String description) {
+        super.setDescription(description);
+        if (isCurrentPage()) {
+            getContainer().updateTitleBar();
+        }
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this method
+     * declared on <code>DialogPage</code> updates the container
+     * if this is the current page.
+     */
+    public void setErrorMessage(String newMessage) {
+        super.setErrorMessage(newMessage);
+        if (isCurrentPage()) {
+            getContainer().updateMessage();
+        }
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this method
+     * declared on <code>DialogPage</code> updates the container
+     * if this page is the current page.
+     */
+    public void setImageDescriptor(ImageDescriptor image) {
+        super.setImageDescriptor(image);
+        if (isCurrentPage()) {
+            getContainer().updateTitleBar();
+        }
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this method
+     * declared on <code>DialogPage</code> updates the container
+     * if this is the current page.
+     */
+    public void setMessage(String newMessage, int newType) {
+        super.setMessage(newMessage, newType);
+        if (isCurrentPage()) {
+            getContainer().updateMessage();
+        }
+    }
+
+    /**
+     * Sets whether this page is complete.
+     * <p>
+     * This information is typically used by the wizard to decide
+     * when it is okay to move on to the next page or finish up.
+     * </p>
+     *
+     * @param complete <code>true</code> if this page is complete, and
+     *   and <code>false</code> otherwise
+     * @see #isPageComplete()
+     */
+    public void setPageComplete(bool complete) {
+        isPageComplete_ = complete;
+        if (isCurrentPage()) {
+            getContainer().updateButtons();
+        }
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IWizardPage.
+     */
+    public void setPreviousPage(IWizardPage page) {
+        previousPage = page;
+    }
+
+    /**
+     * The <code>WizardPage</code> implementation of this <code>IDialogPage</code>
+     * method extends the <code>DialogPage</code> implementation to update
+     * the wizard container title bar. Subclasses may extend.
+     */
+    public void setTitle(String title) {
+        super.setTitle(title);
+        if (isCurrentPage()) {
+            getContainer().updateTitleBar();
+        }
+    }
+
+    /* (non-Javadoc)
+     * Method declared on IWizardPage.
+     */
+    public void setWizard(IWizard newWizard) {
+        wizard = newWizard;
+    }
+
+    /**
+     * Returns a printable representation of this wizard page suitable
+     * only for debug purposes.
+     */
+    public String toString() {
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwtx/jface/wizard/WizardSelectionPage.d	Sat Apr 05 04:49:22 2008 +0200
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
+ *******************************************************************************/
+module dwtx.jface.wizard.WizardSelectionPage;
+
+import dwtx.jface.wizard.IWizardPage;
+import dwtx.jface.wizard.IWizard;
+import dwtx.jface.wizard.WizardPage;
+import dwtx.jface.wizard.IWizardNode;
+
+import tango.util.collection.ArraySeq;
+
+import dwt.dwthelper.utils;
+
+/**
+ * An abstract implementation of a wizard page that manages a
+ * set of embedded wizards.
+ * <p>
+ * A wizard selection page should present a list of wizard nodes
+ * corresponding to other wizards. When the end user selects one of
+ * them from the list, the first page of the selected wizard becomes
+ * the next page. The only new methods introduced by this class are
+ * <code>getSelectedNode</code> and <code>setSelectedNode</code>.
+ * Otherwise, the subclass contract is the same as <code>WizardPage</code>.
+ * </p>
+ */
+public abstract class WizardSelectionPage : WizardPage {
+
+    /**
+     * The selected node; <code>null</code> if none.
+     */
+    private IWizardNode selectedNode = null;
+
+    /**
+     * List of wizard nodes that have cropped up in the past
+     * (element type: <code>IWizardNode</code>).
+     */
+    private ArraySeq!(Object) selectedWizardNodes;
+
+    /**
+     * Creates a new wizard selection page with the given name, and
+     * with no title or image.
+     *
+     * @param pageName the name of the page
+     */
+    protected this(String pageName) {
+        super(pageName);
+        selectedWizardNodes = new ArraySeq!(Object);
+        // Cannot finish from this page
+        setPageComplete(false);
+    }
+
+    /**
+     * Adds the given wizard node to the list of selected nodes if
+     * it is not already in the list.
+     *
+     * @param node the wizard node, or <code>null</code>
+     */
+    private void addSelectedNode(IWizardNode node) {
+        if (node is null) {
+            return;
+        }
+
+        if (selectedWizardNodes.contains(cast(Object)node)) {
+            return;
+        }
+
+        selectedWizardNodes.append(cast(Object)node);
+    }
+
+    /**
+     * The <code>WizardSelectionPage</code> implementation of
+     * this <code>IWizardPage</code> method returns <code>true</code>
+     * if there is a selected node.
+     */
+    public bool canFlipToNextPage() {
+        return selectedNode !is null;
+    }
+
+    /**
+     * The <code>WizardSelectionPage</code> implementation of an <code>IDialogPage</code>
+     * method disposes of all nested wizards. Subclasses may extend.
+     */
+    public void dispose() {
+        super.dispose();
+        // notify nested wizards
+        for (int i = 0; i < selectedWizardNodes.size(); i++) {
+            (cast(IWizardNode) selectedWizardNodes.get(i)).dispose();
+        }
+    }
+
+    /**
+     * The <code>WizardSelectionPage</code> implementation of
+     * this <code>IWizardPage</code> method returns the first page
+     * of the currently selected wizard if there is one.
+     */
+    public IWizardPage getNextPage() {
+        if (selectedNode is null) {
+            return null;
+        }
+
+        bool isCreated = selectedNode.isContentCreated();
+
+        IWizard wizard = selectedNode.getWizard();
+
+        if (wizard is null) {
+            setSelectedNode(null);
+            return null;
+        }
+
+        if (!isCreated) {
+            // Allow the wizard to create its pages
+            wizard.addPages();
+        }
+
+        return wizard.getStartingPage();
+    }
+
+    /**
+     * Returns the currently selected wizard node within this page.
+     *
+     * @return the wizard node, or <code>null</code> if no node is selected
+     */
+    public IWizardNode getSelectedNode() {
+        return selectedNode;
+    }
+
+    /**
+     * Sets or clears the currently selected wizard node within this page.
+     *
+     * @param node the wizard node, or <code>null</code> to clear
+     */
+    protected void setSelectedNode(IWizardNode node) {
+        addSelectedNode(node);
+        selectedNode = node;
+        if (isCurrentPage()) {
+            getContainer().updateButtons();
+        }
+    }
+}