Index: src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionDelegate.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionDelegate.java,v retrieving revision 1.2 diff -u -r1.2 AbstractActionDelegate.java --- src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionDelegate.java 12 Sep 2005 21:23:49 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionDelegate.java 5 Oct 2005 16:06:50 -0000 @@ -63,7 +63,7 @@ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate * @see org.eclipse.ui.IActionDelegate2 */ -public abstract class AbstractActionDelegate implements IPartListener, IRepeatableAction { +public abstract class AbstractActionDelegate implements IPartListener, IActionWithProgress { /** * Flag to indicate whether or not this action has been set up. @@ -365,17 +365,6 @@ } /** - * Retrieves a Boolean indicating whether this action delegate can be - * repeated. - * - * @return true if the action for this delegate is enabled; - * false otherwise. - */ - public boolean isRepeatable() { - return getAction().isEnabled(); - } - - /** * Retrieves a Boolean indicating whether this action delegate can be run. * * @return true if the action for this delegate is enabled; @@ -393,16 +382,6 @@ } /** - * Re-runs this action delegate's action. - */ - public void repeat(IProgressMonitor progressMonitor) { - // The progress monitor can be ignored here because the ActionManager - // will be asked to run the action, and will supply the appropriate - // progress monitor to the run() method - getAction().run(); - } - - /** * Runs this action delegate. */ public void run(IProgressMonitor progressMonitor) { @@ -470,14 +449,14 @@ /** - * @see org.eclipse.gmf.runtime.common.ui.action.IRepeatableAction#getWorkIndicatorType() + * @see org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress#getWorkIndicatorType() */ public WorkIndicatorType getWorkIndicatorType() { return WorkIndicatorType.BUSY; } /** - * @see org.eclipse.gmf.runtime.common.ui.action.IRepeatableAction#setup() + * @see org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress#setup() */ public boolean setup() { setSetup(true); Index: src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionHandler.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionHandler.java,v retrieving revision 1.2 diff -u -r1.2 AbstractActionHandler.java --- src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionHandler.java 12 Sep 2005 21:23:49 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/action/AbstractActionHandler.java 5 Oct 2005 16:06:50 -0000 @@ -61,7 +61,7 @@ */ public abstract class AbstractActionHandler extends Action - implements IDisposableAction, IRepeatableAction, ISelectionChangedListener, + implements IDisposableAction, IActionWithProgress, ISelectionChangedListener, ICommandManagerChangeListener, IPropertyListener { /** @@ -370,17 +370,6 @@ } /** - * Retrieves a Boolean indicating whether this action handler can be - * repeated. - * - * @return true if this action handler is enabled; - * false otherwise. - */ - public boolean isRepeatable() { - return isEnabled(); - } - - /** * Retrieves a Boolean indicating whether this action handler can be run. * * @return true if this action handler is enabled; @@ -428,13 +417,6 @@ } /** - * Re-runs this action handler. - */ - public void repeat(IProgressMonitor progressMonitor) { - run(progressMonitor); - } - - /** * Handles the specified exception. * * @param exception Index: src/org/eclipse/gmf/runtime/common/ui/action/AbstractContributionItem.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/action/AbstractContributionItem.java,v retrieving revision 1.2 diff -u -r1.2 AbstractContributionItem.java --- src/org/eclipse/gmf/runtime/common/ui/action/AbstractContributionItem.java 12 Sep 2005 21:23:49 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/action/AbstractContributionItem.java 5 Oct 2005 16:06:50 -0000 @@ -55,7 +55,7 @@ public abstract class AbstractContributionItem extends ContributionItem implements ISelectionChangedListener, ICommandManagerChangeListener, - IRepeatableAction { + IActionWithProgress { /** * Flag to indicate whether or not this action has been set up. @@ -649,13 +649,6 @@ public WorkIndicatorType getWorkIndicatorType() { return WorkIndicatorType.BUSY; } - - /* (non-Javadoc) - * @see org.eclipse.gmf.runtime.common.ui.action.IRepeatableAction#isRepeatable() - */ - public boolean isRepeatable() { - return isEnabled(); - } /* (non-Javadoc) * @see org.eclipse.gmf.runtime.common.ui.action.IRepeatableAction#isRunnable() @@ -665,13 +658,6 @@ } /* (non-Javadoc) - * @see org.eclipse.gmf.runtime.common.ui.action.IRepeatableAction#repeat(org.eclipse.core.runtime.IProgressMonitor) - */ - public void repeat(IProgressMonitor progressMonitor) { - run(progressMonitor); - } - - /* (non-Javadoc) * @see org.eclipse.gmf.runtime.common.ui.action.IRepeatableAction#run(org.eclipse.core.runtime.IProgressMonitor) */ public void run(IProgressMonitor progressMonitor) { Index: src/org/eclipse/gmf/runtime/common/ui/action/ActionManager.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/action/ActionManager.java,v retrieving revision 1.2 diff -u -r1.2 ActionManager.java --- src/org/eclipse/gmf/runtime/common/ui/action/ActionManager.java 12 Sep 2005 21:23:49 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/action/ActionManager.java 5 Oct 2005 16:06:50 -0000 @@ -19,23 +19,21 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.custom.BusyIndicator; - import org.eclipse.gmf.runtime.common.core.command.CommandManager; import org.eclipse.gmf.runtime.common.core.util.Log; import org.eclipse.gmf.runtime.common.core.util.Trace; import org.eclipse.gmf.runtime.common.ui.internal.CommonUIDebugOptions; import org.eclipse.gmf.runtime.common.ui.internal.CommonUIPlugin; import org.eclipse.gmf.runtime.common.ui.internal.CommonUIStatusCodes; -import org.eclipse.gmf.runtime.common.ui.internal.l10n.ResourceManager; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.custom.BusyIndicator; /** - * Responsible for managing the running of repeatable actions. All repeatable + * Responsible for managing the running of actions. All * actions (delegates and handlers) channel their run requests through an action * manager. An action manager keeps track of the action that was last run and - * fFires events to interested listeners whenever an action is run. + * fires events to interested listeners whenever an action is run. * * @author khussey */ @@ -45,12 +43,6 @@ * The empty string. */ protected static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - /** - * The prefix for repeat action labels. - */ - public static final String REPEAT_LABEL_PREFIX = ResourceManager.getI18NString("ActionManager.repeat.label.prefix"); //$NON-NLS-1$ - /** * A string containing only a space character. */ @@ -69,7 +61,7 @@ /** * The last action that was run. */ - private IRepeatableAction action = null; + private IActionWithProgress action = null; /** * The action manager change listeners. @@ -117,7 +109,7 @@ * * @return The value of the action instance variable. */ - protected final IRepeatableAction getAction() { + protected final IActionWithProgress getAction() { return action; } @@ -127,7 +119,7 @@ * @param action The new value for the action instance * variable. */ - protected final void setAction(IRepeatableAction action) { + protected final void setAction(IActionWithProgress action) { this.action = action; } @@ -140,16 +132,6 @@ return listeners; } - /** - * Retrieves the repeat label for the last action that was run. - * - * @return The repeat label. - */ - public String getRepeatLabel() { - return REPEAT_LABEL_PREFIX - + (canRepeat() ? SPACE + getAction().getLabel() : EMPTY_STRING); - } - /** * Adds the specified listener to the list of action manager change * listeners for this action manager. @@ -195,17 +177,6 @@ } /** - * Retrieves a Boolean indicating whether the last action that was run - * can be repeated. - * - * @return false. Repeat is no longer supported. - */ - public boolean canRepeat() { - // RATLC00534581 - repeat no longer supported - return false; - } - - /** * Clears this action manager by discarding the last action that was run. */ public void clear() { @@ -215,47 +186,6 @@ } /** - * Repeats the last action that was run. - * - * @exception UnsupportedOperationException If an action cannot be - * repeated. - */ - public void repeat() { - if (!canRepeat()) { - UnsupportedOperationException uoe = - new UnsupportedOperationException(); - Trace.throwing(CommonUIPlugin.getDefault(), CommonUIDebugOptions.EXCEPTIONS_THROWING, getClass(), "repeat", uoe); //$NON-NLS-1$ - throw uoe; - } - - IRepeatableAction.WorkIndicatorType type = - getAction().getWorkIndicatorType(); - - if (type == IRepeatableAction.WorkIndicatorType.PROGRESS_MONITOR) { - repeatActionInProgressMonitorDialog(getAction(), false); - - } else if ( - type - == IRepeatableAction - .WorkIndicatorType - .CANCELABLE_PROGRESS_MONITOR) { - repeatActionInProgressMonitorDialog(getAction(), true); - - } else if (type == IRepeatableAction.WorkIndicatorType.BUSY) { - // display hourglass cursor - BusyIndicator.showWhile(null, new Runnable() { - public void run() { - getAction().repeat(new NullProgressMonitor()); - } - }); - } else { - getAction().run(new NullProgressMonitor()); - } - - Trace.trace(CommonUIPlugin.getDefault(), CommonUIDebugOptions.ACTIONS_REPEAT, "Action '" + String.valueOf(getAction()) + "' repeated."); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** * Runs the specified action. * * @param theAction The action to be run. @@ -263,7 +193,7 @@ * @exception RuntimeException if any exception or error occurs * while running the action */ - public void run(final IRepeatableAction theAction) { + public void run(final IActionWithProgress theAction) { if (!theAction.isRunnable()) { UnsupportedOperationException uoe = new UnsupportedOperationException(); @@ -278,20 +208,20 @@ return; } - IRepeatableAction.WorkIndicatorType type = + IActionWithProgress.WorkIndicatorType type = theAction.getWorkIndicatorType(); - if (type == IRepeatableAction.WorkIndicatorType.PROGRESS_MONITOR) { + if (type == IActionWithProgress.WorkIndicatorType.PROGRESS_MONITOR) { runActionInProgressMonitorDialog(theAction, false); } else if ( type - == IRepeatableAction + == IActionWithProgress .WorkIndicatorType .CANCELABLE_PROGRESS_MONITOR) { runActionInProgressMonitorDialog(theAction, true); - } else if (type == IRepeatableAction.WorkIndicatorType.BUSY) { + } else if (type == IActionWithProgress.WorkIndicatorType.BUSY) { // display hourglass cursor BusyIndicator.showWhile(null, new Runnable() { public void run() { @@ -356,7 +286,7 @@ * while running the action */ private void runActionInProgressMonitorDialog( - final IRepeatableAction act, + final IActionWithProgress act, boolean cancelable) { IRunnableWithProgress runnable = new IRunnableWithProgress() { @@ -366,28 +296,4 @@ }; runInProgressMonitorDialog(runnable, cancelable); } - - /** - * Repeats action in the context of a progress monitor dialog. - * The action runs in the same thread as the dialog. The cancel button on - * the dialog is enabled if cancelable is true. - * - * @param act the action to run - * @param cancelable true if the progress monitor should have - * an enabled cancel button, false otherwise. - * - * @exception RuntimeException if any exception or error occurs - * while repeating the action - */ - private void repeatActionInProgressMonitorDialog( - final IRepeatableAction act, - boolean cancelable) { - - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - act.repeat(monitor); - } - }; - runInProgressMonitorDialog(runnable, cancelable); - } } Index: src/org/eclipse/gmf/runtime/common/ui/action/ActionManagerChangeEvent.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/action/ActionManagerChangeEvent.java,v retrieving revision 1.2 diff -u -r1.2 ActionManagerChangeEvent.java --- src/org/eclipse/gmf/runtime/common/ui/action/ActionManagerChangeEvent.java 12 Sep 2005 21:23:49 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/action/ActionManagerChangeEvent.java 5 Oct 2005 16:06:50 -0000 @@ -27,7 +27,7 @@ /** * The action that was run. */ - private final IRepeatableAction action; + private final IActionWithProgress action; /** * Constructs a new action manager change event for the specified action @@ -48,7 +48,7 @@ */ public ActionManagerChangeEvent( ActionManager source, - IRepeatableAction action) { + IActionWithProgress action) { super(source); @@ -60,7 +60,7 @@ * * @return The value of the action instance variable. */ - public IRepeatableAction getAction() { + public IActionWithProgress getAction() { return action; } Index: src/org/eclipse/gmf/runtime/common/ui/action/IRepeatableAction.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/action/IRepeatableAction.java,v retrieving revision 1.2 diff -u -r1.2 IRepeatableAction.java --- src/org/eclipse/gmf/runtime/common/ui/action/IRepeatableAction.java 12 Sep 2005 21:23:49 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/action/IRepeatableAction.java 5 Oct 2005 16:06:50 -0000 @@ -11,77 +11,18 @@ package org.eclipse.gmf.runtime.common.ui.action; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.util.EnumeratedType; - /** * The interface for all actions that could potentially be repeated. * * @author khussey + * @deprecated Repeatable actions are no longer supported. Use + * {@link org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress} + * instead. */ -public interface IRepeatableAction { - /** - * Enumerated type for work indicator type - */ - public class WorkIndicatorType extends EnumeratedType { - private static int nextOrdinal = 0; - - /** No work indicator. */ - public static final WorkIndicatorType NONE = new WorkIndicatorType("None"); //$NON-NLS-1$ - - /** Busy work indicator. */ - public static final WorkIndicatorType BUSY = new WorkIndicatorType("Busy"); //$NON-NLS-1$ - - /** Progress monitor work indicator. */ - public static final WorkIndicatorType PROGRESS_MONITOR = new WorkIndicatorType("Progress Monitor"); //$NON-NLS-1$ - - /** Cancelable progress monitor work indicator. */ - public static final WorkIndicatorType CANCELABLE_PROGRESS_MONITOR = new WorkIndicatorType("Cancelable Progress Monitor"); //$NON-NLS-1$ - - /** - * The list of values for this enumerated type. - */ - private static final WorkIndicatorType[] VALUES = - { NONE, BUSY, PROGRESS_MONITOR, CANCELABLE_PROGRESS_MONITOR }; - - /** - * Constructor for WorkIndicatorType. - * @param name The name for the WorkIndicatorType - * @param ordinal The ordinal for theWorkIndicatorType - */ - protected WorkIndicatorType(String name, int ordinal) { - super(name, ordinal); - } - - /** - * Constructor for WorkIndicatorType. - * @param name The name for the WorkIndicatorType - */ - private WorkIndicatorType(String name) { - this(name, nextOrdinal++); - } - - /** - * Retrieves the list of constants for this enumerated type. - * @return The list of constants for this enumerated type. - */ - protected List getValues() { - return Collections.unmodifiableList(Arrays.asList(VALUES)); - } - } - - /** - * Retrieves the label for this repeatable action. - * - * @return The label for this repeatable action. - */ - public String getLabel(); - +public interface IRepeatableAction extends IActionWithProgress { + /** * Retrieves a Boolean indicating whether this repeatable action can be * repeated. @@ -92,46 +33,9 @@ public boolean isRepeatable(); /** - * Retrieves a Boolean indicating whether this repeatable action can be - * run. - * - * @return true if this repeatable action can be run; - * false otherwise. - */ - public boolean isRunnable(); - - /** - * Refreshes various aspects of this repeatable action, such as its label - * and whether or not it is enabled. - */ - public void refresh(); - - /** - * Sets up the action. Should always be called before - * {@link #run(IProgressMonitor)} is called. - * @return true if the setup completed successfully, - * false otherwise. - */ - public boolean setup(); - - /** * Re-runs this repeatable action. * * @param progressMonitor IProgressMonitor monitoring the execution of this action */ public void repeat(IProgressMonitor progressMonitor); - - /** - * Runs this repeatable action. - * - * @param progressMonitor IProgressMonitor monitoring the execution of this action - */ - public void run(IProgressMonitor progressMonitor); - - /** - * Gets type of work indicator (progress monitor, hourglass, or none). - * - * @return type of work indicator - */ - public WorkIndicatorType getWorkIndicatorType(); } Index: src/org/eclipse/gmf/runtime/common/ui/internal/l10n/messages.properties =================================================================== RCS file: /home/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.common.ui/src/org/eclipse/gmf/runtime/common/ui/internal/l10n/messages.properties,v retrieving revision 1.2 diff -u -r1.2 messages.properties --- src/org/eclipse/gmf/runtime/common/ui/internal/l10n/messages.properties 12 Sep 2005 21:23:50 -0000 1.2 +++ src/org/eclipse/gmf/runtime/common/ui/internal/l10n/messages.properties 5 Oct 2005 16:06:50 -0000 @@ -20,7 +20,6 @@ # Label strings for actions. # ================================ BEGIN ================================================== -ActionManager.repeat.label.prefix=Repeat ClearAction.label=Clear MoveAction.label=Move # ==================================== END ================================================= Index: src/org/eclipse/gmf/runtime/common/ui/action/IActionWithProgress.java =================================================================== RCS file: src/org/eclipse/gmf/runtime/common/ui/action/IActionWithProgress.java diff -N src/org/eclipse/gmf/runtime/common/ui/action/IActionWithProgress.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/gmf/runtime/common/ui/action/IActionWithProgress.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,123 @@ +/****************************************************************************** + * Copyright (c) 2002, 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ****************************************************************************/ + +package org.eclipse.gmf.runtime.common.ui.action; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.gmf.runtime.common.core.util.EnumeratedType; + +/** + * The interface for all actions that could potentially be run with a progress + * indicator. + * + * @author khussey + * @author ldamus + */ +public interface IActionWithProgress { + /** + * Enumerated type for work indicator type + */ + public class WorkIndicatorType extends EnumeratedType { + private static int nextOrdinal = 0; + + /** No work indicator. */ + public static final WorkIndicatorType NONE = new WorkIndicatorType("None"); //$NON-NLS-1$ + + /** Busy work indicator. */ + public static final WorkIndicatorType BUSY = new WorkIndicatorType("Busy"); //$NON-NLS-1$ + + /** Progress monitor work indicator. */ + public static final WorkIndicatorType PROGRESS_MONITOR = new WorkIndicatorType("Progress Monitor"); //$NON-NLS-1$ + + /** Cancelable progress monitor work indicator. */ + public static final WorkIndicatorType CANCELABLE_PROGRESS_MONITOR = new WorkIndicatorType("Cancelable Progress Monitor"); //$NON-NLS-1$ + + /** + * The list of values for this enumerated type. + */ + private static final WorkIndicatorType[] VALUES = + { NONE, BUSY, PROGRESS_MONITOR, CANCELABLE_PROGRESS_MONITOR }; + + /** + * Constructor for WorkIndicatorType. + * @param name The name for the WorkIndicatorType + * @param ordinal The ordinal for theWorkIndicatorType + */ + protected WorkIndicatorType(String name, int ordinal) { + super(name, ordinal); + } + + /** + * Constructor for WorkIndicatorType. + * @param name The name for the WorkIndicatorType + */ + private WorkIndicatorType(String name) { + this(name, nextOrdinal++); + } + + /** + * Retrieves the list of constants for this enumerated type. + * @return The list of constants for this enumerated type. + */ + protected List getValues() { + return Collections.unmodifiableList(Arrays.asList(VALUES)); + } + } + + /** + * Retrieves the label for this action. + * + * @return The label for this action. + */ + public String getLabel(); + + /** + * Retrieves a Boolean indicating whether this action can be + * run. + * + * @return true if this action can be run; + * false otherwise. + */ + public boolean isRunnable(); + + /** + * Refreshes various aspects of this action, such as its label + * and whether or not it is enabled. + */ + public void refresh(); + + /** + * Sets up the action. Should always be called before + * {@link #run(IProgressMonitor)} is called. + * @return true if the setup completed successfully, + * false otherwise. + */ + public boolean setup(); + + /** + * Runs this action. + * + * @param progressMonitor IProgressMonitor monitoring the execution of this action + */ + public void run(IProgressMonitor progressMonitor); + + /** + * Gets type of work indicator (progress monitor, hourglass, or none). + * + * @return type of work indicator + */ + public WorkIndicatorType getWorkIndicatorType(); +}