# HG changeset patch # User Frank Benoit # Date 1211421838 -7200 # Node ID 4878bef4a38e701bd65eae55c1dbc92a8480c500 # Parent 46a6e0e6ccd404942a3ae601023a2d44138e2de6 Some fixing diff -r 46a6e0e6ccd4 -r 4878bef4a38e dsss.conf --- a/dsss.conf Thu May 22 01:36:46 2008 +0200 +++ b/dsss.conf Thu May 22 04:03:58 2008 +0200 @@ -3,7 +3,8 @@ [dwtx] -type=sourcelibrary +type=library +buildflags+=-Jres preinstall = \ installdir res $LIB_PREFIX/res diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/core/commands/Command.d --- a/dwtx/core/commands/Command.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/core/commands/Command.d Thu May 22 04:03:58 2008 +0200 @@ -37,6 +37,7 @@ import dwtx.core.commands.IExecutionListener; import dwtx.core.commands.ICommandListener; import dwtx.core.commands.IHandler; +import dwtx.core.commands.IHandler2; import dwtx.core.commands.IObjectWithState; import dwtx.core.commands.IExecutionListenerWithChecks; import dwtx.core.commands.ITypedParameter; @@ -863,10 +864,10 @@ return handler.isEnabled(); } - + /** * Called be the framework to allow the handler to update its enabled state. - * + * * @param evaluationContext * the state to evaluate against. May be null * which indicates that the handler can query whatever model that @@ -874,8 +875,8 @@ * @since 3.4 */ public void setEnabled(Object evaluationContext) { - if (handler instanceof IHandler2) { - ((IHandler2) handler).setEnabled(evaluationContext); + if (null !is cast(IHandler2)handler ) { + (cast(IHandler2) handler).setEnabled(evaluationContext); } } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/core/commands/IHandler2.d --- a/dwtx/core/commands/IHandler2.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/core/commands/IHandler2.d Thu May 22 04:03:58 2008 +0200 @@ -13,18 +13,20 @@ module dwtx.core.commands.IHandler2; +import dwtx.core.commands.IHandler; + /** * Extend the IHandler interface to provide some context for isEnabled() * requests. Clients should use {@link AbstractHandler} unless they need to * provide their own listener mechanism. - * + * * @since 3.4 * @see AbstractHandler */ -public interface IHandler2 extends IHandler { +public interface IHandler2 : IHandler { /** * Called by the framework to allow the handler to update its enabled state. - * + * * @param evaluationContext * the state to evaluate against. May be null * which indicates that the handler can query whatever model that diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/core/commands/ParameterizedCommand.d --- a/dwtx/core/commands/ParameterizedCommand.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/core/commands/ParameterizedCommand.d Thu May 22 04:03:58 2008 +0200 @@ -29,16 +29,18 @@ import tango.util.collection.HashSet; import tango.util.collection.HashMap; +import dwtx.core.commands.AbstractParameterValueConverter; import dwtx.core.commands.Command; import dwtx.core.commands.CommandManager; import dwtx.core.commands.IParameter; import dwtx.core.commands.IParameterValues; +import dwtx.core.commands.ParameterType; import dwtx.core.commands.Parameterization; import dwtx.core.commands.ParameterValuesException; +import dwtx.core.commands.ParameterValueConversionException; import dwtx.core.commands.ExecutionEvent; import dwtx.core.commands.common.NotDefinedException; import dwtx.core.internal.commands.util.Util; - import dwt.dwthelper.utils; import tango.text.convert.Format; @@ -320,7 +322,7 @@ /** * Take a command and a map of parameter IDs to values, and generate the * appropriate parameterized command. - * + * * @param command * The command object. Must not be null. * @param parameters @@ -331,19 +333,17 @@ * @since 3.4 */ public static final ParameterizedCommand generateCommand(Command command, - Map parameters) { + Map!(String,Object) parameters) { // no parameters - if (parameters is null || parameters.isEmpty()) { + if (parameters is null || parameters.drained()) { return new ParameterizedCommand(command, null); } try { - ArrayList parms = new ArrayList(); - Iterator i = parameters.keySet().iterator(); + Parameterization[] parms; // iterate over given parameters - while (i.hasNext()) { - String key = (String) i.next(); + foreach( key, value; parameters ){ IParameter parameter = null; // get the parameter from the command parameter = command.getParameter(key); @@ -354,26 +354,24 @@ } ParameterType parameterType = command.getParameterType(key); if (parameterType is null) { - parms.add(new Parameterization(parameter, - (String) parameters.get(key))); + parms ~= new Parameterization(parameter, + stringcast(value) ); } else { AbstractParameterValueConverter valueConverter = parameterType .getValueConverter(); if (valueConverter !is null) { - String val = valueConverter.convertToString(parameters - .get(key)); - parms.add(new Parameterization(parameter, val)); + String val = valueConverter.convertToString(value); + parms ~= new Parameterization(parameter, val); } else { - parms.add(new Parameterization(parameter, - (String) parameters.get(key))); + parms ~= new Parameterization(parameter, + stringcast(value)); } } } // convert the parameters to an Parameterization array and create // the command - return new ParameterizedCommand(command, (Parameterization[]) parms - .toArray(new Parameterization[parms.size()])); + return new ParameterizedCommand(command, parms ); } catch (NotDefinedException e) { } catch (ParameterValueConversionException e) { } @@ -431,7 +429,7 @@ for (int j = 0; j < parms.length; j++) { for (int i = 0; i < parameterizations.length; i++) { Parameterization pm = parameterizations[i]; - if (parms[j].equals(pm.getParameter())) { + if ((cast(Object)parms[j]).opEquals(cast(Object)pm.getParameter())) { params[parmIndex++] = pm; } } @@ -629,7 +627,7 @@ /* * (non-Javadoc) - * + * * @see java.lang.Object#hashCode() */ public override final hash_t toHash() { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/core/internal/runtime/PrintStackUtil.d --- a/dwtx/core/internal/runtime/PrintStackUtil.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/core/internal/runtime/PrintStackUtil.d Thu May 22 04:03:58 2008 +0200 @@ -4,7 +4,7 @@ * 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: @@ -12,38 +12,37 @@ *******************************************************************************/ module dwtx.core.internal.runtime.PrintStackUtil; -import java.io.PrintStream; -import java.io.PrintWriter; - import dwtx.core.runtime.IStatus; +import tango.io.Print; +import dwt.dwthelper.utils; public class PrintStackUtil { - static public void printChildren(IStatus status, PrintStream output) { + static public void printChildren(IStatus status, Print!(char) output) { IStatus[] children = status.getChildren(); if (children is null || children.length is 0) return; for (int i = 0; i < children.length; i++) { - output.println("Contains: " + children[i].getMessage()); //$NON-NLS-1$ - Throwable exception = children[i].getException(); + output.formatln("Contains: {}", children[i].getMessage()); //$NON-NLS-1$ + Exception exception = children[i].getException(); if (exception !is null) - exception.printStackTrace(); + ExceptionPrintStackTrace(exception); printChildren(children[i], output); } } - static public void printChildren(IStatus status, PrintWriter output) { - IStatus[] children = status.getChildren(); - if (children is null || children.length is 0) - return; - for (int i = 0; i < children.length; i++) { - output.println("Contains: " + children[i].getMessage()); //$NON-NLS-1$ - output.flush(); // call to synchronize output - Throwable exception = children[i].getException(); - if (exception !is null) - exception.printStackTrace(); - printChildren(children[i], output); - } - } +// static public void printChildren(IStatus status, Print!(char) output) { +// IStatus[] children = status.getChildren(); +// if (children is null || children.length is 0) +// return; +// for (int i = 0; i < children.length; i++) { +// output.formatln( "Contains: {}", children[i].getMessage()); //$NON-NLS-1$ +// output.flush(); // call to synchronize output +// Exception exception = children[i].getException(); +// if (exception !is null) +// ExceptionPrintStackTrace(exception); +// printChildren(children[i], output); +// } +// } } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/action/ActionContributionItem.d --- a/dwtx/jface/action/ActionContributionItem.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/action/ActionContributionItem.d Thu May 22 04:03:58 2008 +0200 @@ -62,7 +62,7 @@ */ public class ActionContributionItem : ContributionItem { alias ContributionItem.fill fill; - + /** * Mode bit: Show text on tool items or buttons, even if an image is * present. If this mode bit is not set, text is only shown on tool items if @@ -298,7 +298,7 @@ } if (flags is DWT.CASCADE) { - // just create a proxy for now, if the user shows it then + // just create a proxy for now, if the user shows it then // fill it in Menu subMenu = new Menu(parent); subMenu.addListener(DWT.Show, getMenuCreatorListener()); @@ -566,8 +566,8 @@ if (actionDefinitionId !is null) { Object obj = ExternalActionManager.getInstance() .getCallback(); - if (obj instanceof ExternalActionManager.IExecuteCallback) { - callback = (ExternalActionManager.IExecuteCallback) obj; + if (null !is cast(ExternalActionManager.IExecuteCallback)obj ) { + callback = cast(ExternalActionManager.IExecuteCallback) obj; } } @@ -581,16 +581,16 @@ if (trace) { ms = System.currentTimeMillis(); Stdout.formatln("Running action: {}", action.getText()); //$NON-NLS-1$ - } - + } + IPropertyChangeListener resultListener = null; if (callback !is null) { - resultListener = new IPropertyChangeListener() { + resultListener = new class IPropertyChangeListener { public void propertyChange(PropertyChangeEvent event) { // Check on result if (event.getProperty().equals(IAction.RESULT)) { - if (event.getNewValue() instanceof Boolean) { - result = (Boolean) event.getNewValue(); + if (null !is cast(Boolean)event.getNewValue() ) { + result = cast(Boolean) event.getNewValue(); } } } @@ -611,7 +611,7 @@ } } - if (resultListener!isnull) { + if (resultListener !is null) { result = null; action.removePropertyChangeListener(resultListener); } @@ -1200,7 +1200,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.action.ContributionItem#dispose() */ public void dispose() { @@ -1210,24 +1210,24 @@ } holdMenu = null; } - + /** * Handle show and hide on the proxy menu for IAction.AS_DROP_DOWN_MENU * actions. - * + * * @return the appropriate listener * @since 3.4 */ private Listener getMenuCreatorListener() { if (menuCreatorListener is null) { - menuCreatorListener = new Listener() { + menuCreatorListener = new class Listener { public void handleEvent(Event event) { switch (event.type) { case DWT.Show: - handleShowProxy((Menu) event.widget); + handleShowProxy(cast(Menu) event.widget); break; case DWT.Hide: - handleHideProxy((Menu) event.widget); + handleHideProxy(cast(Menu) event.widget); break; } } @@ -1235,7 +1235,7 @@ } return menuCreatorListener; } - + /** * This is the easiest way to hold the menu until we can swap it in to the * proxy. @@ -1243,10 +1243,10 @@ private Menu holdMenu = null; private bool menuCreatorCalled = false; - + /** * The proxy menu is being shown, we better get the real menu. - * + * * @param proxy * the proxy menu * @since 3.4 @@ -1268,7 +1268,7 @@ /** * Create MenuItems in the proxy menu that can execute the real menu items * if selected. Create proxy menus for any real item submenus. - * + * * @param realMenu * the real menu to copy from * @param proxy @@ -1279,22 +1279,22 @@ if (realMenu.isDisposed() || proxy.isDisposed()) { return; } - + // we notify the real menu so it can populate itself if it was // listening for DWT.Show realMenu.notifyListeners(DWT.Show, null); - final Listener passThrough = new Listener() { + final Listener passThrough = new class Listener { public void handleEvent(Event event) { if (!event.widget.isDisposed()) { - Widget realItem = (Widget) event.widget.getData(); + Widget realItem = cast(Widget) event.widget.getData(); if (!realItem.isDisposed()) { int style = event.widget.getStyle(); if (event.type is DWT.Selection && ((style & (DWT.TOGGLE | DWT.CHECK)) !is 0) - && realItem instanceof MenuItem) { - ((MenuItem) realItem) - .setSelection(((MenuItem) event.widget) + && (null !is cast(MenuItem)realItem )) { + (cast(MenuItem) realItem) + .setSelection((cast(MenuItem) event.widget) .getSelection()); } event.widget = realItem; @@ -1326,44 +1326,40 @@ final Menu subMenu = new Menu(proxy); subMenu.setData(itemMenu); proxyItem.setMenu(subMenu); - subMenu.addListener(DWT.Show, new Listener() { - public void handleEvent(Event event) { - event.widget.removeListener(DWT.Show, this); - if (event.type is DWT.Show) { - copyMenu(itemMenu, subMenu); - } + subMenu.addListener(DWT.Show, dgListener( (Event event,Menu subMenu_,Menu itemMenu_) { + event.widget.removeListener(DWT.Show, this); + if (event.type is DWT.Show) { + copyMenu(itemMenu_, subMenu_); } - }); + }, subMenu, itemMenu)); subMenu.addListener(DWT.Help, passThrough); subMenu.addListener(DWT.Hide, passThrough); } } } - + /** * The proxy menu is being hidden, so we need to make it go away. - * + * * @param proxy * the proxy menu * @since 3.4 */ - private void handleHideProxy(final Menu proxy) { + private void handleHideProxy(Menu proxy) { proxy.removeListener(DWT.Hide, getMenuCreatorListener()); - proxy.getDisplay().asyncExec(new Runnable() { - public void run() { - if (!proxy.isDisposed()) { - MenuItem parentItem = proxy.getParentItem(); - proxy.dispose(); + proxy.getDisplay().asyncExec(dgRunnable( (Menu proxy_) { + if (!proxy_.isDisposed()) { + MenuItem parentItem = proxy_.getParentItem(); + proxy_.dispose(); parentItem.setMenu(holdMenu); } if (holdMenu !is null && !holdMenu.isDisposed()) { holdMenu.notifyListeners(DWT.Hide, null); } holdMenu = null; - } - }); + }, proxy )); } - + /** * Return the widget associated with this contribution item. It should not * be cached, as it can be disposed and re-created by its containing @@ -1373,7 +1369,7 @@ * actual type of the widget can be any valid control for this * ContributionItem's current ContributionManager. *

