Mercurial > projects > dwt-addons
diff dwtx/jface/action/ExternalActionManager.d @ 71:4878bef4a38e
Some fixing
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 22 May 2008 04:03:58 +0200 |
parents | 46a6e0e6ccd4 |
children | 5df4896124c7 |
line wrap: on
line diff
--- 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 <code>CommandCallback</code> with the * workbench it should be using. - * + * * @param bindingManager * The binding manager which will provide the callback; must * not be <code>null</code>. @@ -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); } - + /** * <p> * A callback for executing execution events. Allows @@ -560,16 +560,16 @@ * <p> * Clients must not implement this interface and must not extend. * </p> - * + * * @since 3.4 - * + * */ public static interface IExecuteCallback { - + /** * Fires a <code>NotEnabledException</code> because the action was not * enabled. - * + * * @param action * The action contribution that caused the exception, * never <code>null</code>. @@ -581,7 +581,7 @@ /** * Fires a <code>NotDefinedException</code> because the action was not * defined. - * + * * @param action * The action contribution that caused the exception, * never <code>null</code>. @@ -589,37 +589,37 @@ * The <code>NotDefinedException</code>, never <code>null</code>. */ 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 <code>null</code>. * @param e * The DWT Event, may be <code>null</code>. - * + * */ 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 <code>null</code>. * @param returnValue * The command's result, may be <code>null</code>. - * + * */ public void postExecuteSuccess(IAction action, Object returnValue); - + /** * Creates an <code>ExecutionException</code> when the action returned * a failure. - * + * * @param action * The action contribution that caused the exception, * never <code>null</code>.