- * + * * @return the widget, or null depending on the lifecycle. * @since 3.4 */ diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/action/ExternalActionManager.d --- a/dwtx/jface/action/ExternalActionManager.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/action/ExternalActionManager.d Thu May 22 04:03:58 2008 +0200 @@ -95,7 +95,7 @@ * The callback capable of responding to whether a command is active. */ private const IActiveChecker activeChecker; - + /** * Check the applicability of firing an execution event for an action. */ @@ -159,7 +159,7 @@ return true; } - }, new IExecuteApplicable() { + }, new class IExecuteApplicable { public bool isApplicable(IAction action) { return true; } @@ -185,7 +185,7 @@ CommandManager commandManager, IActiveChecker activeChecker) { this(bindingManager, commandManager, activeChecker, - new IExecuteApplicable() { + new class IExecuteApplicable { public bool isApplicable(IAction action) { return true; } @@ -194,7 +194,7 @@ /** * Constructs a new instance of CommandCallback with the * workbench it should be using. - * + * * @param bindingManager * The binding manager which will provide the callback; must * not be null. @@ -207,13 +207,13 @@ * @param checker * The callback to check if an IAction should fire execution * events. - * + * * @since 3.4 */ - public CommandCallback(final BindingManager bindingManager, - final CommandManager commandManager, - final IActiveChecker activeChecker, - final IExecuteApplicable checker) { + public this(BindingManager bindingManager, + CommandManager commandManager, + IActiveChecker activeChecker, + IExecuteApplicable checker) { loggedCommandIds = new HashSet!(String); registeredListeners = new HashMap!(String,IPropertyChangeListener); if (bindingManager is null) { @@ -247,15 +247,15 @@ */ public final void addPropertyChangeListener(String commandId, IPropertyChangeListener listener) { - Object existing = registeredListeners.get(commandId); - if (existing instanceof ListenerList) { - ((ListenerList) existing).add(listener); + auto existing = cast(Object)registeredListeners.get(commandId); + if (null !is cast(ListenerList)existing ) { + (cast(ListenerList) existing).add(cast(Object)listener); } else if (existing !is null) { ListenerList listeners = new ListenerList(ListenerList.IDENTITY); listeners.add(existing); - listeners.add(listener); + listeners.add(cast(Object)listener); } else { - registeredListeners.put(commandId, listener); + registeredListeners.add(commandId, listener); } if (!bindingManagerListenerAttached) { bindingManager.addBindingManagerListener(this); @@ -275,17 +275,17 @@ ParameterizedCommand parameterizedCommand = new ParameterizedCommand( command, null); if (event.isActiveBindingsChangedFor(parameterizedCommand)) { - Object value = entry.getValue(); + Object value = cast(Object) v; PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(event .getManager(), IAction.TEXT, null, null); - if (value instanceof ListenerList) { - Object[] listeners= ((ListenerList) value).getListeners(); + if (null !is cast(ListenerList)value ) { + Object[] listeners= (cast(ListenerList) value).getListeners(); for (int i = 0; i < listeners.length; i++) { - final IPropertyChangeListener listener = (IPropertyChangeListener) listeners[i]; + final IPropertyChangeListener listener = cast(IPropertyChangeListener) listeners[i]; listener.propertyChange(propertyChangeEvent); } } else { - final IPropertyChangeListener listener = (IPropertyChangeListener) value; + final IPropertyChangeListener listener = cast(IPropertyChangeListener) value; listener.propertyChange(propertyChangeEvent); } } @@ -415,25 +415,25 @@ */ public final void removePropertyChangeListener(String commandId, IPropertyChangeListener listener) { - Object existing= registeredListeners.get(commandId); - if (existing is listener) { + Object existing = cast(Object) registeredListeners.get(commandId); + if (existing is cast(Object)listener) { registeredListeners.removeKey(commandId); if (registeredListeners.drained()) { bindingManager.removeBindingManagerListener(this); bindingManagerListenerAttached = false; } - } else if (existing instanceof ListenerList) { - ListenerList existingList = (ListenerList) existing; - existingList.remove(listener); + } else if (null !is cast(ListenerList)existing ) { + ListenerList existingList = cast(ListenerList) existing; + existingList.remove(cast(Object)listener); if (existingList.size() is 1) { - registeredListeners.put(commandId, existingList.getListeners()[0]); + registeredListeners.add(commandId, cast(IPropertyChangeListener)existingList.getListeners()[0]); } } } public void preExecute(IAction action, Event event) { String actionDefinitionId = action.getActionDefinitionId(); - if (actionDefinitionIdisnull + if (actionDefinitionId is null || !applicabilityChecker.isApplicable(action)) { return; } @@ -446,7 +446,7 @@ public void postExecuteSuccess(IAction action, Object returnValue) { String actionDefinitionId = action.getActionDefinitionId(); - if (actionDefinitionIdisnull + if (actionDefinitionIdisnull || !applicabilityChecker.isApplicable(action)) { return; } @@ -456,7 +456,7 @@ public void postExecuteFailure(IAction action, ExecutionException exception) { String actionDefinitionId = action.getActionDefinitionId(); - if (actionDefinitionIdisnull + if (actionDefinitionIdisnull || !applicabilityChecker.isApplicable(action)) { return; } @@ -465,7 +465,7 @@ public void notDefined(IAction action, NotDefinedException exception) { String actionDefinitionId = action.getActionDefinitionId(); - if (actionDefinitionIdisnull + if (actionDefinitionIdisnull || !applicabilityChecker.isApplicable(action)) { return; } @@ -474,7 +474,7 @@ public void notEnabled(IAction action, NotEnabledException exception) { String actionDefinitionId = action.getActionDefinitionId(); - if (actionDefinitionIdisnull + if (actionDefinitionIdisnull || !applicabilityChecker.isApplicable(action)) { return; } @@ -533,25 +533,25 @@ */ public TriggerSequence[] getActiveBindingsFor(String commandId); } - + /** * An overridable mechanism to filter certain IActions from the execution * bridge. - * + * * @since 3.4 */ public static interface IExecuteApplicable { /** * Allow the callback to filter out actions that should not fire * execution events. - * + * * @param action * The action with an actionDefinitionId * @return true if this action should be considered. */ public bool isApplicable(IAction action); } - + /** *

* A callback for executing execution events. Allows @@ -560,16 +560,16 @@ *

* Clients must not implement this interface and must not extend. *

- * + * * @since 3.4 - * + * */ public static interface IExecuteCallback { - + /** * Fires a NotEnabledException because the action was not * enabled. - * + * * @param action * The action contribution that caused the exception, * never null. @@ -581,7 +581,7 @@ /** * Fires a NotDefinedException because the action was not * defined. - * + * * @param action * The action contribution that caused the exception, * never null. @@ -589,37 +589,37 @@ * The NotDefinedException, never null. */ public void notDefined(IAction action, NotDefinedException exception); - + /** * Fires an execution event before an action is run. - * + * * @param action * The action contribution that requires an * execution event to be fired. Cannot be null. * @param e * The DWT Event, may be null. - * + * */ public void preExecute(IAction action, Event e); - + /** * Fires an execution event when the action returned a success. - * + * * @param action * The action contribution that requires an * execution event to be fired. Cannot be null. * @param returnValue * The command's result, may be null. - * + * */ public void postExecuteSuccess(IAction action, Object returnValue); - + /** * Creates an ExecutionException when the action returned * a failure. - * + * * @param action * The action contribution that caused the exception, * never null. diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/action/MenuManager.d --- a/dwtx/jface/action/MenuManager.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/action/MenuManager.d Thu May 22 04:03:58 2008 +0200 @@ -87,12 +87,12 @@ * The text for a sub-menu. */ private String menuText; - + /** * The image for a sub-menu. */ private ImageDescriptor image; - + /** * A resource manager to remember all of the images that have been used by this menu. */ @@ -160,13 +160,13 @@ /** * Creates a menu manager with the given text, image, and id. * Typically used for creating a sub-menu, where it needs to be referred to by id. - * + * * @param text the text for the menu, or null if none * @param image the image for the menu, or null if none * @param id the menu id, or null if it is to have no id * @since 3.4 */ - public MenuManager(String text, ImageDescriptor image, String id) { + public this(String text, ImageDescriptor image, String id) { listeners = new ListenerList(); this.menuText = text; this.image = image; @@ -248,12 +248,12 @@ } disposeOldImages(); - + IContributionItem[] items = getItems(); for (int i = 0; i < items.length; i++) { items[i].dispose(); } - + markDirty(); } @@ -408,14 +408,14 @@ if (shortCut is null) { return menuText; } - return menuText + "\t" + shortCut; //$NON-NLS-1$ + return menuText ~ "\t" ~ shortCut; //$NON-NLS-1$ } return menuText; } - + /** * Returns the image for this menu as an image descriptor. - * + * * @return the image, or null if this menu has no image * @since 3.4 */ @@ -567,7 +567,7 @@ // we have no way of knowing if the menu has children return true; } - + // menus aren't visible if all of its children are invisible (or only contains visible separators). IContributionItem[] childItems = getItems(); bool visibleChildren = false; @@ -658,18 +658,18 @@ public void setVisible(bool visible) { this.visible = visible; } - + /** * Sets the action definition id of this action. This simply allows the menu * item text to include a short cut if available. It can be used to * notify a user of a key combination that will open a quick menu. - * + * * @param definitionId * the command definition id * @since 3.4 */ public void setActionDefinitionId(String definitionId) { - this.definitionId = definitionId; + this.definitionId = definitionId; } /* (non-Javadoc) @@ -691,7 +691,7 @@ /** * Get all the items from the implementation's widget. - * + * * @return the menu items * @since 3.4 */ @@ -704,14 +704,14 @@ /** * Get an item from the implementation's widget. - * + * * @param index * of the item * @return the menu item * @since 3.4 */ protected Item getMenuItem(int index) { - if (menu !isnull) { + if (menu !is null) { return menu.getItem(index); } return null; @@ -719,7 +719,7 @@ /** * Get the menu item count for the implementation's widget. - * + * * @return the number of items * @since 3.4 */ @@ -735,7 +735,7 @@ * implementation's widget. The default is to use the Menu * widget.
* fill(Menu menu, int index) - * + * * @param ci * An IContributionItem whose fill() * method should be called. @@ -889,7 +889,7 @@ for (int i = 0; i < items.length; i++) { items[i].update(property); } - + if (menu !is null && !menu.isDisposed() && menu.getParentItem() !is null) { if (IAction.TEXT.equals(property)) { String text = getOverrides().getText(this); diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/action/StatusLineContributionItem.d --- a/dwtx/jface/action/StatusLineContributionItem.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/action/StatusLineContributionItem.d Thu May 22 04:03:58 2008 +0200 @@ -24,17 +24,19 @@ import dwtx.core.runtime.Assert; import dwtx.jface.util.Util; +import dwt.dwthelper.utils; + /** * A contribution item to be used with status line managers. *

* This class may be instantiated; it is not intended to be subclassed. *

- * + * * @since 3.4 */ -public class StatusLineContributionItem extends ContributionItem { +public class StatusLineContributionItem : ContributionItem { - private final static int DEFAULT_CHAR_WIDTH = 40; + private const static int DEFAULT_CHAR_WIDTH = 40; private int charWidth; @@ -55,26 +57,26 @@ /** * Creates a status line contribution item with the given id. - * + * * @param id * the contribution item's id, or null if it is to * have no id */ - public StatusLineContributionItem(String id) { + public this(String id) { this(id, DEFAULT_CHAR_WIDTH); } /** * Creates a status line contribution item with the given id that displays * the given number of characters. - * + * * @param id * the contribution item's id, or null if it is to * have no id * @param charWidth * the number of characters to display */ - public StatusLineContributionItem(String id, int charWidth) { + public this(String id, int charWidth) { super(id); this.charWidth = charWidth; setVisible(false); // no text to start with @@ -108,7 +110,7 @@ /** * An accessor for the current location of this status line contribution * item -- relative to the display. - * + * * @return The current location of this status line; null if * not yet initialized. */ @@ -122,7 +124,7 @@ /** * Retrieves the text that is being displayed in the status line. - * + * * @return the text that is currently being displayed */ public String getText() { @@ -131,7 +133,7 @@ /** * Sets the text to be displayed in the status line. - * + * * @param text * the text to be displayed, must not be null */ @@ -144,7 +146,7 @@ label.setText(this.text); } - if (this.text.length() is 0) { + if (this.text.length is 0) { if (isVisible()) { setVisible(false); IContributionManager contributionManager = getParent(); diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/action/ToolBarManager.d --- a/dwtx/jface/action/ToolBarManager.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/action/ToolBarManager.d Thu May 22 04:03:58 2008 +0200 @@ -197,21 +197,21 @@ * the new number of items */ protected void relayout(ToolBar layoutBar, int oldCount, int newCount) { - if ((oldCount !is newCount) && (newCount!is0)) { + if ((oldCount !is newCount) && (newCount!is 0)) { Point beforePack = layoutBar.getSize(); layoutBar.pack(true); Point afterPack = layoutBar.getSize(); - + // If the TB didn't change size then we're done if (beforePack.equals(afterPack)) return; - + // OK, we need to re-layout the TB layoutBar.getParent().layout(); - + // Now, if we're in a CoolBar then change the CoolItem size as well - if (layoutBar.getParent() instanceof CoolBar) { - CoolBar cb = (CoolBar) layoutBar.getParent(); + if (null !is cast(CoolBar)layoutBar.getParent() ) { + CoolBar cb = cast(CoolBar) layoutBar.getParent(); CoolItem[] items = cb.getItems(); for (int i = 0; i < items.length; i++) { if (items[i].getControl() is layoutBar) { @@ -387,11 +387,11 @@ } int newCount = toolBar.getItemCount(); - + // If we're forcing a change then ensure that we re-layout everything if (force) oldCount = newCount+1; - + relayout(toolBar, oldCount, newCount); } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/bindings/BindingManager.d --- a/dwtx/jface/bindings/BindingManager.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/bindings/BindingManager.d Thu May 22 04:03:58 2008 +0200 @@ -1219,7 +1219,7 @@ * null if there are no active bindings. * @since 3.2 */ - private final Binding[] getActiveBindingsFor1(final ParameterizedCommand command) { + private final Binding[] getActiveBindingsFor1(ParameterizedCommand command) { TriggerSequence[] triggers = getActiveBindingsFor(command); if (triggers.length is 0) { return null; @@ -1277,13 +1277,13 @@ public final TriggerSequence getBestActiveBindingFor(String commandId) { return getBestActiveBindingFor(new ParameterizedCommand(commandManager.getCommand(commandId), null)); } - + /** * @param command * @return * blah */ - public final TriggerSequence getBestActiveBindingFor(final ParameterizedCommand command) { + public final TriggerSequence getBestActiveBindingFor(ParameterizedCommand command) { final Binding[] bindings = getActiveBindingsFor1(command); if ((bindings is null) || (bindings.length is 0)) { return null; diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/dialogs/PopupDialog.d --- a/dwtx/jface/dialogs/PopupDialog.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/dialogs/PopupDialog.d Thu May 22 04:03:58 2008 +0200 @@ -106,7 +106,7 @@ /** * The dialog settings key name for remembering if the persisted bounds * should be accessed. - * + * * @deprecated Since 3.4, this is retained only for backward compatibility. */ private static final String DIALOG_USE_PERSISTED_BOUNDS = "DIALOG_USE_PERSISTED_BOUNDS"; //$NON-NLS-1$ @@ -114,7 +114,7 @@ /** * The dialog settings key name for remembering if the bounds persisted * prior to 3.4 have been migrated to the 3.4 settings. - * + * * @since 3.4 * @deprecated This is marked deprecated at its introduction to discourage * future dependency @@ -196,12 +196,12 @@ } /** - * + * * Remember bounds action for the dialog. */ - private class PersistSizeAction extends Action { + private class PersistSizeAction : Action { - PersistSizeAction() { + this() { super(JFaceResources.getString("PopupDialog.persistSize"), //$NON-NLS-1$ IAction.AS_CHECK_BOX); setChecked(persistSize); @@ -209,7 +209,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.action.IAction#run() */ public void run() { @@ -218,12 +218,12 @@ } /** - * + * * Remember location action for the dialog. */ - private class PersistLocationAction extends Action { + private class PersistLocationAction : Action { - PersistLocationAction() { + this() { super(JFaceResources.getString("PopupDialog.persistLocation"), //$NON-NLS-1$ IAction.AS_CHECK_BOX); setChecked(persistLocation); @@ -231,7 +231,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.action.IAction#run() */ public void run() { @@ -241,7 +241,7 @@ /** * Shell style appropriate for a simple hover popup that cannot get focus. - * + * */ public const static int HOVER_SHELLSTYLE = DWT.NO_FOCUS | DWT.ON_TOP | DWT.TOOL; @@ -282,20 +282,20 @@ /** * Image registry key for menu image. - * + * * @since 3.3 */ public static final String POPUP_IMG_MENU = "popup_menu_image"; //$NON-NLS-1$ /** * Image registry key for disabled menu image. - * + * * @since 3.3 */ public static final String POPUP_IMG_MENU_DISABLED = "popup_menu_image_diabled"; //$NON-NLS-1$ /** - * + * */ private static final GridLayoutFactory POPUP_LAYOUT_FACTORY; @@ -386,7 +386,7 @@ private bool persistLocation = false; /** * Flag specifying whether to use new 3.4 API instead of the old one. - * + * * @since 3.4 */ private bool isUsing34API = true; @@ -433,12 +433,12 @@ * @param infoText * Text to be shown in a lower info area, or null * if there is no info area. - * + * * @see PopupDialog#getDialogSettings() * @deprecated As of 3.4, replaced by * {@link #PopupDialog(Shell, int, bool, bool, bool, bool, bool, String, String)} */ - public PopupDialog(Shell parent, int shellStyle, bool takeFocusOnOpen, + public this(Shell parent, int shellStyle, bool takeFocusOnOpen, bool persistBounds, bool showDialogMenu, bool showPersistActions, String titleText, String infoText) { this(parent, shellStyle, takeFocusOnOpen, persistBounds, persistBounds, @@ -447,7 +447,7 @@ /** * Constructs a new instance of PopupDialog. - * + * * @param parent * The parent shell. * @param shellStyle @@ -484,12 +484,12 @@ * @param infoText * Text to be shown in a lower info area, or null * if there is no info area. - * + * * @see PopupDialog#getDialogSettings() - * + * * @since 3.4 */ - public PopupDialog(Shell parent, int shellStyle, bool takeFocusOnOpen, + public this(Shell parent, int shellStyle, bool takeFocusOnOpen, bool persistSize, bool persistLocation, bool showDialogMenu, bool showPersistActions, String titleText, String infoText) { @@ -500,7 +500,7 @@ /** * Constructs a new instance of PopupDialog. - * + * * @param parent * The parent shell. * @param shellStyle @@ -539,12 +539,12 @@ * if there is no info area. * @param use34API * true if 3.4 API should be used - * + * * @see PopupDialog#getDialogSettings() - * + * * @since 3.4 */ - private PopupDialog(Shell parent, int shellStyle, bool takeFocusOnOpen, + private this(Shell parent, int shellStyle, bool takeFocusOnOpen, bool persistSize, bool persistLocation, bool showDialogMenu, bool showPersistActions, String titleText, String infoText, bool use34API) { @@ -653,7 +653,7 @@ private void asyncClose() { // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=152010 - getShell().getDisplay().asyncExec(new Runnable() { + getShell().getDisplay().asyncExec(new class Runnable { public void run() { close(); } @@ -865,8 +865,8 @@ // Status label infoLabel = new Label(parent, DWT.RIGHT); infoLabel.setText(infoText); - - GridDataFactory.fillDefaults().grab(true, false).align(DWT.FILL, + + GridDataFactory.fillDefaults().grab(true, false).align_(DWT.FILL, DWT.BEGINNING).applyTo(infoLabel); infoLabel.setForeground(parent.getDisplay().getSystemColor( DWT.COLOR_WIDGET_DARK_SHADOW)); @@ -1036,7 +1036,7 @@ * * @return true if the dialog's bounds will be persisted, * false if it will not. - * + * * @deprecated As of 3.4, please use {@link #getPersistLocation()} or * {@link #getPersistSize()} to determine separately whether * size or location should be persisted. @@ -1050,10 +1050,10 @@ * location. This value is initially set in the dialog's constructor, but * can be modified if the persist location action is shown on the menu and * the user has changed its value. Subclasses may override this method. - * + * * @return true if the dialog's location will be persisted, * false if it will not. - * + * * @see #getPersistSize() * @since 3.4 */ @@ -1066,10 +1066,10 @@ * This value is initially set in the dialog's constructor, but can be * modified if the persist size action is shown on the menu and the user has * changed its value. Subclasses may override this method. - * + * * @return true if the dialog's size will be persisted, * false if it will not. - * + * * @see #getPersistLocation() * @since 3.4 */ @@ -1250,9 +1250,9 @@ * implementation returns the preferred size of the shell. Subclasses should * override this method when an alternate default size is desired, rather * than overriding {@link #getInitialSize()}. - * + * * @return the initial size of the shell - * + * * @see #getPersistSize() * @since 3.4 */ @@ -1267,12 +1267,12 @@ * {@link dwtx.jface.window.Window#getInitialLocation(Point)}. * Subclasses should override this method when an alternate default location * is desired, rather than overriding {@link #getInitialLocation(Point)}. - * + * * @param initialSize * the initial size of the shell, as returned by * getInitialSize. * @return the initial location of the shell - * + * * @see #getPersistLocation() * @since 3.4 */ @@ -1347,11 +1347,11 @@ /** * Get the foreground color that should be used for this popup. Subclasses * may override. - * + * * @return the foreground color to be used. Should not be null. - * + * * @since 3.4 - * + * * @see #getForegroundColorExclusions() */ protected Color getForeground() { @@ -1361,11 +1361,11 @@ /** * Get the background color that should be used for this popup. Subclasses * may override. - * + * * @return the background color to be used. Should not be null. - * + * * @since 3.4 - * + * * @see #getBackgroundColorExclusions() */ protected Color getBackground() { @@ -1374,7 +1374,7 @@ /** * Return the default foreground color used for popup dialogs. - * + * * @return the default foreground color. */ private Color getDefaultForeground() { @@ -1384,7 +1384,7 @@ /** * Return the default background color used for popup dialogs. - * + * * @return the default background color */ private Color getDefaultBackground() { @@ -1597,7 +1597,7 @@ /** * The dialog is being disposed. Dispose of any resources allocated. - * + * */ private void handleDispose() { if (infoFont !is null && !infoFont.isDisposed()) { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/dialogs/ProgressIndicator.d --- a/dwtx/jface/dialogs/ProgressIndicator.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/dialogs/ProgressIndicator.d Thu May 22 04:03:58 2008 +0200 @@ -52,21 +52,21 @@ * The widgets parent */ public this(Composite parent) { - this(parent, DWT.NONE); + this(parent, DWT.NONE); } - + /** * Create a ProgressIndicator as a child under the given parent. - * + * * @param parent * The widgets parent - * @param style the DWT style constants for progress monitors created + * @param style the DWT style constants for progress monitors created * by the receiver. * @since 3.4 */ - public ProgressIndicator(Composite parent, int style) { + public this(Composite parent, int style) { super(parent, DWT.NULL); - + // Enforce horizontal only if vertical isn't set if ((style & DWT.VERTICAL) is 0) style |= DWT.HORIZONTAL; @@ -155,7 +155,7 @@ determinateProgressBar.setState(DWT.ERROR); indeterminateProgressBar.setState(DWT.ERROR); } - + /** * Show the receiver as being paused. * @since 3.4 @@ -172,6 +172,6 @@ public void showNormal() { determinateProgressBar.setState(DWT.NORMAL); indeterminateProgressBar.setState(DWT.NORMAL); - + } } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/fieldassist/ContentProposalAdapter.d --- a/dwtx/jface/fieldassist/ContentProposalAdapter.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/fieldassist/ContentProposalAdapter.d Thu May 22 04:03:58 2008 +0200 @@ -318,8 +318,8 @@ String contents = getControlContentAdapter() .getControlContents(getControl()); // If there are no contents, changes in cursor - // position have no effect. Note also that we do - // not affect the filter text on ARROW_LEFT as + // position have no effect. Note also that we do + // not affect the filter text on ARROW_LEFT as // we would with BS. if (contents.length > 0) { asyncRecomputeProposals(filterText); @@ -511,7 +511,7 @@ } getShell().setBounds(proposedBounds); } - + /* * (non-Javadoc) * @see dwtx.jface.dialogs.PopupDialog#getForeground() @@ -520,7 +520,7 @@ return control.getDisplay(). getSystemColor(DWT.COLOR_INFO_FOREGROUND); } - + /* * (non-Javadoc) * @see dwtx.jface.dialogs.PopupDialog#getBackground() @@ -622,7 +622,7 @@ return JFaceResources.getColorRegistry().get( JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR); } - + /* * (non-Javadoc) * @see dwtx.jface.dialogs.PopupDialog#getBackground() @@ -1108,7 +1108,7 @@ /** * Indicates that a cumulative filter applies as keys are typed in the * popup. That is, each character typed will be added to the filter. - * + * * @deprecated As of 3.4, filtering that is sensitive to changes in the * control content should be performed by the supplied * {@link IContentProposalProvider}, such as that performed by @@ -1790,7 +1790,7 @@ } watchModify = false; // We don't autoactivate if the net change is no - // content. In other words, backspacing to empty + // content. In other words, backspacing to empty // should never cause a popup to open. if (!isControlContentEmpty()) { autoActivate(); @@ -1949,9 +1949,9 @@ // the popup opened. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108 // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 - if (controlContentAdapter instanceof IControlContentAdapter2 + if (null !is cast(IControlContentAdapter2)controlContentAdapter && selectionRange.x !is -1) { - ((IControlContentAdapter2) controlContentAdapter).setSelection( + (cast(IControlContentAdapter2) controlContentAdapter).setSelection( control, selectionRange); } else if (insertionPos !is -1) { controlContentAdapter.setCursorPosition(control, insertionPos); @@ -1977,8 +1977,8 @@ IControlContentAdapter adapter = getControlContentAdapter(); insertionPos = adapter.getCursorPosition(control); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063 - if (adapter instanceof IControlContentAdapter2) { - selectionRange = ((IControlContentAdapter2) adapter) + if (null !is cast(IControlContentAdapter2)adapter ) { + selectionRange = (cast(IControlContentAdapter2) adapter) .getSelection(control); } @@ -2095,7 +2095,7 @@ /** * Returns whether the content proposal popup has the focus. This includes * both the primary popup and any secondary info popup that may have focus. - * + * * @return true if the proposal popup or its secondary info * popup has the focus * @since 3.4 diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/internal/ConfigureColumnsDialog.d --- a/dwtx/jface/internal/ConfigureColumnsDialog.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/internal/ConfigureColumnsDialog.d Thu May 22 04:03:58 2008 +0200 @@ -35,11 +35,13 @@ import dwtx.jface.resource.JFaceResources; import dwtx.jface.window.IShellProvider; +import dwt.dwthelper.utils; + /** * NON-API - This class is internal and will be moved to another package in 3.5. - * + * */ -public class ConfigureColumnsDialog extends Dialog { +public class ConfigureColumnsDialog : Dialog { private Control targetControl; private ColumnObject[] columnObjects; @@ -59,7 +61,7 @@ bool moveable; bool resizable; - ColumnObject(Item column, int index, String text, Image image, + this(Item column, int index, String text, Image image, int width, bool moveable, bool resizable, bool visible) { this.column = column; this.index = index; @@ -77,11 +79,11 @@ * 3.5. Creates a new dialog for configuring columns of the given column * viewer. The column viewer must have an underlying {@link Tree} or {@link * Table}, other controls are not supported. - * + * * @param shellProvider * @param table */ - public ConfigureColumnsDialog(IShellProvider shellProvider, Table table) { + public this(IShellProvider shellProvider, Table table) { this(shellProvider, (Control) table); } @@ -90,11 +92,11 @@ * 3.5. Creates a new dialog for configuring columns of the given column * viewer. The column viewer must have an underlying {@link Tree} or {@link * Table}, other controls are not supported. - * + * * @param shellProvider * @param tree */ - public ConfigureColumnsDialog(IShellProvider shellProvider, Tree tree) { + public this(IShellProvider shellProvider, Tree tree) { this(shellProvider, (Control) tree); } @@ -102,7 +104,7 @@ * @param shellProvider * @param control */ - private ConfigureColumnsDialog(IShellProvider shellProvider, Control control) { + private this(IShellProvider shellProvider, Control control) { super(shellProvider); this.targetControl = control; this.moveableColumnsFound = createColumnObjects(); @@ -117,7 +119,7 @@ getShell().setText( JFaceResources.getString("ConfigureColumnsDialog_Title")); //$NON-NLS-1$ } - + protected void initializeBounds() { super.initializeBounds(); table.setSelection(0); @@ -152,10 +154,10 @@ * @return */ private Image getColumnImage(Item item) { - if (item instanceof TableColumn) { - return ((TableColumn) item).getImage(); - } else if (item instanceof TreeColumn) { - return ((TreeColumn) item).getImage(); + if (null !is cast(TableColumn)item ) { + return (cast(TableColumn) item).getImage(); + } else if (null !is cast(TreeColumn)item ) { + return (cast(TreeColumn) item).getImage(); } return null; } @@ -164,10 +166,10 @@ * @return */ private int[] getColumnOrder() { - if (targetControl instanceof Table) { - return ((Table) targetControl).getColumnOrder(); - } else if (targetControl instanceof Tree) { - return ((Tree) targetControl).getColumnOrder(); + if (null !is cast(Table)targetControl ) { + return (cast(Table) targetControl).getColumnOrder(); + } else if (null !is cast(Tree)targetControl ) { + return (cast(Tree) targetControl).getColumnOrder(); } return new int[0]; } @@ -177,10 +179,10 @@ * @return */ private bool getMoveable(Item item) { - if (item instanceof TableColumn) { - return ((TableColumn) item).getMoveable(); - } else if (item instanceof TreeColumn) { - return ((TreeColumn) item).getMoveable(); + if (null !is cast(TableColumn)item ) { + return (cast(TableColumn) item).getMoveable(); + } else if (null !is cast(TreeColumn)item ) { + return (cast(TreeColumn) item).getMoveable(); } return false; } @@ -190,16 +192,16 @@ * @return */ private bool getResizable(Item item) { - if (item instanceof TableColumn) { - return ((TableColumn) item).getResizable(); - } else if (item instanceof TreeColumn) { - return ((TreeColumn) item).getResizable(); + if (null !is cast(TableColumn)item ) { + return (cast(TableColumn) item).getResizable(); + } else if (null !is cast(TreeColumn)item ) { + return (cast(TreeColumn) item).getResizable(); } return false; } protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); + Composite composite = cast(Composite) super.createDialogArea(parent); table = new Table(composite, DWT.BORDER | DWT.SINGLE | DWT.V_SCROLL | DWT.H_SCROLL | DWT.FULL_SELECTION /* @@ -219,7 +221,7 @@ upButton = new Button(composite, DWT.PUSH); upButton.setText(JFaceResources .getString("ConfigureColumnsDialog_up")); //$NON-NLS-1$ - upButton.addListener(DWT.Selection, new Listener() { + upButton.addListener(DWT.Selection, new class Listener { public void handleEvent(Event event) { handleMove(table, true); } @@ -228,7 +230,7 @@ downButton = new Button(composite, DWT.PUSH); downButton.setText(JFaceResources .getString("ConfigureColumnsDialog_down")); //$NON-NLS-1$ - downButton.addListener(DWT.Selection, new Listener() { + downButton.addListener(DWT.Selection, new class Listener { public void handleEvent(Event event) { handleMove(table, false); } @@ -257,12 +259,12 @@ GridLayoutFactory.swtDefaults().numColumns(numColumns).applyTo( composite); - table.addListener(DWT.Selection, new Listener() { + table.addListener(DWT.Selection, new class Listener { public void handleEvent(Event event) { handleSelectionChanged(table.indexOf((TableItem) event.item)); } }); - text.addListener(DWT.Modify, new Listener() { + text.addListener(DWT.Modify, new class Listener { public void handleEvent(Event event) { ColumnObject columnObject = columnObjects[table .getSelectionIndex()]; @@ -303,7 +305,7 @@ handleSelectionChanged(newIndex); } - private void createLabel(final Composite composite, String string) { + private void createLabel(Composite composite, String string) { Label label = new Label(composite, DWT.NONE); label.setText(string); } @@ -314,15 +316,15 @@ */ private String getColumnName(Item item) { String result = ""; //$NON-NLS-1$ - if (item instanceof TableColumn) { - result = ((TableColumn) item).getText(); + if (null !is cast(TableColumn)item ) { + result = (cast(TableColumn) item).getText(); if (result.trim().equals("")) { //$NON-NLS-1$ result = ((TableColumn) item).getToolTipText(); } - } else if (item instanceof TreeColumn) { - result = ((TreeColumn) item).getText(); + } else if (null !is cast(TreeColumn)item ) { + result = (cast(TreeColumn) item).getText(); if (result.trim().equals("")) { //$NON-NLS-1$ - result = ((TreeColumn) item).getToolTipText(); + result = (cast(TreeColumn) item).getToolTipText(); } } return result; @@ -333,10 +335,10 @@ * @return */ private int getColumnWidth(Item item) { - if (item instanceof TableColumn) { - return ((TableColumn) item).getWidth(); - } else if (item instanceof TreeColumn) { - return ((TreeColumn) item).getWidth(); + if (null !is cast(TableColumn)item ) { + return (cast(TableColumn) item).getWidth(); + } else if (null !is cast(TreeColumn)item ) { + return (cast(TreeColumn) item).getWidth(); } return 0; } @@ -345,10 +347,10 @@ * @return */ private Item[] getViewerColumns() { - if (targetControl instanceof Table) { - return ((Table) targetControl).getColumns(); - } else if (targetControl instanceof Tree) { - return ((Tree) targetControl).getColumns(); + if (null !is cast(Table)targetControl ) { + return (cast(Table) targetControl).getColumns(); + } else if (null !is cast(Tree)targetControl ) { + return (cast(Tree) targetControl).getColumns(); } return new Item[0]; } @@ -380,10 +382,10 @@ * @param width */ private void setColumnWidth(Item item, int width) { - if (item instanceof TableColumn) { - ((TableColumn) item).setWidth(width); - } else if (item instanceof TreeColumn) { - ((TreeColumn) item).setWidth(width); + if (null !is cast(TableColumn)item ) { + (cast(TableColumn) item).setWidth(width); + } else if (null !is cast(TreeColumn)item ) { + (cast(TreeColumn) item).setWidth(width); } } @@ -391,10 +393,10 @@ * @param columnOrder */ private void setColumnOrder(int[] order) { - if (targetControl instanceof Table) { - ((Table) targetControl).setColumnOrder(order); - } else if (targetControl instanceof Tree) { - ((Tree) targetControl).setColumnOrder(order); + if (null !is cast(Table)targetControl ) { + (cast(Table) targetControl).setColumnOrder(order); + } else if (null !is cast(Tree)targetControl ) { + (cast(Tree) targetControl).setColumnOrder(order); } } } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/layout/AbstractColumnLayout.d --- a/dwtx/jface/layout/AbstractColumnLayout.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/layout/AbstractColumnLayout.d Thu May 22 04:03:58 2008 +0200 @@ -48,7 +48,7 @@ */ public abstract class AbstractColumnLayout : Layout { private static int COLUMN_TRIM; - static { + static this() { if ("win32".equals(DWT.getPlatform())) { //$NON-NLS-1$ COLUMN_TRIM = 4; } else if ("carbon".equals(DWT.getPlatform())) { //$NON-NLS-1$ diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/operation/ModalContext.d --- a/dwtx/jface/operation/ModalContext.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/operation/ModalContext.d Thu May 22 04:03:58 2008 +0200 @@ -144,9 +144,9 @@ } finally { // notify the operation of change of thread of control if ( auto tl = cast(IThreadListener)runnable ) { - auto exception = + auto exception = invokeThreadListener(tl, callingThread); - + //Forward it if we don't already have one if(exception !is null && throwable is null) throwable = exception; @@ -215,7 +215,7 @@ /** * Returns whether the first progress monitor is the same as, or a wrapper * around, the second progress monitor. - * + * * @param monitor1 * the first progress monitor * @param monitor2 @@ -249,14 +249,14 @@ *

*

* Convenience for: - * + * *

      * if (monitor.isCanceled())
      *  throw new InterruptedException();
      * 
- * + * *

- * + * * @param monitor * the progress monitor * @exception InterruptedException @@ -288,7 +288,7 @@ * ModalContext.run method is called within the dynamic scope * of another call to ModalContext.run. *

- * + * * @return the modal nesting level, or 0 if this method is * called outside the dynamic scope of any invocation of * ModalContext.run @@ -326,7 +326,7 @@ * an opportunity to transfer any thread-local state to the execution thread * before control is transferred to the new thread. *

- * + * * @param operation * the runnable to run * @param fork @@ -373,7 +373,7 @@ if ( auto tl = cast(IThreadListener)operation ) { listenerException = invokeThreadListener(tl, t); } - + if(listenerException is null){ t.start(); t.block(); @@ -420,12 +420,12 @@ /** * Invoke the ThreadListener if there are any errors or RuntimeExceptions * return them. - * + * * @param listener * @param switchingThread * the {@link Thread} being switched to */ - static Throwable invokeThreadListener(IThreadListener listener, + static Exception invokeThreadListener(IThreadListener listener, Thread switchingThread) { try { listener.threadChange(switchingThread); @@ -472,7 +472,7 @@ /** * Sets whether ModalContext is running in debug mode. - * + * * @param debugMode * true for debug mode, and false * for normal mode (the default) @@ -486,7 +486,7 @@ * Display.readAndDispatch()) while running operations. By * default, ModalContext will process events while running operations. Use * this method to disallow event processing temporarily. - * + * * @param allowReadAndDispatch * true (the default) if events may be processed * while running an operation, false if diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/preference/PreferenceDialog.d --- a/dwtx/jface/preference/PreferenceDialog.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/preference/PreferenceDialog.d Thu May 22 04:03:58 2008 +0200 @@ -877,11 +877,11 @@ (cast(IPersistentPreferenceStore) store).save(); } catch (IOException e) { String message =JFaceResources.format( - "PreferenceDialog.saveErrorMessage", new Object[] { page.getTitle(), e.getMessage() }); //$NON-NLS-1$ + "PreferenceDialog.saveErrorMessage", [ page.getTitle(), e.getMessage() ]); //$NON-NLS-1$ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), - JFaceResources.getString("PreferenceDialog.saveErrorTitle")); //$NON-NLS-1$ - + JFaceResources.getString("PreferenceDialog.saveErrorTitle")); //$NON-NLS-1$ + } } } @@ -1009,7 +1009,7 @@ Policy.getStatusHandler().show( new Status(IStatus.ERROR, Policy.JFACE, message, e), - JFaceResources.getString("Error")); //$NON-NLS-1$ + JFaceResources.getString("Error")); //$NON-NLS-1$ } }); @@ -1571,7 +1571,7 @@ }); } } - + /* * (non-Javadoc) * @see dwtx.jface.dialogs.Dialog#isResizable() diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/preference/PreferenceManager.d --- a/dwtx/jface/preference/PreferenceManager.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/preference/PreferenceManager.d Thu May 22 04:03:58 2008 +0200 @@ -41,7 +41,7 @@ * Post-order means visit the children, and then the root. */ public static const int POST_ORDER = 1; - + /** * The id of the root node. */ @@ -66,14 +66,14 @@ public this() { this('.', new PreferenceNode(ROOT_NODE_ID)); } - + /** * Creates a new preference manager with the given * path separator. - * + * * @param separatorChar */ - public PreferenceManager(final char separatorChar) { + public this(char separatorChar) { this(separatorChar, new PreferenceNode(ROOT_NODE_ID)); } @@ -82,11 +82,11 @@ * path separator and root node. * * @param separatorChar the separator character - * @param rootNode the root node. + * @param rootNode the root node. * * @since 3.4 */ - public this(final char separatorChar, PreferenceNode rootNode) { + public this(char separatorChar, PreferenceNode rootNode) { separator = [ separatorChar ]; this.root = rootNode; } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/resource/ColorRegistry.d --- a/dwtx/jface/resource/ColorRegistry.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/resource/ColorRegistry.d Thu May 22 04:03:58 2008 +0200 @@ -54,10 +54,19 @@ public class ColorRegistry : ResourceRegistry { /** - * Default color value. This is cyan (very unappetizing). + * Default color value. This is cyan (very unappetizing). * @since 3.4 */ - private static final ColorDescriptor DEFAULT_COLOR = new RGBColorDescriptor(new RGB(0, 255, 255)); + private static ColorDescriptor DEFAULT_COLOR; + private static void init_DEFAULT_COLOR () { + if( DEFAULT_COLOR is null ){ + synchronized( ColorRegistry.classinfo ){ + if( DEFAULT_COLOR is null ){ + DEFAULT_COLOR = new RGBColorDescriptor(new RGB(0, 255, 255)); + } + } + } + } /** * This registries Display. All colors will be allocated using @@ -124,6 +133,7 @@ * @since 3.1 */ public this(Display display, bool cleanOnDisplayDisposal) { + init_DEFAULT_COLOR(); staleColors = new ArraySeq!(Color); stringToColor = new HashMap!(String,Color); stringToRGB = new HashMap!(String,RGB); @@ -218,9 +228,9 @@ * name. As of 3.4 if this color is not defined then an unspecified color * is returned. Users that wish to ensure a reasonable default value should * use {@link #getColorDescriptor(String, ColorDescriptor)} instead. - * + * * @since 3.1 - * + * * @param symbolicName * @return the color descriptor associated with the given symbolic color * name or an unspecified sentinel. @@ -228,12 +238,12 @@ public ColorDescriptor getColorDescriptor(String symbolicName) { return getColorDescriptor(symbolicName, DEFAULT_COLOR); } - + /** * Returns the color descriptor associated with the given symbolic color * name. If this name does not exist within the registry the supplied * default value will be used. - * + * * @param symbolicName * @param defaultValue * @return the color descriptor associated with the given symbolic color @@ -250,7 +260,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.resource.ResourceRegistry#clearCaches() */ protected override void clearCaches() { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/resource/FileImageDescriptor.d --- a/dwtx/jface/resource/FileImageDescriptor.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/resource/FileImageDescriptor.d Thu May 22 04:03:58 2008 +0200 @@ -61,7 +61,7 @@ * Note that the file is not accessed until its getImageDate * method is called. *

- * + * * @param clazz * class for resource directory, or null * @param filename @@ -143,7 +143,7 @@ if (is_ is null) { return null; } - return new BufferedInputStream(is); + return new BufferedInputStream(is_); } @@ -172,7 +172,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.resource.ImageDescriptor#createImage(bool, * dwt.graphics.Device) */ @@ -180,7 +180,7 @@ String path = getFilePath(); if (path is null) return createDefaultImage(returnMissingImageOnError, device); - try { + try { return new Image(device, path); } catch (DWTException exception) { //if we fail try the default way using a stream @@ -190,7 +190,7 @@ /** * Return default image if returnMissingImageOnError is true. - * + * * @param device * @return Image or null */ @@ -207,13 +207,13 @@ /** * Returns the filename for the ImageData. - * + * * @return {@link String} or null if the file cannot be found */ private String getFilePath() { if (location is null) - return new Path(name).toOSString(); + return (new Path(name)).toOSString(); URL resource = location.getResource(name); diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/util/Policy.d --- a/dwtx/jface/util/Policy.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/util/Policy.d Thu May 22 04:03:58 2008 +0200 @@ -4,7 +4,7 @@ * 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 * Chris Gross (schtoo@schtoo.com) - support for ILogger added @@ -23,9 +23,11 @@ import dwtx.jface.dialogs.AnimatorFactory; import dwtx.jface.dialogs.ErrorSupportProvider; +import dwtx.jface.util.StatusHandler; import dwtx.jface.util.ILogger; import dwt.dwthelper.utils; +import dwt.dwthelper.Runnable; import tango.io.Stdout; /** @@ -121,7 +123,7 @@ /** * Sets the status handler used by JFace to handle statuses. - * + * * @param status * the handler to use, or null to use the default * one @@ -133,7 +135,7 @@ /** * Returns the status handler used by JFace to handle statuses. - * + * * @return the status handler * @since 3.4 */ @@ -145,29 +147,31 @@ } private static StatusHandler getDummyStatusHandler() { - return new StatusHandler() { + return new class StatusHandler { private SafeRunnableDialog dialog; - public void show(final IStatus status, String title) { - Runnable runnable = new Runnable() { - public void run() { - if (dialog is null || dialog.getShell().isDisposed()) { - dialog = new SafeRunnableDialog(status); - dialog.create(); - dialog.getShell().addDisposeListener( - new DisposeListener() { - public void widgetDisposed( - DisposeEvent e) { - dialog = null; - } - }); - dialog.open(); - } else { - dialog.addStatus(status); - dialog.refresh(); - } + public void show(IStatus status, String title) { + Runnable runnable = dgRunnable( (IStatus status_, SafeRunnableDialog* dialog_) { + if (*dialog_ is null || dialog_.getShell().isDisposed()) { + *dialog_ = new SafeRunnableDialog(status_); + *dialog_.create(); + *dialog_.getShell().addDisposeListener( + new class(dialog_) DisposeListener { + private SafeRunnableDialog* dialog__; + this( SafeRunnableDialog* a ){ + dialog__ = a; + } + public void widgetDisposed( + DisposeEvent e) { + *dialog__ = null; + } + }); + *dialog_.open(); + } else { + *dialog_.addStatus(status_); + *dialog_.refresh(); } - }; + }, status, &dialog); if (Display.getCurrent() !is null) { runnable.run(); } else { @@ -281,7 +285,7 @@ /** * Log the Exception to the logger. - * + * * @param exception */ public static void logException(Exception exception) { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/util/StatusHandler.d --- a/dwtx/jface/util/StatusHandler.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/util/StatusHandler.d Thu May 22 04:03:58 2008 +0200 @@ -14,6 +14,7 @@ module dwtx.jface.util.StatusHandler; import dwtx.core.runtime.IStatus; +import dwt.dwthelper.utils; /** * A mechanism to handle statuses throughout JFace. @@ -21,17 +22,17 @@ * Clients may provide their own implementation to change how statuses are * handled from within JFace. *

- * + * * @see dwtx.jface.util.Policy#getStatusHandler() * @see dwtx.jface.util.Policy#setStatusHandler(StatusHandler) - * + * * @since 3.4 */ abstract public class StatusHandler { - + /** * Show the given status. - * + * * @param status * status to handle * @param title diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/AbstractComboBoxCellEditor.d --- a/dwtx/jface/viewers/AbstractComboBoxCellEditor.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/AbstractComboBoxCellEditor.d Thu May 22 04:03:58 2008 +0200 @@ -17,34 +17,37 @@ import dwt.custom.CCombo; import dwt.widgets.Composite; +import dwt.dwthelper.Runnable; +import dwt.dwthelper.utils; + /** * Abstract base class for Cell-Editors presented as combo boxes * * @since 3.4 * */ -abstract class AbstractComboBoxCellEditor extends CellEditor { +abstract class AbstractComboBoxCellEditor : CellEditor { /** * The list is dropped down when the activation is done through the mouse */ - public static final int DROP_DOWN_ON_MOUSE_ACTIVATION = 1; + public static const int DROP_DOWN_ON_MOUSE_ACTIVATION = 1; /** * The list is dropped down when the activation is done through the keyboard */ - public static final int DROP_DOWN_ON_KEY_ACTIVATION = 1 << 1; + public static const int DROP_DOWN_ON_KEY_ACTIVATION = 1 << 1; /** * The list is dropped down when the activation is done without * ui-interaction */ - public static final int DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION = 1 << 2; + public static const int DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION = 1 << 2; /** * The list is dropped down when the activation is done by traversing from * cell to cell */ - public static final int DROP_DOWN_ON_TRAVERSE_ACTIVATION = 1 << 3; + public static const int DROP_DOWN_ON_TRAVERSE_ACTIVATION = 1 << 3; private int activationStyle = DWT.NONE; @@ -56,7 +59,7 @@ * @param style * the style used to create the combo */ - AbstractComboBoxCellEditor(Composite parent, int style) { + this(Composite parent, int style) { super(parent, style); } @@ -65,7 +68,7 @@ * Initially, the cell editor has no cell validator. * */ - AbstractComboBoxCellEditor() { + this() { } /* @@ -92,7 +95,7 @@ } if (dropDown) { - getControl().getDisplay().asyncExec(new Runnable() { + getControl().getDisplay().asyncExec(new class Runnable { public void run() { ((CCombo) getControl()).setListVisible(true); diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/AbstractTreeViewer.d --- a/dwtx/jface/viewers/AbstractTreeViewer.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/AbstractTreeViewer.d Thu May 22 04:03:58 2008 +0200 @@ -375,10 +375,10 @@ // start position. This is the insertion position relative to the // original item array. int indexInItems = 0; - + // Count of elements we have added. See bug 205700 for why this is needed. int newItems = 0; - + elementloop: for (int i = 0; i < elements.length; i++) { Object element = elements[i]; // update the index relative to the original item array @@ -1936,13 +1936,13 @@ Object parent = getParentElement(element); if (parent !is null && !equals(parent, getRoot()) - && !(parent instanceof TreePath && ((TreePath) parent) + && !((null !is cast(TreePath)parent) && (cast(TreePath) parent) .getSegmentCount() is 0)) { Widget[] parentItems = internalFindItems(parent); for (int j = 0; j < parentItems.length; j++) { Widget parentItem = parentItems[j]; - if (parentItem instanceof Item) { - updatePlus((Item) parentItem, parent); + if (null !is cast(Item)parentItem ) { + updatePlus(cast(Item) parentItem, parent); } } } @@ -1980,9 +1980,9 @@ Item[] children = getChildren(parentItem); if (children.length is 1 && children[0].getData() is null && - parentItem instanceof Item) { // dummy node + (null !is cast(Item)parentItem )) { // dummy node // Remove plus if parent element has no children - updatePlus((Item) parentItem, parent); + updatePlus(cast(Item) parentItem, parent); } else { for (int j = 0; j < children.length; j++) { Item child = children[j]; @@ -2620,7 +2620,7 @@ } Item[] items = getChildren(widget,elementChildren); - + // save the expanded elements CustomHashtable expanded = newHashtable(CustomHashtable.DEFAULT_CAPACITY); // assume // num @@ -3001,8 +3001,8 @@ createTreeItem(item, element, insertionPosition); } else { Object parentElement = parentElementOrTreePath; - if (element instanceof TreePath) - parentElement = ((TreePath) parentElement).getLastSegment(); + if (null !is cast(TreePath)element ) + parentElement = (cast(TreePath) parentElement).getLastSegment(); updatePlus(item, parentElement); } } else { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/CellEditor.d --- a/dwtx/jface/viewers/CellEditor.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/CellEditor.d Thu May 22 04:03:58 2008 +0200 @@ -17,6 +17,7 @@ import dwtx.jface.viewers.ICellEditorValidator; import dwtx.jface.viewers.ICellEditorListener; import dwtx.jface.viewers.ColumnViewerEditorActivationEvent; +import dwtx.jface.viewers.ColumnViewerEditorDeactivationEvent; import dwt.DWT; import dwt.events.KeyEvent; diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/CellLabelProvider.d --- a/dwtx/jface/viewers/CellLabelProvider.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/CellLabelProvider.d Thu May 22 04:03:58 2008 +0200 @@ -24,6 +24,7 @@ import dwtx.jface.viewers.ITableColorProvider; import dwtx.jface.viewers.ITableFontProvider; import dwtx.jface.viewers.TableColumnViewerLabelProvider; +import dwtx.jface.viewers.ViewerColumn; import dwtx.jface.viewers.WrappedViewerLabelProvider; import dwt.DWT; @@ -236,19 +237,19 @@ * {@link ViewerCell} */ public abstract void update(ViewerCell cell); - + /** * Initialize this label provider for use with the given column viewer for * the given column. Subclasses may extend but should call the super * implementation (which at this time is empty but may be changed in the * future). - * + * * @param viewer * the viewer * @param column * the column, or null if a column is not * available. - * + * * @since 3.4 */ protected void initialize(ColumnViewer viewer, ViewerColumn column) { @@ -258,17 +259,17 @@ * Dispose of this label provider which was used with the given column * viewer and column. Subclasses may extend but should call the super * implementation (which calls {@link #dispose()}). - * + * * @param viewer * the viewer * @param column * the column, or null if a column is not * available. - * + * * @since 3.4 */ public void dispose(ColumnViewer viewer, ViewerColumn column) { dispose(); } - + } diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/ColumnViewer.d --- a/dwtx/jface/viewers/ColumnViewer.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/ColumnViewer.d Thu May 22 04:03:58 2008 +0200 @@ -48,12 +48,12 @@ * (e.g., AbstractTreeViewer and AbstractTableViewer). Concrete subclasses of * {@link ColumnViewer} should implement a matching concrete subclass of {@link * ViewerColumn}. - * + * * This class is not intended to be subclassed outside of the JFace * viewers framework. - * + * * @since 3.3 - * + * */ public abstract class ColumnViewer : StructuredViewer { alias StructuredViewer.getLabelProvider getLabelProvider; @@ -94,7 +94,7 @@ /** * Hook up the editing support. Subclasses may override. - * + * * @param control * the control you want to hook on */ @@ -122,7 +122,7 @@ /** * Creates the viewer editor used for editing cell contents. To be * implemented by subclasses. - * + * * @return the editor, or null if this viewer does not support * editing cell contents. */ @@ -131,12 +131,12 @@ /** * Returns the viewer cell at the given widget-relative coordinates, or * null if there is no cell at that location - * + * * @param point * the widget-relative coordinates * @return the cell or null if no cell is found at the given * point - * + * * @since 3.4 */ public ViewerCell getCell(Point point) { @@ -150,7 +150,7 @@ /** * Returns the viewer row at the given widget-relative coordinates. - * + * * @param point * the widget-relative coordinates of the viewer row * @return ViewerRow the row or null if no row is found at the @@ -174,7 +174,7 @@ * Implementations may re-use the same instance for different row widgets; * callers can only use the viewer row locally and until the next call to * this method. - * + * * @param item * the row widget * @return ViewerRow a viewer row object @@ -186,7 +186,7 @@ /** * Returns the column widget at the given column index. - * + * * @param columnIndex * the column index * @return Widget the column widget @@ -195,7 +195,7 @@ /** * Returns the viewer column for the given column index. - * + * * @param columnIndex * the column index * @return the viewer column at the given index, or null if @@ -228,7 +228,7 @@ /** * Sets up editing support for the given column based on the "old" cell * editor API. - * + * * @param columnIndex * @param viewer */ @@ -242,7 +242,7 @@ } /* * (non-Javadoc) - * + * * @see * dwtx.jface.viewers.EditingSupport#canEdit(java.lang * .Object) @@ -260,7 +260,7 @@ /* * (non-Javadoc) - * + * * @see * dwtx.jface.viewers.EditingSupport#getCellEditor(java * .lang.Object) @@ -275,7 +275,7 @@ /* * (non-Javadoc) - * + * * @see * dwtx.jface.viewers.EditingSupport#getValue(java.lang * .Object) @@ -293,7 +293,7 @@ /* * (non-Javadoc) - * + * * @see * dwtx.jface.viewers.EditingSupport#setValue(java.lang * .Object, java.lang.Object) @@ -318,7 +318,7 @@ /** * Creates a generic viewer column for the given column widget, based on the * given label provider. - * + * * @param columnOwner * the column widget * @param labelProvider @@ -338,7 +338,7 @@ /** * Update the cached cell object with the given row and column. - * + * * @param rowItem * @param column * @return ViewerCell @@ -352,7 +352,7 @@ /** * Returns the {@link Item} at the given widget-relative coordinates, or * null if there is no item at the given coordinates. - * + * * @param point * the widget-relative coordinates * @return the {@link Item} at the coordinates or null if there @@ -362,7 +362,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.viewers.StructuredViewer#getItem(int, int) */ protected override Item getItem(int x, int y) { @@ -388,7 +388,7 @@ * may also implement {@link IColorProvider} and/or {@link IFontProvider} to * provide colors and/or fonts. *

- * + * */ public override void setLabelProvider(IBaseLabelProvider labelProvider) { Assert.isTrue( null !is cast(ITableLabelProvider)labelProvider @@ -397,14 +397,14 @@ updateColumnParts(labelProvider);// Reset the label providers in the // columns super.setLabelProvider(labelProvider); - if (labelProvider instanceof CellLabelProvider) { - ((CellLabelProvider) labelProvider).initialize(this, null); + if ( null !is cast(CellLabelProvider)labelProvider ) { + (cast(CellLabelProvider) labelProvider).initialize(this, null); } } void internalDisposeLabelProvider(IBaseLabelProvider oldProvider) { - if (oldProvider instanceof CellLabelProvider) { - ((CellLabelProvider) oldProvider).dispose(this, null); + if (null !is cast(CellLabelProvider)oldProvider ) { + (cast(CellLabelProvider) oldProvider).dispose(this, null); } else { super.internalDisposeLabelProvider(oldProvider); } @@ -426,7 +426,7 @@ /** * Cancels a currently active cell editor if one is active. All changes * already done in the cell editor are lost. - * + * * @since 3.1 (in subclasses, added in 3.3 to abstract class) */ public void cancelEditing() { @@ -437,7 +437,7 @@ /** * Apply the value of the active cell editor if one is active. - * + * * @since 3.3 */ protected void applyEditorValue() { @@ -448,7 +448,7 @@ /** * Starts editing the given element at the given column index. - * + * * @param element * the model element * @param column @@ -488,8 +488,8 @@ * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way * of editing values in a column viewer. *

- * - * + * + * * @return CellEditor[] * @since 3.1 (in subclasses, added in 3.3 to abstract class) * @see ViewerColumn#setEditingSupport(EditingSupport) @@ -502,13 +502,13 @@ /** * Returns the cell modifier of this viewer, or null if none * has been set. - * + * *

* Since 3.3, an alternative API is available, see {@link * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way * of editing values in a column viewer. *

- * + * * @return the cell modifier, or null * @since 3.1 (in subclasses, added in 3.3 to abstract class) * @see ViewerColumn#setEditingSupport(EditingSupport) @@ -522,13 +522,13 @@ * Returns the column properties of this table viewer. The properties must * correspond with the columns of the table control. They are used to * identify the column in a cell modifier. - * + * *

* Since 3.3, an alternative API is available, see {@link * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way * of editing values in a column viewer. *

- * + * * @return the list of column properties * @since 3.1 (in subclasses, added in 3.3 to abstract class) * @see ViewerColumn#setEditingSupport(EditingSupport) @@ -544,13 +544,13 @@ /** * Returns whether there is an active cell editor. - * + * *

* Since 3.3, an alternative API is available, see {@link * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way * of editing values in a column viewer. *

- * + * * @return true if there is an active cell editor, and * false otherwise * @since 3.1 (in subclasses, added in 3.3 to abstract class) @@ -595,7 +595,7 @@ /** * Sets the cell editors of this column viewer. If editing is not supported * by this viewer the call simply has no effect. - * + * *

* Since 3.3, an alternative API is available, see {@link * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way @@ -618,7 +618,7 @@ /** * Sets the cell modifier for this column viewer. This method does nothing * if editing is not supported by this viewer. - * + * *

* Since 3.3, an alternative API is available, see {@link * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way @@ -643,7 +643,7 @@ * correspond with the columns of the control. They are used to identify the * column in a cell modifier. If editing is not supported by this viewer the * call simply has no effect. - * + * *

* Since 3.3, an alternative API is available, see {@link * ViewerColumn#setEditingSupport(EditingSupport)} for a more flexible way @@ -669,9 +669,9 @@ * visually, one column of items may be visible. This occurs when the * programmer uses the column viewer like a list, adding elements but never * creating a column. - * + * * @return the number of columns - * + * * @since 3.3 */ protected abstract int doGetColumnCount(); @@ -682,12 +682,12 @@ /** * Returns the label provider associated with the column at the given index * or null if no column with this index is known. - * + * * @param columnIndex * the column index * @return the label provider associated with the column or * null if no column with this index is known - * + * * @since 3.3 */ public CellLabelProvider getLabelProvider(int columnIndex) { @@ -713,7 +713,7 @@ * enable the editor but before this event is passed to {@link * ColumnViewerEditorActivationStrategy} to see if this event should really * trigger editor activation - * + * * @param event * the activation event */ @@ -785,13 +785,13 @@ * if the viewer is busy. It is recommended that this method be used by * subclasses to determine whether the viewer is busy to return early from * state-changing methods. - * + * *

* This method is not intended to be overridden by subclasses. *

- * + * * @return true if the viewer is busy. - * + * * @since 3.4 */ protected bool checkBusy() { @@ -817,7 +817,7 @@ * Sets the busy state of this viewer. Subclasses MUST use try * ...finally as follows to ensure that the busy flag is reset * to its original value: - * + * *
      * bool oldBusy = isBusy();
      * setBusy(true);
@@ -827,14 +827,14 @@
      *  setBusy(oldBusy);
      * }
      * 
- * + * *

* This method is not intended to be overridden by subclasses. *

- * + * * @param busy * the new value of the busy flag - * + * * @since 3.4 */ protected void setBusy(bool busy) { @@ -850,13 +850,13 @@ * method if they can ensure by other means that they will not make * reentrant calls to methods like the ones listed above. See bug 184991 for * background discussion. - * + * *

* This method is not intended to be overridden by subclasses. *

- * + * * @return Returns whether this viewer is busy. - * + * * @since 3.4 */ public bool isBusy() { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/ColumnViewerEditor.d --- a/dwtx/jface/viewers/ColumnViewerEditor.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/ColumnViewerEditor.d Thu May 22 04:03:58 2008 +0200 @@ -73,7 +73,7 @@ private ColumnViewerEditorActivationStrategy editorActivationStrategy; private bool inEditorDeactivation; - + private DisposeListener disposeListener; /** @@ -152,7 +152,7 @@ cancelEditing(); } } - + }; initCellEditorListener(); } @@ -174,7 +174,7 @@ }; } - private bool activateCellEditor(final ColumnViewerEditorActivationEvent activationEvent) { + private bool activateCellEditor(ColumnViewerEditorActivationEvent activationEvent) { ViewerColumn part = viewer.getViewerColumn(cell.getColumnIndex()); Object element = cell.getElement(); @@ -238,15 +238,17 @@ control.addFocusListener(focusListener); } - mouseListener = new class(control) MouseAdapter { + mouseListener = new class(control, activationEvent) MouseAdapter { Control control_; - this(Control a){ + ColumnViewerEditorActivationEvent activationEvent_; + this(Control a, ColumnViewerEditorActivationEvent b){ control_=a; + activationEvent_=b; } public void mouseDown(MouseEvent e) { // time wrap? // check for expiration of doubleClickTime - if (shouldFireDoubleClick(activationTime, e.time, activationEvent) && e.button is 1) { + if (shouldFireDoubleClick(activationTime, e.time, activationEvent_) && e.button is 1) { control_.removeMouseListener(mouseListener); cancelEditing(); handleDoubleClickEvent(); @@ -284,7 +286,7 @@ .afterEditorActivated(activationEvent); } } - + this.cell.getItem().addDisposeListener(disposeListener); return true; @@ -363,7 +365,7 @@ .afterEditorDeactivated(tmp); } } - + if( ! this.cell.getItem().isDisposed() ) { this.cell.getItem().removeDisposeListener(disposeListener); } @@ -432,11 +434,11 @@ .afterEditorDeactivated(tmp); } } - + if( ! this.cell.getItem().isDisposed() ) { this.cell.getItem().addDisposeListener(disposeListener); } - + this.cellEditor = null; this.cell = null; diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/ComboBoxViewerCellEditor.d --- a/dwtx/jface/viewers/ComboBoxViewerCellEditor.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/ComboBoxViewerCellEditor.d Thu May 22 04:03:58 2008 +0200 @@ -32,12 +32,14 @@ import dwt.widgets.Control; import dwtx.core.runtime.Assert; +import dwt.dwthelper.utils; + /** * A cell editor that presents a list of items in a combo box. In contrast to * {@link ComboBoxCellEditor} it wraps the underlying {@link CCombo} using a * {@link ComboViewer} */ -public class ComboBoxViewerCellEditor extends AbstractComboBoxCellEditor { +public class ComboBoxViewerCellEditor : AbstractComboBoxCellEditor { /** * The custom combo box control. @@ -49,7 +51,7 @@ /** * Default ComboBoxCellEditor style */ - private static final int defaultStyle = DWT.NONE; + private static const int defaultStyle = DWT.NONE; /** * Creates a new cell editor with a combo viewer and a default style @@ -57,7 +59,7 @@ * @param parent * the parent control */ - public ComboBoxViewerCellEditor(Composite parent) { + public this(Composite parent) { this(parent, defaultStyle); } @@ -69,7 +71,7 @@ * @param style * the style bits */ - public ComboBoxViewerCellEditor(Composite parent, int style) { + public this(Composite parent, int style) { super(parent, style); setValueValid(true); } @@ -83,14 +85,14 @@ comboBox.setFont(parent.getFont()); viewer = new ComboViewer(comboBox); - comboBox.addKeyListener(new KeyAdapter() { + comboBox.addKeyListener(new class KeyAdapter { // hook key pressed - see PR 14201 public void keyPressed(KeyEvent e) { keyReleaseOccured(e); } }); - comboBox.addSelectionListener(new SelectionAdapter() { + comboBox.addSelectionListener(new class SelectionAdapter { public void widgetDefaultSelected(SelectionEvent event) { applyEditorValueAndDeactivate(); } @@ -106,7 +108,7 @@ } }); - comboBox.addTraverseListener(new TraverseListener() { + comboBox.addTraverseListener(new class TraverseListener { public void keyTraversed(TraverseEvent e) { if (e.detail is DWT.TRAVERSE_ESCAPE || e.detail is DWT.TRAVERSE_RETURN) { @@ -115,9 +117,9 @@ } }); - comboBox.addFocusListener(new FocusAdapter() { + comboBox.addFocusListener(new class FocusAdapter { public void focusLost(FocusEvent e) { - ComboBoxViewerCellEditor.this.focusLost(); + this.outer.focusLost(); } }); return comboBox; @@ -234,7 +236,7 @@ if (!isValid) { MessageFormat.format(getErrorMessage(), - new Object[] { selectedValue }); + [ selectedValue ]); } fireApplyEditorValue(); diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/DecoratingStyledCellLabelProvider.d --- a/dwtx/jface/viewers/DecoratingStyledCellLabelProvider.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/DecoratingStyledCellLabelProvider.d Thu May 22 04:03:58 2008 +0200 @@ -12,6 +12,7 @@ *******************************************************************************/ module dwtx.jface.viewers.DecoratingStyledCellLabelProvider; +import dwtx.jface.viewers.DelegatingStyledCellLabelProvider; import dwt.graphics.Color; import dwt.graphics.Font; @@ -25,12 +26,12 @@ * {@link DelegatingStyledCellLabelProvider.IStyledLabelProvider} to compute * styled text label and image and takes a {@link ILabelDecorator} to decorate * the label. - * + * *

* Use this label provider as a replacement for the * {@link DecoratingLabelProvider} when decorating styled text labels. *

- * + * *

* The {@link DecoratingStyledCellLabelProvider} will try to evaluate the text * decoration added by the {@link ILabelDecorator} and will apply the style @@ -41,10 +42,10 @@ * and {@link IFontDecorator} to provide foreground and background color and * font decoration. *

- * + * * @since 3.4 */ -public class DecoratingStyledCellLabelProvider extends +public class DecoratingStyledCellLabelProvider : DelegatingStyledCellLabelProvider { private ILabelDecorator decorator; @@ -55,7 +56,7 @@ * Creates a {@link DecoratingStyledCellLabelProvider} that delegates the * requests for styled labels and for images to a * {@link DelegatingStyledCellLabelProvider.IStyledLabelProvider}. - * + * * @param labelProvider * the styled label provider * @param decorator @@ -66,7 +67,7 @@ * decorator is configured or the default decorator should be * used */ - public DecoratingStyledCellLabelProvider( + public this( IStyledLabelProvider labelProvider, ILabelDecorator decorator, IDecorationContext decorationContext) { super(labelProvider); @@ -74,8 +75,8 @@ this.decorator = decorator; this.decorationContext = decorationContext !is null ? decorationContext : DecorationContext.DEFAULT_CONTEXT; - - this.labelProviderListener = new ILabelProviderListener() { + + this.labelProviderListener = new class ILabelProviderListener { public void labelProviderChanged(LabelProviderChangedEvent event) { fireLabelProviderChanged(event); } @@ -89,7 +90,7 @@ * Returns the decoration context associated with this label provider. It * will be passed to the decorator if the decorator is an instance of * {@link LabelDecorator}. - * + * * @return the decoration context associated with this label provider */ public IDecorationContext getDecorationContext() { @@ -99,7 +100,7 @@ /** * Set the decoration context that will be based to the decorator for this * label provider if that decorator implements {@link LabelDecorator}. - * + * * @param decorationContext * the decoration context. */ @@ -116,11 +117,11 @@ String oldText = cell.getText(); bool isDecorationPending = false; - if (this.decorator instanceof LabelDecorator) { - isDecorationPending = !((LabelDecorator) this.decorator) + if (null !is (LabelDecorator)this.decorator ) { + isDecorationPending = !(cast(LabelDecorator) this.decorator) .prepareDecoration(element, oldText, getDecorationContext()); - } else if (this.decorator instanceof IDelayedLabelDecorator) { - isDecorationPending = !((IDelayedLabelDecorator) this.decorator) + } else if (null !is (IDelayedLabelDecorator)this.decorator ) { + isDecorationPending = !(cast(IDelayedLabelDecorator) this.decorator) .prepareDecoration(element, oldText); } if (isDecorationPending && oldText.length() is 0) { @@ -138,8 +139,8 @@ } public Color getForeground(Object element) { - if (this.decorator instanceof IColorDecorator) { - Color foreground = ((IColorDecorator) this.decorator) + if (null !is cast(IColorDecorator)this.decorator ) { + Color foreground = (cast(IColorDecorator) this.decorator) .decorateForeground(element); if (foreground !is null) return foreground; @@ -148,8 +149,8 @@ } public Color getBackground(Object element) { - if (this.decorator instanceof IColorDecorator) { - Color color = ((IColorDecorator) this.decorator) + if (null !is cast(IColorDecorator)this.decorator ) { + Color color = (cast(IColorDecorator) this.decorator) .decorateBackground(element); if (color !is null) return color; @@ -158,8 +159,8 @@ } public Font getFont(Object element) { - if (this.decorator instanceof IFontDecorator) { - Font font = ((IFontDecorator) this.decorator).decorateFont(element); + if (null !is cast(IFontDecorator)this.decorator ) { + Font font = (cast(IFontDecorator) this.decorator).decorateFont(element); if (font !is null) return font; } @@ -172,8 +173,8 @@ return image; } Image decorated = null; - if (this.decorator instanceof LabelDecorator) { - decorated = ((LabelDecorator) this.decorator).decorateImage(image, + if (null !is cast(LabelDecorator)this.decorator ) { + decorated = (cast(LabelDecorator) this.decorator).decorateImage(image, element, getDecorationContext()); } else { decorated = this.decorator.decorateImage(image, element); @@ -186,7 +187,7 @@ /** * Returns the styled text for the label of the given element. - * + * * @param element * the element for which to provide the styled label text * @return the styled text string used to label the element @@ -199,8 +200,8 @@ String label = styledString.getString(); String decorated; - if (this.decorator instanceof LabelDecorator) { - decorated = ((LabelDecorator) this.decorator).decorateText(label, + if (null !is cast(LabelDecorator)this.decorator ) { + decorated = (cast(LabelDecorator) this.decorator).decorateText(label, element, getDecorationContext()); } else { decorated = this.decorator.decorateText(label, element); @@ -238,13 +239,13 @@ * decorations. By default the * {@link StyledString#DECORATIONS_STYLER decoration style}. Clients * can override. - * + * * Note that it is the client's responsibility to react on color changes of * the decoration color by refreshing the view - * + * * @param element * the element that has been decorated - * + * * @return return the decoration style */ protected Styler getDecorationStyle(Object element) { @@ -253,7 +254,7 @@ /** * Returns the decorator or null if no decorator is installed - * + * * @return the decorator or null if no decorator is installed */ public ILabelDecorator getLabelDecorator() { @@ -266,7 +267,7 @@ * decorator is not disposed. Fires a label provider changed event * indicating that all labels should be updated. Has no effect if the given * decorator is identical to the current one. - * + * * @param newDecorator * the label decorator, or null if no decorations * are to be applied diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/DelegatingStyledCellLabelProvider.d --- a/dwtx/jface/viewers/DelegatingStyledCellLabelProvider.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/DelegatingStyledCellLabelProvider.d Thu May 22 04:03:58 2008 +0200 @@ -16,27 +16,29 @@ import dwt.graphics.Font; import dwt.graphics.Image; +import dwt.dwthelper.utils; + /** * A {@link DelegatingStyledCellLabelProvider} is a * {@link StyledCellLabelProvider} that delegates requests for the styled string * and the image to a * {@link DelegatingStyledCellLabelProvider.IStyledLabelProvider}. - * + * *

* Existing label providers can be enhanced by implementing * {@link DelegatingStyledCellLabelProvider.IStyledLabelProvider} so they can be * used in viewers with styled labels. *

- * + * *

* The {@link DelegatingStyledCellLabelProvider.IStyledLabelProvider} can * optionally implement {@link IColorProvider} and {@link IFontProvider} to * provide foreground and background color and a default font. *

- * + * * @since 3.4 */ -public class DelegatingStyledCellLabelProvider extends StyledCellLabelProvider { +public class DelegatingStyledCellLabelProvider : StyledCellLabelProvider { /** * Interface marking a label provider that provides styled text labels and @@ -47,14 +49,14 @@ * provide foreground and background color and a default font. *

*/ - public static interface IStyledLabelProvider extends IBaseLabelProvider { + public static interface IStyledLabelProvider : IBaseLabelProvider { /** * Returns the styled text label for the given element - * + * * @param element * the element to evaluate the styled string for - * + * * @return the styled string. */ public StyledString getStyledText(Object element); @@ -63,7 +65,7 @@ * Returns the image for the label of the given element. The image is * owned by the label provider and must not be disposed directly. * Instead, dispose the label provider when no longer needed. - * + * * @param element * the element for which to provide the label image * @return the image used to label the element, or null @@ -78,12 +80,12 @@ * Creates a {@link DelegatingStyledCellLabelProvider} that delegates the * requests for the styled labels and the images to a * {@link IStyledLabelProvider}. - * + * * @param labelProvider * the label provider that provides the styled labels and the * images */ - public DelegatingStyledCellLabelProvider(IStyledLabelProvider labelProvider) { + public this(IStyledLabelProvider labelProvider) { if (labelProvider is null) throw new IllegalArgumentException( "Label provider must not be null"); //$NON-NLS-1$ @@ -93,7 +95,7 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.viewers.StyledCellLabelProvider#update(dwtx.jface.viewers.ViewerCell) */ public void update(ViewerCell cell) { @@ -117,15 +119,15 @@ /** * Provides a foreground color for the given element. - * + * * @param element * the element * @return the foreground color for the element, or null to * use the default foreground color */ public Color getForeground(Object element) { - if (this.styledLabelProvider instanceof IColorProvider) { - return ((IColorProvider) this.styledLabelProvider) + if (null !is cast(IColorProvider)this.styledLabelProvider ) { + return (cast(IColorProvider) this.styledLabelProvider) .getForeground(element); } return null; @@ -133,15 +135,15 @@ /** * Provides a background color for the given element. - * + * * @param element * the element * @return the background color for the element, or null to * use the default background color */ public Color getBackground(Object element) { - if (this.styledLabelProvider instanceof IColorProvider) { - return ((IColorProvider) this.styledLabelProvider) + if (null !is cast(IColorProvider)this.styledLabelProvider) { + return (cast(IColorProvider) this.styledLabelProvider) .getBackground(element); } return null; @@ -149,15 +151,15 @@ /** * Provides a font for the given element. - * + * * @param element * the element * @return the font for the element, or null to use the * default font */ public Font getFont(Object element) { - if (this.styledLabelProvider instanceof IFontProvider) { - return ((IFontProvider) this.styledLabelProvider).getFont(element); + if (null !is cast(IFontProvider)this.styledLabelProvider ) { + return (cast(IFontProvider) this.styledLabelProvider).getFont(element); } return null; } @@ -166,7 +168,7 @@ * Returns the image for the label of the given element. The image is owned * by the label provider and must not be disposed directly. Instead, dispose * the label provider when no longer needed. - * + * * @param element * the element for which to provide the label image * @return the image used to label the element, or null if @@ -178,7 +180,7 @@ /** * Returns the styled text for the label of the given element. - * + * * @param element * the element for which to provide the styled label text * @return the styled text string used to label the element @@ -189,7 +191,7 @@ /** * Returns the styled string provider. - * + * * @return the wrapped label provider */ public IStyledLabelProvider getStyledStringProvider() { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/StructuredSelection.d --- a/dwtx/jface/viewers/StructuredSelection.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/StructuredSelection.d Thu May 22 04:03:58 2008 +0200 @@ -13,9 +13,8 @@ module dwtx.jface.viewers.StructuredSelection; import dwtx.jface.viewers.IStructuredSelection; +import dwtx.jface.viewers.IElementComparer; -// import java.util.Arrays; -// import java.util.Iterator; import tango.util.collection.ArraySeq; import tango.util.collection.model.Seq; import tango.util.collection.model.SeqView; @@ -95,15 +94,15 @@ * Creates a structured selection from the given List and * element comparer. If an element comparer is provided, it will be used to * determine equality between structured selection objects provided that - * they both are based on the same (identical) comparer. See bug - * + * they both are based on the same (identical) comparer. See bug + * * @param elements * list of selected elements * @param comparer * the comparer, or null * @since 3.4 */ - public StructuredSelection(List elements, IElementComparer comparer) { + public this(Seq!(Object) elements, IElementComparer comparer) { this.elements = elements.toArray(); this.comparer = comparer; } @@ -135,7 +134,7 @@ } bool useComparer = comparer !is null && comparer is s2.comparer; - + //size int myLen = elements.length; if (myLen !is s2.elements.length) { diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/StyledCellLabelProvider.d --- a/dwtx/jface/viewers/StyledCellLabelProvider.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/StyledCellLabelProvider.d Thu May 22 04:03:58 2008 +0200 @@ -25,6 +25,8 @@ import dwt.widgets.Event; import dwtx.core.runtime.Assert; +import dwt.dwthelper.utils; + /** * A {@link StyledCellLabelProvider} supports styled labels by using owner * draw. @@ -45,37 +47,37 @@ * {@link StyleRange}. Different fonts would make labels wider, and the native * selection drawing could not be reused. *

- * + * *

NOTE: This API is experimental and may be deleted or * changed before 3.4 is released.

- * + * * @since 3.4 */ -public abstract class StyledCellLabelProvider extends OwnerDrawLabelProvider { +public abstract class StyledCellLabelProvider : OwnerDrawLabelProvider { /** * Style constant for indicating that the styled colors are to be applied * even it the viewer's item is selected. Default is not to apply colors. */ - public static final int COLORS_ON_SELECTION = 1 << 0; + public static const int COLORS_ON_SELECTION = 1 << 0; /** * Style constant for indicating to draw the focus if requested by the owner * draw event. Default is to draw the focus. */ - public static final int NO_FOCUS = 1 << 1; - + public static const int NO_FOCUS = 1 << 1; + /** * Private constant to indicate if owner draw is enabled for the * label provider's column. */ - private static final int OWNER_DRAW_ENABLED = 1 << 4; + private static const int OWNER_DRAW_ENABLED = 1 << 4; private int style; // reused text layout private TextLayout cachedTextLayout; - + private ColumnViewer viewer; private ViewerColumn column; @@ -83,35 +85,35 @@ * Creates a new StyledCellLabelProvider. By default, owner draw is enabled, focus is drawn and no * colors are painted on selected elements. */ - public StyledCellLabelProvider() { + public this() { this(0); } /** * Creates a new StyledCellLabelProvider. By default, owner draw is enabled. - * + * * @param style * the style bits * @see StyledCellLabelProvider#COLORS_ON_SELECTION * @see StyledCellLabelProvider#NO_FOCUS */ - public StyledCellLabelProvider(int style) { + public this(int style) { this.style = style & (COLORS_ON_SELECTION | NO_FOCUS) | OWNER_DRAW_ENABLED; } - + /** * Returns true is the owner draw rendering is enabled for this label provider. * By default owner draw rendering is enabled. If owner draw rendering is disabled, rending is * done by the viewer and no styled ranges (see {@link ViewerCell#getStyleRanges()}) * are drawn. - * + * * @return true is the rendering of styles is enabled. */ public bool isOwnerDrawEnabled() { return (this.style & OWNER_DRAW_ENABLED) !is 0; } - + /** * Specifies whether owner draw rendering is enabled for this label * provider. By default owner draw rendering is enabled. If owner draw @@ -120,7 +122,7 @@ * It is the caller's responsibility to also call * {@link StructuredViewer#refresh()} or similar methods to update the * underlying widget. - * + * * @param enabled * specifies if owner draw rendering is enabled */ @@ -137,43 +139,43 @@ } } } - + /** * Returns the viewer on which this label provider is installed on or null if the * label provider is not installed. - * + * * @return the viewer on which this label provider is installed on or null if the * label provider is not installed. */ protected final ColumnViewer getViewer() { return this.viewer; } - + /** * Returns the column on which this label provider is installed on or null if the * label provider is not installed. - * + * * @return the column on which this label provider is installed on or null if the * label provider is not installed. */ protected final ViewerColumn getColumn() { return this.column; } - + /* (non-Javadoc) * @see dwtx.jface.viewers.OwnerDrawLabelProvider#initialize(dwtx.jface.viewers.ColumnViewer, dwtx.jface.viewers.ViewerColumn) */ public void initialize(ColumnViewer viewer, ViewerColumn column) { Assert.isTrue(this.viewer is null && this.column is null, "Label provider instance already in use"); //$NON-NLS-1$ - + this.viewer= viewer; this.column= column; super.initialize(viewer, column, isOwnerDrawEnabled()); } - + /* * (non-Javadoc) - * + * * @see dwtx.jface.viewers.BaseLabelProvider#dispose() */ public void dispose() { @@ -181,16 +183,16 @@ cachedTextLayout.dispose(); cachedTextLayout = null; } - + this.viewer= null; this.column= null; - + super.dispose(); } /* * (non-Javadoc) - * + * * @see dwtx.jface.viewers.OwnerDrawLabelProvider#update(dwtx.jface.viewers.ViewerCell) */ public void update(ViewerCell cell) { @@ -224,7 +226,7 @@ * configured with the style ranges. The text layout instance is managed by * the label provider. Caller of the method must not dispose the text * layout. - * + * * @param diplay * the current display * @param applyColors @@ -235,10 +237,10 @@ */ private TextLayout getTextLayoutForInfo(Display display, ViewerCell cell, bool applyColors) { TextLayout layout = getSharedTextLayout(display); - + layout.setText(cell.getText()); layout.setFont(cell.getFont()); // set also if null to clear previous usages - + StyleRange[] styleRanges = cell.getStyleRanges(); if (styleRanges !is null) { // user didn't fill styled ranges for (int i = 0; i < styleRanges.length; i++) { @@ -249,13 +251,13 @@ return layout; } - + /** * Prepares the given style range before it is applied to the label. This method makes sure that * no colors are drawn when the element is selected. * The current version of the {@link StyledCellLabelProvider} will also ignore all font settings on the * style range. Clients can override. - * + * * @param styleRange * the style range to prepare. the style range element must not be modified * @param applyColors @@ -282,11 +284,11 @@ ViewerRow row= viewer.getViewerRowFromItem(event.item); return new ViewerCell(row, event.index, element); } - + /** * Handle the erase event. The default implementation does nothing to ensure * keep native selection highlighting working. - * + * * @param event * the erase event * @param element @@ -303,24 +305,24 @@ /* * (non-Javadoc) - * + * * @see dwtx.jface.viewers.OwnerDrawLabelProvider#measure(dwt.widgets.Event, * java.lang.Object) */ protected void measure(Event event, Object element) { // use native measuring } - + /* * (non-Javadoc) - * + * * @see dwtx.jface.viewers.OwnerDrawLabelProvider#paint(dwt.widgets.Event, * java.lang.Object) */ protected void paint(Event event, Object element) { if (!isOwnerDrawEnabled()) return; - + ViewerCell cell= getViewerCell(event, element); bool applyColors = useColors(event); @@ -328,13 +330,13 @@ // remember colors to restore the GC later Color oldForeground = gc.getForeground(); Color oldBackground = gc.getBackground(); - + if (applyColors) { Color foreground= cell.getForeground(); if (foreground !is null) { gc.setForeground(foreground); } - + Color background= cell.getBackground(); if (background !is null) { gc.setBackground(background); @@ -346,7 +348,7 @@ Rectangle imageBounds = cell.getImageBounds(); if (imageBounds !is null) { Rectangle bounds = image.getBounds(); - + // center the image in the given space int x = imageBounds.x + Math.max(0, (imageBounds.width - bounds.width) / 2); @@ -361,11 +363,11 @@ Rectangle textBounds = cell.getTextBounds(); if (textBounds !is null) { Rectangle layoutBounds = textLayout.getBounds(); - + int x = textBounds.x; int y = textBounds.y + Math.max(0, (textBounds.height - layoutBounds.height) / 2); - + textLayout.draw(gc, x, y); } @@ -374,7 +376,7 @@ gc.drawFocus(focusBounds.x, focusBounds.y, focusBounds.width, focusBounds.height); } - + if (applyColors) { gc.setForeground(oldForeground); gc.setBackground(oldBackground); diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/StyledString.d --- a/dwtx/jface/viewers/StyledString.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/StyledString.d Thu May 22 04:03:58 2008 +0200 @@ -12,30 +12,30 @@ *******************************************************************************/ module dwtx.jface.viewers.StyledString; -import java.util.ArrayList; -import java.util.List; - import dwt.custom.StyleRange; import dwt.graphics.TextStyle; import dwtx.jface.preference.JFacePreferences; import dwtx.jface.resource.ColorRegistry; import dwtx.jface.resource.JFaceResources; +import dwt.dwthelper.utils; +import tango.text.convert.Format; + /** * A mutable string with styled ranges. All ranges mark substrings of the string * and do not overlap. Styles are applied using instances of {@link Styler} to * compute the result of {@link #getStyleRanges()}. - * + * * The styled string can be built in the following two ways: * - * + * *

* This class may be instantiated; it is not intended to be subclassed. *

- * + * * @since 3.4 */ public class StyledString { @@ -43,13 +43,13 @@ /** * A styler will be asked to apply its styles to one ore more ranges in the * {@link StyledString}. - * + * */ public static abstract class Styler { /** * Applies the styles represented by this object to the given textStyle. - * + * * @param textStyle * the {@link TextStyle} to modify */ @@ -83,12 +83,12 @@ /** * Creates a styler that takes the given foreground and background colors * from the JFace color registry. - * + * * @param foregroundColorName * the color name for the foreground color * @param backgroundColorName * the color name for the background color - * + * * @return the created style */ public static Styler createColorRegistryStyler(String foregroundColorName, @@ -103,7 +103,7 @@ /** * Creates an empty {@link StyledString}. */ - public StyledString() { + public this() { fBuffer = new StringBuffer(); fStyleRuns = null; } @@ -111,50 +111,50 @@ /** * Creates an {@link StyledString} initialized with a string without * a style associated. - * + * * @param string * the string */ - public StyledString(String string) { + public this(String string) { this(string, null); } /** * Creates an {@link StyledString} initialized with a string and a * style. - * + * * @param string * the string * @param styler * the styler for the string or null to not * associated a styler. */ - public StyledString(String string, Styler styler) { + public this(String string, Styler styler) { this(); append(string, styler); } /** * Returns the string of this {@link StyledString}. - * + * * @return the current string of this {@link StyledString}. */ public String getString() { return fBuffer.toString(); } - + /** * Returns the string of this {@link StyledString}. - * + * * @return the current string of this {@link StyledString}. */ - public String toString() { + public override String toString() { return getString(); } /** * Returns the length of the string of this {@link StyledString}. - * + * * @return the length of the current string */ public int length() { @@ -164,7 +164,7 @@ /** * Appends a string to the {@link StyledString}. The appended string * will have no associated styler. - * + * * @param string * the string to append * @return returns a reference to this object @@ -172,12 +172,12 @@ public StyledString append(String string) { return append(string, null); } - + /** * Appends the string representation of the given character array * to the {@link StyledString}. The appended * character array will have no associated styler. - * + * * @param chars * the character array to append * @return returns a reference to this object @@ -190,7 +190,7 @@ * Appends the string representation of the given character * to the {@link StyledString}. The appended * character will have no associated styler. - * + * * @param ch * the character to append * @return returns a reference to this object @@ -201,7 +201,7 @@ /** * Appends a string with styles to the {@link StyledString}. - * + * * @param string * the string to append * @return returns a reference to this object @@ -236,7 +236,7 @@ * Appends the string representation of the given character * with a style to the {@link StyledString}. The * appended character will have the given style associated. - * + * * @param ch * the character to append * @param styler @@ -252,7 +252,7 @@ /** * Appends a string with a style to the {@link StyledString}. The * appended string will be styled using the given styler. - * + * * @param string * the string to append * @param styler @@ -270,12 +270,12 @@ appendStyleRun(styler, offset); return this; } - + /** * Appends the string representation of the given character array * with a style to the {@link StyledString}. The * appended character array will be styled using the given styler. - * + * * @param chars * the character array to append * @param styler @@ -298,14 +298,14 @@ * Sets a styler to use for the given source range. The range must be * subrange of actual string of this {@link StyledString}. Stylers * previously set for that range will be overwritten. - * + * * @param offset * the start offset of the range * @param length * the length of the range * @param styler * the styler to set - * + * * @throws StringIndexOutOfBoundsException * if start is less than zero, or if offset plus * length is greater than the length of this object. @@ -365,7 +365,7 @@ /** * Returns an array of {@link StyleRange} resulting from applying all * associated stylers for this string builder. - * + * * @return an array of all {@link StyleRange} resulting from applying the * stored stylers to this string. */ @@ -461,20 +461,20 @@ public int offset; public Styler style; - public StyleRun(int offset, Styler style) { + public this(int offset, Styler style) { this.offset = offset; this.style = style; } - public String toString() { - return "Offset " + offset + ", style: " + style; //$NON-NLS-1$//$NON-NLS-2$ + public override String toString() { + return Format("Offset {}, style: {}", offset, style ); //$NON-NLS-1$//$NON-NLS-2$ } } - private static class StyleRunList extends ArrayList { + private static class StyleRunList : ArrayList { private static final long serialVersionUID = 123L; - public StyleRunList() { + public this() { super(3); } @@ -487,11 +487,11 @@ } } - private static class DefaultStyler extends Styler { + private static class DefaultStyler : Styler { private final String fForegroundColorName; private final String fBackgroundColorName; - public DefaultStyler(String foregroundColorName, + public this(String foregroundColorName, String backgroundColorName) { fForegroundColorName = foregroundColorName; fBackgroundColorName = backgroundColorName; diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/TableLayout.d --- a/dwtx/jface/viewers/TableLayout.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/TableLayout.d Thu May 22 04:03:58 2008 +0200 @@ -51,7 +51,7 @@ */ private static int COLUMN_TRIM; - static { + static this() { if ("win32".equals(DWT.getPlatform())) { //$NON-NLS-1$ COLUMN_TRIM = 4; } else if ("carbon".equals(DWT.getPlatform())) { //$NON-NLS-1$ diff -r 46a6e0e6ccd4 -r 4878bef4a38e dwtx/jface/viewers/TableViewerFocusCellManager.d --- a/dwtx/jface/viewers/TableViewerFocusCellManager.d Thu May 22 01:36:46 2008 +0200 +++ b/dwtx/jface/viewers/TableViewerFocusCellManager.d Thu May 22 04:03:58 2008 +0200 @@ -36,6 +36,9 @@ public class TableViewerFocusCellManager : SWTFocusCellManager { private static const CellNavigationStrategy TABLE_NAVIGATE; static this(){ + TABLE_NAVIGATE = new CellNavigationStrategy(); + } + /** * Create a new manager with a default navigation strategy: *