diff --git a/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF index a2cbdfff7df..75d9cec222c 100644 --- a/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.core.commands -Bundle-Version: 3.11.300.qualifier +Bundle-Version: 3.12.0.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.core.commands, diff --git a/bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/common/CommandException.java b/bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/common/CommandException.java index 836a84d031f..e8b3be3e9aa 100644 --- a/bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/common/CommandException.java +++ b/bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/common/CommandException.java @@ -31,12 +31,6 @@ public abstract class CommandException extends Exception { */ private static final long serialVersionUID = 5389763628699257234L; - /** - * This member variable is required here to allow us to compile against JCL - * foundation libraries. The value may be null. - */ - private Throwable cause; - /** * Creates a new instance of this class with the specified detail message. * @@ -57,20 +51,7 @@ public CommandException(final String message) { * the cause; may be null. */ public CommandException(final String message, final Throwable cause) { - super(message); - // don't pass the cause to super, to allow compilation against JCL Foundation - this.cause = cause; - } - - /** - * Returns the cause of this throwable or null if the - * cause is nonexistent or unknown. - * - * @return the cause or null - */ - @Override - public Throwable getCause() { - return cause; + super(message, cause); } } diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DeviceResourceException.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DeviceResourceException.java index b70f3142c3e..d71681e8282 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DeviceResourceException.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DeviceResourceException.java @@ -21,8 +21,6 @@ */ public class DeviceResourceException extends RuntimeException { - private Throwable cause; - /** * All serializable objects should have a stable serialVersionUID */ @@ -36,9 +34,7 @@ public class DeviceResourceException extends RuntimeException { * @param cause cause of the exception (or null if none) */ public DeviceResourceException(DeviceResourceDescriptor missingResource, Throwable cause) { - super("Unable to create resource " + missingResource); //$NON-NLS-1$ - // don't pass the cause to super, to allow compilation against JCL Foundation (bug 80059) - this.cause = cause; + super("Unable to create resource " + missingResource, cause); //$NON-NLS-1$ } /** @@ -51,16 +47,4 @@ public DeviceResourceException(DeviceResourceDescriptor missingResource) { this(missingResource, null); } - /** - * Returns the cause of this throwable or null if the - * cause is nonexistent or unknown. - * - * @return the cause or null - * @since 3.1 - */ - @Override - public Throwable getCause() { - return cause; - } - } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java index 85922a2c26e..905e7015efe 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java @@ -23,7 +23,6 @@ import org.eclipse.ui.activities.IWorkbenchActivitySupport; import org.eclipse.ui.browser.IWorkbenchBrowserSupport; import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.contexts.IWorkbenchContextSupport; import org.eclipse.ui.handlers.IHandlerService; @@ -473,21 +472,6 @@ IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window, IA */ IWorkbenchActivitySupport getActivitySupport(); - /** - * Returns an interface to manage commands at the workbench level. - * - * @return an interface to manage commands at the workbench level. Guaranteed - * not to be null. - * @since 3.0 - * @deprecated Please use {@link IServiceLocator#getService(Class)} instead. - * This API is scheduled for deletion, see Bug 431177 for details - * @see ICommandService - * @see IHandlerService - * @noreference IWorkbenchCommandSupport is scheduled for deletion. - */ - @Deprecated - IWorkbenchCommandSupport getCommandSupport(); - /** * Returns an interface to manage contexts at the workbench level. * diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java deleted file mode 100644 index 2a3c7da92c8..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/AbstractHandler.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.HandlerEvent; -import org.eclipse.core.commands.IHandlerAttributes; - -/** - * This class is a partial implementation of IHandler. This - * abstract implementation provides support for handler listeners. You should - * subclass from this method unless you want to implement your own listener - * support. Subclasses should call - * {@link AbstractHandler#fireHandlerChanged(HandlerEvent)}when the handler - * changes. Subclasses should also override - * {@link AbstractHandler#getAttributeValuesByName()}if they have any - * attributes. - * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.AbstractHandler - * @noreference This class is scheduled for deletion. - * @noextend This class is not intended to be extended by clients. - */ -@Deprecated(forRemoval = true, since = "2024-03") -public abstract class AbstractHandler extends org.eclipse.core.commands.AbstractHandler implements IHandler { - - /** - * Those interested in hearing about changes to this instance of - * IHandler. This member is null iff there are no listeners - * attached to this handler. (Most handlers don't have any listeners, and this - * optimization saves some memory.) - */ - private List handlerListeners; - - /** - * @see IHandler#addHandlerListener(IHandlerListener) - */ - @Override - @Deprecated - public void addHandlerListener(IHandlerListener handlerListener) { - if (handlerListener == null) { - throw new NullPointerException(); - } - if (handlerListeners == null) { - handlerListeners = new ArrayList<>(); - } - if (!handlerListeners.contains(handlerListener)) { - handlerListeners.add(handlerListener); - } - } - - /** - * The default implementation does nothing. Subclasses who attach listeners to - * other objects are encouraged to detach them in this method. - * - * @see org.eclipse.ui.commands.IHandler#dispose() - */ - @Override - @Deprecated - public void dispose() { - // Do nothing. - } - - @Override - @Deprecated - public Object execute(final ExecutionEvent event) throws ExecutionException { - try { - return execute(event.getParameters()); - } catch (final org.eclipse.ui.commands.ExecutionException e) { - throw new ExecutionException(e.getMessage(), e.getCause()); - } - } - - /** - * Fires an event to all registered listeners describing changes to this - * instance. - * - * @param handlerEvent the event describing changes to this instance. Must not - * be null. - */ - @Override - @Deprecated - protected void fireHandlerChanged(HandlerEvent handlerEvent) { - super.fireHandlerChanged(handlerEvent); - - if (handlerListeners != null) { - final boolean attributesChanged = handlerEvent.isEnabledChanged() || handlerEvent.isHandledChanged(); - final Map previousAttributes; - if (attributesChanged) { - previousAttributes = new HashMap(); - previousAttributes.putAll(getAttributeValuesByName()); - if (handlerEvent.isEnabledChanged()) { - Boolean disabled = !isEnabled() ? Boolean.TRUE : Boolean.FALSE; - previousAttributes.put("enabled", disabled); //$NON-NLS-1$ - } - if (handlerEvent.isHandledChanged()) { - Boolean notHandled = !isHandled() ? Boolean.TRUE : Boolean.FALSE; - previousAttributes.put(IHandlerAttributes.ATTRIBUTE_HANDLED, notHandled); - } - } else { - previousAttributes = null; - } - final org.eclipse.ui.commands.HandlerEvent legacyEvent = new org.eclipse.ui.commands.HandlerEvent(this, - attributesChanged, previousAttributes); - - for (IHandlerListener handlerListener : handlerListeners) { - handlerListener.handlerChanged(legacyEvent); - } - } - } - - /** - * @see org.eclipse.core.commands.AbstractHandler - */ - @Deprecated - protected void fireHandlerChanged(final org.eclipse.ui.commands.HandlerEvent handlerEvent) { - if (handlerEvent == null) { - throw new NullPointerException(); - } - - if (handlerListeners != null) { - for (IHandlerListener handlerListener : handlerListeners) { - handlerListener.handlerChanged(handlerEvent); - } - } - - if (super.hasListeners()) { - final boolean enabledChanged; - final boolean handledChanged; - if (handlerEvent.haveAttributeValuesByNameChanged()) { - Map previousAttributes = handlerEvent.getPreviousAttributeValuesByName(); - - Object attribute = previousAttributes.get("enabled"); //$NON-NLS-1$ - if (attribute instanceof Boolean) { - enabledChanged = ((Boolean) attribute).booleanValue(); - } else { - enabledChanged = false; - } - - attribute = previousAttributes.get(IHandlerAttributes.ATTRIBUTE_HANDLED); - if (attribute instanceof Boolean) { - handledChanged = ((Boolean) attribute).booleanValue(); - } else { - handledChanged = false; - } - } else { - enabledChanged = false; - handledChanged = true; - } - final HandlerEvent newEvent = new HandlerEvent(this, enabledChanged, handledChanged); - super.fireHandlerChanged(newEvent); - } - } - - /** - * This simply return an empty map. The default implementation has no - * attributes. - * - * @see IHandler#getAttributeValuesByName() - */ - @Override - @Deprecated - public Map getAttributeValuesByName() { - return Collections.EMPTY_MAP; - } - - /** - * Returns true iff there is one or more IHandlerListeners attached to this - * AbstractHandler. - * - * @return true iff there is one or more IHandlerListeners attached to this - * AbstractHandler - * @since 3.1 - */ - @Override - @Deprecated - protected final boolean hasListeners() { - return super.hasListeners() || handlerListeners != null; - } - - @Override - @Deprecated - public boolean isEnabled() { - final Object handled = getAttributeValuesByName().get("enabled"); //$NON-NLS-1$ - if (handled instanceof Boolean) { - return ((Boolean) handled).booleanValue(); - } - - return false; - } - - @Override - @Deprecated - public boolean isHandled() { - final Object handled = getAttributeValuesByName().get(IHandlerAttributes.ATTRIBUTE_HANDLED); - if (handled instanceof Boolean) { - return ((Boolean) handled).booleanValue(); - } - - return false; - } - - /** - * @see IHandler#removeHandlerListener(IHandlerListener) - */ - @Override - @Deprecated - public void removeHandlerListener(IHandlerListener handlerListener) { - if (handlerListener == null) { - throw new NullPointerException(); - } - if (handlerListeners == null) { - return; - } - - if (handlerListeners != null) { - handlerListeners.remove(handlerListener); - } - if (handlerListeners.isEmpty()) { - handlerListeners = null; - } - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java deleted file mode 100644 index 4d27c1127f6..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ActionHandler.java +++ /dev/null @@ -1,254 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.commands.IHandlerAttributes; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.actions.RetargetAction; - -/** - * This class adapts instances of IAction to IHandler. - * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.jface.commands.ActionHandler - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class ActionHandler extends AbstractHandler { - - /** - * The attribute name for the checked property of the wrapped action. This - * indicates whether the action should be displayed with as a checked check box. - */ - private static final String ATTRIBUTE_CHECKED = "checked"; //$NON-NLS-1$ - - /** - * The attribute name for the enabled property of the wrapped action. - */ - private static final String ATTRIBUTE_ENABLED = "enabled"; //$NON-NLS-1$ - - /** - *

- * The name of the attribute indicating whether the wrapped instance of - * RetargetAction has a handler. - *

- */ - private static final String ATTRIBUTE_HANDLED = IHandlerAttributes.ATTRIBUTE_HANDLED; - - /** - * The attribute name for the identifier of the wrapped action. This is the - * action identifier, and not the command identifier. - */ - private static final String ATTRIBUTE_ID = "id"; //$NON-NLS-1$ - - /** - * The attribute name for the visual style of the wrapped action. The style can - * be things like a pull-down menu, a check box, a radio button or a push - * button. - */ - private static final String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$ - - /** - * The wrapped action. This value is never null. - */ - private final IAction action; - - /** - * The map of attributes values. The keys are String values of the - * attribute names (given above). The values can be any type of - * Object. - * - * This map is always null if there are no IHandlerListeners registered. - */ - private Map attributeValuesByName; - - /** - * The property change listener hooked on to the action. This is initialized - * when the first listener is attached to this handler, and is removed when the - * handler is disposed or the last listener is removed. - */ - private IPropertyChangeListener propertyChangeListener; - - /** - * Creates a new instance of this class given an instance of - * IAction. - * - * @param action the action. Must not be null. - */ - @Deprecated - public ActionHandler(IAction action) { - if (action == null) { - throw new NullPointerException(); - } - - this.action = action; - } - - /** - * @see org.eclipse.ui.commands.IHandler#addHandlerListener(org.eclipse.ui.commands.IHandlerListener) - * @since 3.1 - */ - @Override - @Deprecated - public void addHandlerListener(IHandlerListener handlerListener) { - if (!hasListeners()) { - attachListener(); - } - - super.addHandlerListener(handlerListener); - } - - /** - * When a listener is attached to this handler, then this registers a listener - * with the underlying action. - * - * @since 3.1 - */ - private void attachListener() { - if (propertyChangeListener == null) { - attributeValuesByName = getAttributeValuesByNameFromAction(); - - propertyChangeListener = propertyChangeEvent -> { - String property = propertyChangeEvent.getProperty(); - if (IAction.ENABLED.equals(property) || IAction.CHECKED.equals(property) - || IHandlerAttributes.ATTRIBUTE_HANDLED.equals(property)) { - - Map previousAttributeValuesByName = attributeValuesByName; - attributeValuesByName = getAttributeValuesByNameFromAction(); - if (!attributeValuesByName.equals(previousAttributeValuesByName)) { - fireHandlerChanged(new HandlerEvent(ActionHandler.this, true, previousAttributeValuesByName)); - } - } - }; - } - - this.action.addPropertyChangeListener(propertyChangeListener); - } - - /** - * When no more listeners are registered, then this is used to removed the - * property change listener from the underlying action. - * - * @since 3.1 - */ - private void detachListener() { - this.action.removePropertyChangeListener(propertyChangeListener); - propertyChangeListener = null; - attributeValuesByName = null; - } - - /** - * Removes the property change listener from the action. - * - * @see org.eclipse.ui.commands.IHandler#dispose() - */ - @Override - @Deprecated - public void dispose() { - if (hasListeners()) { - action.removePropertyChangeListener(propertyChangeListener); - } - } - - @Override - @Deprecated - public Object execute(Map parameterValuesByName) throws ExecutionException { - if ((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { - action.setChecked(!action.isChecked()); - } - try { - action.runWithEvent(new Event()); - } catch (Exception e) { - throw new ExecutionException("While executing the action, an exception occurred", e); //$NON-NLS-1$ - } - return null; - } - - /** - * Returns the action associated with this handler - * - * @return the action associated with this handler (not null) - * @since 3.1 - */ - @Deprecated - public IAction getAction() { - return action; - } - - @Override - @Deprecated - public Map getAttributeValuesByName() { - if (attributeValuesByName == null) { - return getAttributeValuesByNameFromAction(); - } - - return attributeValuesByName; - } - - /** - * An accessor for the attribute names from the action. This reads out all of - * the attributes from an action into a local map. - * - * @return A map of the attribute values indexed by the attribute name. The - * attributes names are strings, but the values can by any object. - */ - private Map getAttributeValuesByNameFromAction() { - Map map = new HashMap(); - map.put(ATTRIBUTE_CHECKED, action.isChecked() ? Boolean.TRUE : Boolean.FALSE); - map.put(ATTRIBUTE_ENABLED, action.isEnabled() ? Boolean.TRUE : Boolean.FALSE); - boolean handled = true; - if (action instanceof RetargetAction) { - RetargetAction retargetAction = (RetargetAction) action; - handled = retargetAction.getActionHandler() != null; - } - map.put(ATTRIBUTE_HANDLED, handled ? Boolean.TRUE : Boolean.FALSE); - map.put(ATTRIBUTE_ID, action.getId()); - map.put(ATTRIBUTE_STYLE, Integer.valueOf(action.getStyle())); - return Collections.unmodifiableMap(map); - } - - /** - * @see org.eclipse.ui.commands.IHandler#removeHandlerListener(org.eclipse.ui.commands.IHandlerListener) - * @since 3.1 - */ - @Override - @Deprecated - public void removeHandlerListener(IHandlerListener handlerListener) { - super.removeHandlerListener(handlerListener); - - if (!hasListeners()) { - detachListener(); - } - } - - @Override - @Deprecated - public String toString() { - final StringBuilder buffer = new StringBuilder(); - - buffer.append("ActionHandler(action="); //$NON-NLS-1$ - buffer.append(action); - buffer.append(')'); - - return buffer.toString(); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java deleted file mode 100644 index b55b07d5533..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CategoryEvent.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -/** - * An instance of this class describes changes to an instance of - * ICategory. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @see org.eclipse.ui.commands.ICategoryListener#categoryChanged(CategoryEvent) - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.CategoryEvent - * @noreference This class is scheduled for deletion. - */ -@Deprecated -public final class CategoryEvent { - - /** - * The category that has changed; this value is never null. - */ - private final ICategory category; - - /** - * Whether the defined state of the category has changed. - */ - private final boolean definedChanged; - - /** - * Whether the name of the category has changed. - */ - private final boolean nameChanged; - - /** - * Creates a new instance of this class. - * - * @param category the instance of the interface that changed. - * @param definedChanged true, iff the defined property changed. - * @param nameChanged true, iff the name property changed. - */ - @Deprecated - public CategoryEvent(ICategory category, boolean definedChanged, boolean nameChanged) { - if (category == null) { - throw new NullPointerException(); - } - - this.category = category; - this.definedChanged = definedChanged; - this.nameChanged = nameChanged; - } - - /** - * Returns the instance of the interface that changed. - * - * @return the instance of the interface that changed. Guaranteed not to be - * null. - */ - @Deprecated - public ICategory getCategory() { - return category; - } - - /** - * Returns whether or not the defined property changed. - * - * @return true, iff the defined property changed. - */ - @Deprecated - public boolean hasDefinedChanged() { - return definedChanged; - } - - /** - * Returns whether or not the name property changed. - * - * @return true, iff the name property changed. - */ - @Deprecated - public boolean hasNameChanged() { - return nameChanged; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java deleted file mode 100644 index 4aecfa33a6c..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandEvent.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.Collections; -import java.util.Map; -import org.eclipse.ui.internal.util.Util; - -/** - * An instance of this class describes changes to an instance of - * ICommand. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @see ICommandListener#commandChanged(CommandEvent) - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.CommandEvent - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class CommandEvent { - - /** - * Whether the attributes of the command have changed. These are name and value - * pairs representing properties of the command. - */ - private final boolean attributeValuesByNameChanged; - - /** - * Whether the category identifier has changed. - */ - private final boolean categoryIdChanged; - - /** - * The command that has changed; this value is never null. - */ - private final ICommand command; - - /** - * Whether the defined state of the command has changed. - */ - private final boolean definedChanged; - - /** - * Whether the description of the command has changed. - */ - private final boolean descriptionChanged; - - /** - * Whether the command has either gained or lost a handler. - */ - private final boolean handledChanged; - - /** - * Whether the key bindings for the command have changed. - */ - private final boolean keySequenceBindingsChanged; - - /** - * Whether the name of the command has changed. - */ - private final boolean nameChanged; - - /** - * The map of attributes before the change. This is a map of attribute name - * (strings) to values (any object). - */ - private Map previousAttributeValuesByName; - - /** - * Creates a new instance of this class. - * - * @param command the instance of the interface that - * changed. - * @param attributeValuesByNameChanged true, iff the attributeValuesByName - * property changed. - * @param categoryIdChanged true, iff the categoryId property - * changed. - * @param definedChanged true, iff the defined property changed. - * @param descriptionChanged true, iff the description property - * changed. - * @param handledChanged true, iff the handled property changed. - * @param keySequenceBindingsChanged true, iff the keySequenceBindings - * property changed. - * @param nameChanged true, iff the name property changed. - * @param previousAttributeValuesByName the map of previous attribute values by - * name. This map may be empty. If this map - * is not empty, it's collection of keys - * must only contain instances of - * String. This map must be - * null if - * attributeValuesByNameChanged is - * false and must not be null - * if attributeValuesByNameChanged is - * true. - */ - public CommandEvent(ICommand command, boolean attributeValuesByNameChanged, boolean categoryIdChanged, - boolean definedChanged, boolean descriptionChanged, boolean handledChanged, - boolean keySequenceBindingsChanged, boolean nameChanged, Map previousAttributeValuesByName) { - if (command == null) { - throw new NullPointerException(); - } - - if (!attributeValuesByNameChanged && previousAttributeValuesByName != null) { - throw new IllegalArgumentException(); - } - - if (attributeValuesByNameChanged) { - if (previousAttributeValuesByName == null) { - this.previousAttributeValuesByName = Collections.EMPTY_MAP; - } else { - this.previousAttributeValuesByName = Util.safeCopy(previousAttributeValuesByName, String.class, - Object.class, false, true); - } - } - - this.command = command; - this.attributeValuesByNameChanged = attributeValuesByNameChanged; - this.categoryIdChanged = categoryIdChanged; - this.definedChanged = definedChanged; - this.descriptionChanged = descriptionChanged; - this.handledChanged = handledChanged; - this.keySequenceBindingsChanged = keySequenceBindingsChanged; - this.nameChanged = nameChanged; - } - - /** - * Returns the instance of the interface that changed. - * - * @return the instance of the interface that changed. Guaranteed not to be - * null. - */ - @Deprecated - public ICommand getCommand() { - return command; - } - - /** - * Returns the map of previous attribute values by name. - * - * @return the map of previous attribute values by name. This map may be empty. - * If this map is not empty, it's collection of keys is guaranteed to - * only contain instances of String. This map is guaranteed - * to be null if haveAttributeValuesByNameChanged() is - * false and is guaranteed to not be null if - * haveAttributeValuesByNameChanged() is true. - */ - @Deprecated - public Map getPreviousAttributeValuesByName() { - return previousAttributeValuesByName; - } - - /** - * Returns whether or not the categoryId property changed. - * - * @return true, iff the categoryId property changed. - */ - @Deprecated - public boolean hasCategoryIdChanged() { - return categoryIdChanged; - } - - /** - * Returns whether or not the defined property changed. - * - * @return true, iff the defined property changed. - */ - @Deprecated - public boolean hasDefinedChanged() { - return definedChanged; - } - - /** - * Returns whether or not the description property changed. - * - * @return true, iff the description property changed. - */ - @Deprecated - public boolean hasDescriptionChanged() { - return descriptionChanged; - } - - /** - * Returns whether or not the handled property changed. - * - * @return true, iff the handled property changed. - */ - @Deprecated - public boolean hasHandledChanged() { - return handledChanged; - } - - /** - * Returns whether or not the name property changed. - * - * @return true, iff the name property changed. - */ - @Deprecated - public boolean hasNameChanged() { - return nameChanged; - } - - /** - * Returns whether or not the attributeValuesByName property changed. - * - * @return true, iff the attributeValuesByName property changed. - */ - @Deprecated - public boolean haveAttributeValuesByNameChanged() { - return attributeValuesByNameChanged; - } - - /** - * Returns whether or not the keySequenceBindings property changed. - * - * @return true, iff the keySequenceBindings property changed. - */ - @Deprecated - public boolean haveKeySequenceBindingsChanged() { - return keySequenceBindingsChanged; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java deleted file mode 100644 index 9b9b594382e..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandException.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * Signals that an exception occurred within the command architecture. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.common.CommandException - * @noextend This class is not intended to be subclassed by clients. - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public abstract class CommandException extends Exception { - - /** - * Generated serial version UID for this class. - * - * @since 3.4 - */ - private static final long serialVersionUID = 1776879459633730964L; - - private Throwable cause; - - /** - * Creates a new instance of this class with the specified detail message. - * - * @param message the detail message. - */ - @Deprecated - public CommandException(String message) { - super(message); - } - - /** - * Creates a new instance of this class with the specified detail message and - * cause. - * - * @param message the detail message. - * @param cause the cause. - */ - @Deprecated - public CommandException(String message, Throwable cause) { - super(message); - // don't pass the cause to super, to allow compilation against JCL Foundation - this.cause = cause; - } - - /** - * Returns the cause of this throwable or null if the cause is - * nonexistent or unknown. - * - * @return the cause or null - * @since 3.1 - */ - @Override - @Deprecated - public Throwable getCause() { - return cause; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java deleted file mode 100644 index 9e5c9e8a68f..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/CommandManagerEvent.java +++ /dev/null @@ -1,332 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.Set; -import org.eclipse.ui.internal.util.Util; - -/** - * An instance of this class describes changes to an instance of - * ICommandManager. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @see ICommandManagerListener#commandManagerChanged(CommandManagerEvent) - * @see org.eclipse.core.commands.CommandManagerEvent - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class CommandManagerEvent { - - /** - * Whether the set of active contexts has changed. - */ - private final boolean activeContextIdsChanged; - - /** - * Whether the active key configuration has changed. - */ - private final boolean activeKeyConfigurationIdChanged; - - /** - * Whether the locale has changed. - */ - private final boolean activeLocaleChanged; - - /** - * Whether the platform has changed. - */ - private final boolean activePlatformChanged; - - /** - * Whether the command manager has changed. - */ - private final ICommandManager commandManager; - - /** - * Whether the list of defined categories has changed. - */ - private final boolean definedCategoryIdsChanged; - - /** - * Whether the list of defined commands has changed. - */ - private final boolean definedCommandIdsChanged; - - /** - * Whether the list of defined key configurations has changed. - */ - private final boolean definedKeyConfigurationIdsChanged; - - /** - * The set of the defined categories before the change occurred. This is a set - * of strings (category identifiers). - */ - private final Set previouslyDefinedCategoryIds; - - /** - * The set of the defined commands before the change occurred. This is a set of - * strings (command identifiers). - */ - private final Set previouslyDefinedCommandIds; - - /** - * The set of the defined key configurations before the change occurred. This is - * a set of strings (key configuration identifiers). - */ - private final Set previouslyDefinedKeyConfigurationIds; - - /** - * Creates a new instance of this class. - * - * @param commandManager the instance of the interface - * that changed. - * @param activeContextIdsChanged true, iff the - * activeContextIdsChanged property - * changed. - * @param activeKeyConfigurationIdChanged true, iff the - * activeKeyConfigurationIdChanged - * property changed. - * @param activeLocaleChanged true, iff the activeLocaleChanged - * property changed. - * @param activePlatformChanged true, iff the - * activePlatformChanged property - * changed. - * @param definedCategoryIdsChanged true, iff the - * definedCategoryIdsChanged - * property changed. - * @param definedCommandIdsChanged true, iff the - * definedCommandIdsChanged property - * changed. - * @param definedKeyConfigurationIdsChanged true, iff the - * definedKeyConfigurationIdsChanged - * property changed. - * @param previouslyDefinedCategoryIds the set of identifiers to - * previously defined categories. - * This set may be empty. If this - * set is not empty, it must only - * contain instances of - * String. This set - * must be null if - * definedCategoryIdsChanged is - * false and must not - * be null if - * definedCategoryIdsChanged is - * true. - * @param previouslyDefinedCommandIds the set of identifiers to - * previously defined commands. This - * set may be empty. If this set is - * not empty, it must only contain - * instances of String. - * This set must be - * null if - * definedCommandIdsChanged is - * false and must not - * be null if - * definedContextIdsChanged is - * true. - * @param previouslyDefinedKeyConfigurationIds the set of identifiers to - * previously defined key - * configurations. This set may be - * empty. If this set is not empty, - * it must only contain instances of - * String. This set - * must be null if - * definedKeyConfigurationIdsChanged - * is false and must - * not be null if - * definedKeyConfigurationIdsChanged - * is true. - */ - public CommandManagerEvent(ICommandManager commandManager, boolean activeContextIdsChanged, - boolean activeKeyConfigurationIdChanged, boolean activeLocaleChanged, boolean activePlatformChanged, - boolean definedCategoryIdsChanged, boolean definedCommandIdsChanged, - boolean definedKeyConfigurationIdsChanged, Set previouslyDefinedCategoryIds, - Set previouslyDefinedCommandIds, Set previouslyDefinedKeyConfigurationIds) { - if (commandManager == null) { - throw new NullPointerException(); - } - - if (!definedCategoryIdsChanged && previouslyDefinedCategoryIds != null) { - throw new IllegalArgumentException(); - } - - if (!definedCommandIdsChanged && previouslyDefinedCommandIds != null) { - throw new IllegalArgumentException(); - } - - if (!definedKeyConfigurationIdsChanged && previouslyDefinedKeyConfigurationIds != null) { - throw new IllegalArgumentException(); - } - - if (definedCategoryIdsChanged) { - this.previouslyDefinedCategoryIds = Util.safeCopy(previouslyDefinedCategoryIds, String.class); - } else { - this.previouslyDefinedCategoryIds = null; - } - - if (definedCommandIdsChanged) { - this.previouslyDefinedCommandIds = Util.safeCopy(previouslyDefinedCommandIds, String.class); - } else { - this.previouslyDefinedCommandIds = null; - } - - if (definedKeyConfigurationIdsChanged) { - this.previouslyDefinedKeyConfigurationIds = Util.safeCopy(previouslyDefinedKeyConfigurationIds, - String.class); - } else { - this.previouslyDefinedKeyConfigurationIds = null; - } - - this.commandManager = commandManager; - this.activeContextIdsChanged = activeContextIdsChanged; - this.activeKeyConfigurationIdChanged = activeKeyConfigurationIdChanged; - this.activeLocaleChanged = activeLocaleChanged; - this.activePlatformChanged = activePlatformChanged; - this.definedCategoryIdsChanged = definedCategoryIdsChanged; - this.definedCommandIdsChanged = definedCommandIdsChanged; - this.definedKeyConfigurationIdsChanged = definedKeyConfigurationIdsChanged; - } - - /** - * Returns the instance of the interface that changed. - * - * @return the instance of the interface that changed. Guaranteed not to be - * null. - */ - @Deprecated - public ICommandManager getCommandManager() { - return commandManager; - } - - /** - * Returns the set of identifiers to previously defined categories. - * - * @return the set of identifiers to previously defined categories. This set may - * be empty. If this set is not empty, it is guaranteed to only contain - * instances of String. This set is guaranteed to be - * null if haveDefinedCategoryIdsChanged() is - * false and is guaranteed to not be null if - * haveDefinedCategoryIdsChanged() is true. - */ - @Deprecated - public Set getPreviouslyDefinedCategoryIds() { - return previouslyDefinedCategoryIds; - } - - /** - * Returns the set of identifiers to previously defined commands. - * - * @return the set of identifiers to previously defined commands. This set may - * be empty. If this set is not empty, it is guaranteed to only contain - * instances of String. This set is guaranteed to be - * null if haveDefinedCommandIdsChanged() is - * false and is guaranteed to not be null if - * haveDefinedCommandIdsChanged() is true. - */ - @Deprecated - public Set getPreviouslyDefinedCommandIds() { - return previouslyDefinedCommandIds; - } - - /** - * Returns the set of identifiers to previously defined key conigurations. - * - * @return the set of identifiers to previously defined key configurations. This - * set may be empty. If this set is not empty, it is guaranteed to only - * contain instances of String. This set is guaranteed to - * be null if haveDefinedKeyConfigurationIdsChanged() is - * false and is guaranteed to not be null if - * haveDefinedKeyConfigurationIdsChanged() is true. - */ - @Deprecated - public Set getPreviouslyDefinedKeyConfigurationIds() { - return previouslyDefinedKeyConfigurationIds; - } - - /** - * Returns whether or not the activeKeyConfigurationId property changed. - * - * @return true, iff the activeKeyConfigurationId property changed. - */ - @Deprecated - public boolean hasActiveKeyConfigurationIdChanged() { - return activeKeyConfigurationIdChanged; - } - - /** - * Returns whether or not the activeLocale property changed. - * - * @return true, iff the activeLocale property changed. - */ - @Deprecated - public boolean hasActiveLocaleChanged() { - return activeLocaleChanged; - } - - /** - * Returns whether or not the activePlatform property changed. - * - * @return true, iff the activePlatform property changed. - */ - @Deprecated - public boolean hasActivePlatformChanged() { - return activePlatformChanged; - } - - /** - * Returns whether or not the activeContextIds property changed. - * - * @return true, iff the activeContextIds property changed. - */ - @Deprecated - public boolean haveActiveContextIdsChanged() { - return activeContextIdsChanged; - } - - /** - * Returns whether or not the definedCategoryIds property changed. - * - * @return true, iff the definedCategoryIds property changed. - */ - @Deprecated - public boolean haveDefinedCategoryIdsChanged() { - return definedCategoryIdsChanged; - } - - /** - * Returns whether or not the definedCommandIds property changed. - * - * @return true, iff the definedCommandIds property changed. - */ - @Deprecated - public boolean haveDefinedCommandIdsChanged() { - return definedCommandIdsChanged; - } - - /** - * Returns whether or not the definedKeyConfigurationIds property changed. - * - * @return true, iff the definedKeyConfigurationIds property changed. - */ - @Deprecated - public boolean haveDefinedKeyConfigurationIdsChanged() { - return definedKeyConfigurationIdsChanged; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java deleted file mode 100644 index fd5fcbb0804..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ExecutionException.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * Signals that an exception occured during the execution of a command. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.ExecutionException - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class ExecutionException extends CommandException { - - /** - * Generated serial version UID for this class. - * - * @since 3.1 - */ - private static final long serialVersionUID = 3258130262767448120L; - - /** - * Creates a new instance of this class with the specified detail message and - * cause. - * - * @param message the detail message. - * @param cause the cause. - */ - public ExecutionException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new instance of ExecutionException using an - * instance of the new ExecutionException. - * - * @param e The exception from which this exception should be created; must not - * be null. - * @since 3.1 - */ - public ExecutionException(final org.eclipse.core.commands.ExecutionException e) { - super(e.getMessage(), e); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java deleted file mode 100644 index afe2e181900..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerEvent.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.Map; -import org.eclipse.ui.internal.util.Util; - -/** - * An instance of this class describes changes to an instance of - * IHandler. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @see IHandlerListener#handlerChanged(HandlerEvent) - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class HandlerEvent { - - /** - * Whether the attributes of the handler changed. - */ - private final boolean attributeValuesByNameChanged; - - /** - * The handler that changed; this value is never null. - */ - private final IHandler handler; - - /** - * This is the cached result of getPreviousAttributeValuesByName. It is computed - * the first time getPreviousAttributeValuesByName is called. - */ - private Map previousAttributeValuesByName; - - /** - * The map of previous attributes, if they changed. If they did not change, then - * this value is null. The map's keys are the attribute names - * (strings), and its value are any object. - * - * This is the original map passed into the constructor. This object always - * returns a copy of this map, not the original. However the constructor of this - * object is called very frequently and the map is rarely requested, so we only - * copy the map the first time it is requested. - * - * @since 3.1 - */ - private final Map originalPreviousAttributeValuesByName; - - /** - * Creates a new instance of this class. - * - * @param handler the instance of the interface that - * changed. - * @param attributeValuesByNameChanged true, iff the attributeValuesByName - * property changed. - * @param previousAttributeValuesByName the map of previous attribute values by - * name. This map may be empty. If this map - * is not empty, it's collection of keys - * must only contain instances of - * String. This map must be - * null if - * attributeValuesByNameChanged is - * false and must not be null - * if attributeValuesByNameChanged is - * true. - */ - @Deprecated - public HandlerEvent(IHandler handler, boolean attributeValuesByNameChanged, Map previousAttributeValuesByName) { - if (handler == null) { - throw new NullPointerException(); - } - - if (!attributeValuesByNameChanged && previousAttributeValuesByName != null) { - throw new IllegalArgumentException(); - } - - if (attributeValuesByNameChanged) { - this.originalPreviousAttributeValuesByName = previousAttributeValuesByName; - } else { - this.originalPreviousAttributeValuesByName = null; - } - - this.handler = handler; - this.attributeValuesByNameChanged = attributeValuesByNameChanged; - } - - /** - * Returns the instance of the interface that changed. - * - * @return the instance of the interface that changed. Guaranteed not to be - * null. - */ - @Deprecated - public IHandler getHandler() { - return handler; - } - - /** - * Returns the map of previous attribute values by name. - * - * @return the map of previous attribute values by name. This map may be empty. - * If this map is not empty, it's collection of keys is guaranteed to - * only contain instances of String. This map is guaranteed - * to be null if haveAttributeValuesByNameChanged() is - * false and is guaranteed to not be null if - * haveAttributeValuesByNameChanged() is true. - */ - @Deprecated - public Map getPreviousAttributeValuesByName() { - if (originalPreviousAttributeValuesByName == null) { - return null; - } - - if (previousAttributeValuesByName == null) { - previousAttributeValuesByName = Util.safeCopy(originalPreviousAttributeValuesByName, String.class, - Object.class, false, true); - } - - return previousAttributeValuesByName; - } - - /** - * Returns whether or not the attributeValuesByName property changed. - * - * @return true, iff the attributeValuesByName property changed. - */ - @Deprecated - public boolean haveAttributeValuesByNameChanged() { - return attributeValuesByNameChanged; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java deleted file mode 100644 index 30d730d01df..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/HandlerSubmission.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.internal.util.Util; - -/** - *

- * An instance of this class represents a request to handle a command. A handler - * submission specifies a list of conditions under which it would be appropriate - * for a particular command to have a particular handler. These conditions - * include things like the active part or the active shell. So, it is possible - * to say things like: "when my part is active, please consider calling these - * classes when you want to perform a cut, copy or paste". - *

- *

- * The workbench considers all of the submissions it has received and choses the - * ones it views as the best possible match. - *

- *

- * This class is not intended to be extended by clients. - *

- *

- * Note: this class has a natural ordering that is inconsistent with equals. - *

- * - * @since 3.0 - * @see org.eclipse.ui.commands.IWorkbenchCommandSupport - * @deprecated Please use IHandlerService.activateHandler instead. - * This API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.ui.handlers.IHandlerService - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class HandlerSubmission implements Comparable { - - /** - * The part identifier for the part that should be active before this submission - * can be considered. This value can be null, which indicates that - * it should match any part. - */ - private final String activePartId; - - /** - * The shell that must be active before this submission can be considered. This - * value can be null, which indicates that it should match any - * shell. - */ - private final Shell activeShell; - - /** - * The workbench site that must be active before this submission can be - * considered. This value can be null, which indicates that it - * should match an workbench part site. - */ - private final IWorkbenchPartSite activeWorkbenchPartSite; - - /** - * The identifier for the command which the submitted handler handles. This - * value cannot be null. - */ - private final String commandId; - - /** - * The handler being submitted. This value cannot be null. - */ - private final IHandler handler; - - /** - * The priority for this submission. In the event of all other factors being - * equal, the priority will be considered in an attempt to resolve conflicts. - * This value cannot be null. - */ - private final Priority priority; - - /** - * A lazily computed cache of the string representation of this submission. This - * value is computed once; before it is computed, it is null. - */ - private transient String string; - - /** - * Creates a new instance of this class. - * - * @param activePartId the identifier of the part that must be active - * for this request to be considered. May be - * null. - * @param activeShell the shell that must be active for this request - * to be considered. May be null. - * @param activeWorkbenchPartSite the workbench part site of the part that must - * be active for this request to be considered. - * May be null. - * @param commandId the identifier of the command to be handled. - * Must not be null. - * @param handler the handler. Must not be null. - * @param priority the priority. Must not be null. - */ - @Deprecated - public HandlerSubmission(String activePartId, Shell activeShell, IWorkbenchPartSite activeWorkbenchPartSite, - String commandId, IHandler handler, Priority priority) { - if (commandId == null || handler == null || priority == null) { - throw new NullPointerException(); - } - - this.activePartId = activePartId; - this.activeShell = activeShell; - this.activeWorkbenchPartSite = activeWorkbenchPartSite; - this.commandId = commandId; - this.handler = handler; - this.priority = priority; - } - - /** - * @see Comparable#compareTo(java.lang.Object) - */ - @Override - @Deprecated - public int compareTo(Object object) { - HandlerSubmission castedObject = (HandlerSubmission) object; - int compareTo = Util.compare(activeWorkbenchPartSite, castedObject.activeWorkbenchPartSite); - - if (compareTo == 0) { - compareTo = Util.compare(activePartId, castedObject.activePartId); - - if (compareTo == 0) { - compareTo = Util.compare(activeShell, castedObject.activeShell); - - if (compareTo == 0) { - compareTo = Util.compare(priority, castedObject.priority); - - if (compareTo == 0) { - compareTo = Util.compare(commandId, castedObject.commandId); - - if (compareTo == 0) { - compareTo = Util.compare(handler, castedObject.handler); - } - } - } - } - } - - return compareTo; - } - - /** - * Returns the identifier of the part that must be active for this request to be - * considered. - * - * @return the identifier of the part that must be active for this request to be - * considered. May be null. - */ - @Deprecated - public String getActivePartId() { - return activePartId; - } - - /** - * Returns the shell that must be active for this request to be considered. - * - * @return the shell that must be active for this request to be considered. May - * be null. - */ - @Deprecated - public Shell getActiveShell() { - return activeShell; - } - - /** - * Returns the workbench part site of the part that must be active for this - * request to be considered. - * - * @return the workbench part site of the part that must be active for this - * request to be considered. May be null. - */ - @Deprecated - public IWorkbenchPartSite getActiveWorkbenchPartSite() { - return activeWorkbenchPartSite; - } - - /** - * Returns the identifier of the command to be handled. - * - * @return the identifier of the command to be handled. Guaranteed not to be - * null. - */ - @Deprecated - public String getCommandId() { - return commandId; - } - - /** - * Returns the handler. - * - * @return the handler. Guaranteed not to be null. - */ - @Deprecated - public IHandler getHandler() { - return handler; - } - - /** - * Returns the priority. - * - * @return the priority. Guaranteed not to be null. - */ - @Deprecated - public Priority getPriority() { - return priority; - } - - /** - * @see Object#toString() - */ - @Override - public String toString() { - if (string == null) { - final StringBuilder stringBuffer = new StringBuilder(); - stringBuffer.append("[activePartId="); //$NON-NLS-1$ - stringBuffer.append(activePartId); - stringBuffer.append(",activeShell="); //$NON-NLS-1$ - stringBuffer.append(activeShell); - stringBuffer.append(",activeWorkbenchSite="); //$NON-NLS-1$ - stringBuffer.append(activeWorkbenchPartSite); - stringBuffer.append(",commandId="); //$NON-NLS-1$ - stringBuffer.append(commandId); - stringBuffer.append(",handler="); //$NON-NLS-1$ - stringBuffer.append(handler); - stringBuffer.append(",priority="); //$NON-NLS-1$ - stringBuffer.append(priority); - stringBuffer.append(']'); - string = stringBuffer.toString(); - } - - return string; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java deleted file mode 100644 index 482ccee1dc7..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategory.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -/** - *

- * A category is a grouping of commands by functional area. For example, in the - * Eclipse workbench, "Text Editing" is a category containing various commands - * related to text editing. A category's primary functionality is to control the - * display of commands to the user. When appropriate, commands displayed to the - * user (e.g., keys preference page) will be grouped by category. - *

- *

- * An instance of ICategory is a handle representing a category as - * defined by the extension point org.eclipse.ui.commands. The - * identifier of the handle is identifier of the category being represented. - *

- *

- * An instance of ICategory can be obtained from an instance of - * ICommandManager for any identifier, whether or not a category - * with that identifier defined in the plugin registry. - *

- *

- * The handle-based nature of this API allows it to work well with runtime - * plugin activation and deactivation, which causes dynamic changes to the - * plugin registry, and therefore, potentially, dynamic changes to the set of - * category definitions. - *

- *

- * This interface is not intended to be extended or implemented by clients. - *

- * - * @since 3.0 - * @see ICategoryListener - * @see ICommandManager - * @see org.eclipse.core.commands.Category - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noimplement This interface is not intended to be implemented by clients. - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface ICategory extends Comparable { - - /** - * Registers an instance of ICategoryListener to listen for changes - * to attributes of this instance. - * - * @param categoryListener the instance of ICategoryListener to - * register. Must not be null. If an - * attempt is made to register an instance of - * ICategoryListener which is already - * registered with this instance, no operation is - * performed. - */ - @Deprecated - void addCategoryListener(ICategoryListener categoryListener); - - /** - *

- * Returns the description of the category represented by this handle, suitable - * for display to the user. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the description of the category represented by this handle. - * Guaranteed not to be null. - * @throws NotDefinedException if the category represented by this handle is not - * defined. - */ - @Deprecated - String getDescription() throws NotDefinedException; - - /** - * Returns the identifier of this handle. - * - * @return the identifier of this handle. Guaranteed not to be - * null. - */ - @Deprecated - String getId(); - - /** - *

- * Returns the name of the category represented by this handle, suitable for - * display to the user. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the name of the category represented by this handle. Guaranteed not - * to be null. - * @throws NotDefinedException if the category represented by this handle is not - * defined. - */ - @Deprecated - String getName() throws NotDefinedException; - - /** - *

- * Returns whether or not the category represented by this handle is defined. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return true, iff the category represented by this handle is - * defined. - */ - @Deprecated - boolean isDefined(); - - /** - * Unregisters an instance of ICategoryListener listening for - * changes to attributes of this instance. - * - * @param categoryListener the instance of ICategoryListener to - * unregister. Must not be null. If an - * attempt is made to unregister an instance of - * ICategoryListener which is not already - * registered with this instance, no operation is - * performed. - */ - @Deprecated - void removeCategoryListener(ICategoryListener categoryListener); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java deleted file mode 100644 index b12ec9766c9..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICategoryListener.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -/** - *

- * An instance of ICategoryListener can be used by clients to - * receive notification of changes to one or more instances of - * ICategory. - *

- *

- * This interface may be implemented by clients. - *

- * - * @since 3.0 - * @see CategoryEvent - * @see org.eclipse.ui.commands.ICategory#addCategoryListener(ICategoryListener) - * @see org.eclipse.ui.commands.ICategory#removeCategoryListener(ICategoryListener) - * @see org.eclipse.core.commands.ICategoryListener - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noreference This interface is scheduled for deletion. - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface ICategoryListener { - - /** - * Notifies that one or more attributes of an instance of ICategory - * have changed. Specific details are described in the - * CategoryEvent. - * - * @param categoryEvent the category event. Guaranteed not to be - * null. - */ - @Deprecated - void categoryChanged(CategoryEvent categoryEvent); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java deleted file mode 100644 index 42be6a2a959..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommand.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.List; -import java.util.Map; - -/** - *

- * An instance of ICommand is a handle representing a command as - * defined by the extension point org.eclipse.ui.commands. The - * identifier of the handle is identifier of the command being represented. - *

- *

- * An instance of ICommand can be obtained from an instance of - * ICommandManager for any identifier, whether or not a command - * with that identifier defined in the plugin registry. - *

- *

- * The handle-based nature of this API allows it to work well with runtime - * plugin activation and deactivation. If a command is defined, that means that - * its corresponding plug-in is active. If the plug-in is then deactivated, the - * command will still exist but it will be undefined. An attempts to use an - * undefined command will result in a NotDefinedException being - * thrown. - *

- *

- * This interface is not intended to be extended or implemented by clients. - *

- * - * @since 3.0 - * @see ICommandListener - * @see ICommandManager - * @see org.eclipse.core.commands.Command - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noimplement This interface is not intended to be implemented by clients. - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface ICommand extends Comparable { - - /** - * Registers an instance of ICommandListener to listen for changes - * to attributes of this instance. - * - * @param commandListener the instance of ICommandListener to - * register. Must not be null. If an attempt - * is made to register an instance of - * ICommandListener which is already - * registered with this instance, no operation is - * performed. - */ - @Deprecated - void addCommandListener(ICommandListener commandListener); - - /** - * Executes with the map of parameter values by name. - * - * @param parameterValuesByName the map of parameter values by name. Reserved - * for future use, must be null. - * @return the result of the execution. Reserved for future use, must be - * null. - * @throws ExecutionException if an exception occurred during execution. - * @throws NotHandledException if this is not handled. - */ - @Deprecated - Object execute(Map parameterValuesByName) throws ExecutionException, NotHandledException; - - /** - * Returns the map of attribute values by name. - *

- * Notification is sent to all registered listeners if this property changes. - *

- * - * @return the map of attribute values by name. This map may be empty, but is - * guaranteed not to be null. If this map is not empty, its - * collection of keys is guaranteed to only contain instances of - * String. - * @throws NotHandledException if this is not handled. - */ - @Deprecated - Map getAttributeValuesByName() throws NotHandledException; - - /** - *

- * Returns the identifier of the category of the command represented by this - * handle. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the identifier of the category of the command represented by this - * handle. May be null. - * @throws NotDefinedException if the command represented by this handle is not - * defined. - */ - @Deprecated - String getCategoryId() throws NotDefinedException; - - /** - *

- * Returns the description of the command represented by this handle, suitable - * for display to the user. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the description of the command represented by this handle. Guaranteed - * not to be null. - * @throws NotDefinedException if the command represented by this handle is not - * defined. - */ - @Deprecated - String getDescription() throws NotDefinedException; - - /** - * Returns the identifier of this handle. - * - * @return the identifier of this handle. Guaranteed not to be - * null. - */ - @Deprecated - String getId(); - - /** - *

- * Returns the list of key sequence bindings for this handle. This method will - * return all key sequence bindings for this handle's identifier, whether or not - * the command represented by this handle is defined. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the list of key sequence bindings. This list may be empty, but is - * guaranteed not to be null. If this list is not empty, it - * is guaranteed to only contain instances of - * IKeySequenceBinding. - */ - List getKeySequenceBindings(); - - /** - *

- * Returns the name of the command represented by this handle, suitable for - * display to the user. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the name of the command represented by this handle. Guaranteed not to - * be null. - * @throws NotDefinedException if the command represented by this handle is not - * defined. - */ - @Deprecated - String getName() throws NotDefinedException; - - /** - *

- * Returns whether or not the command represented by this handle is defined. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return true, iff the command represented by this handle is - * defined. - */ - @Deprecated - boolean isDefined(); - - /** - *

- * Returns whether or not this command is handled. A command is handled if it - * currently has an IHandler instance associated with it. A command - * needs a handler to carry out the {@link ICommand#execute(Map)} method. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return true, iff this command is enabled. - */ - @Deprecated - boolean isHandled(); - - /** - * Unregisters an instance of ICommandListener listening for - * changes to attributes of this instance. - * - * @param commandListener the instance of ICommandListener to - * unregister. Must not be null. If an - * attempt is made to unregister an instance of - * ICommandListener which is not already - * registered with this instance, no operation is - * performed. - */ - @Deprecated - void removeCommandListener(ICommandListener commandListener); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java deleted file mode 100644 index 0634b50b497..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * An instance of this interface can be used by clients to receive notification - * of changes to one or more instances of ICommand. - *

- * This interface may be implemented by clients. - *

- * - * @since 3.0 - * @see ICommand#addCommandListener(ICommandListener) - * @see ICommand#removeCommandListener(ICommandListener) - * @see org.eclipse.core.commands.ICommandListener - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noreference This interface is scheduled for deletion. - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface ICommandListener { - - /** - * Notifies that one or more properties of an instance of ICommand - * have changed. Specific details are described in the - * CommandEvent. - * - * @param commandEvent the command event. Guaranteed not to be - * null. - */ - @Deprecated - void commandChanged(CommandEvent commandEvent); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java deleted file mode 100644 index 2e4bc0db02e..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManager.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -import java.util.Map; -import java.util.Set; -import org.eclipse.ui.keys.KeySequence; - -/** - *

- * An instance of ICommandManager can be used to obtain instances - * of ICommand, as well as manage whether or not those instances - * are active or inactive, enabled or disabled. - *

- *

- * This interface is not intended to be extended or implemented by clients. - *

- * - * @since 3.0 - * @see org.eclipse.ui.commands.ICommand - * @see org.eclipse.ui.commands.ICommandManagerListener - * @see org.eclipse.core.commands.CommandManager - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @noimplement This interface is not intended to be implemented by clients. - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface ICommandManager { - - /** - * Registers an instance of ICommandManagerListener to listen for - * changes to attributes of this instance. - * - * @param commandManagerListener the instance of - * ICommandManagerListener to - * register. Must not be null. If an - * attempt is made to register an instance of - * ICommandManagerListener which is - * already registered with this instance, no - * operation is performed. - */ - @Deprecated - void addCommandManagerListener(ICommandManagerListener commandManagerListener); - - /** - * Returns the set of identifiers to active contexts. - *

- * Notification is sent to all registered listeners if this property changes. - *

- * - * @return the set of identifiers to active contexts. This set may be empty, but - * is guaranteed not to be null. If this set is not empty, - * it is guaranteed to only contain instances of String. - */ - @Deprecated - Set getActiveContextIds(); - - /** - * Returns the active key configuration. - *

- * Notification is sent to all registered listeners if this property changes. - *

- * - * @return the active key configuration identifier. This set may be empty, but - * it is guaranteed to not be null. If this set is not - * empty, it is guaranteed to only contains instances of - * String. - */ - @Deprecated - String getActiveKeyConfigurationId(); - - /** - * Returns the active locale. While this property tends to be simply the result - * of {@link java.util.Locale#getDefault()}, it may also be changed at runtime - * by different implementations of command manager. - *

- * Notification is sent to all registered listeners if this property changes. - *

- * - * @return the active locale. May be null. - */ - @Deprecated - String getActiveLocale(); - - /** - * Returns the active platform. While this property tends to be simply the - * result of {@link org.eclipse.swt.SWT#getPlatform()}, it may also be changed - * at runtime by different implementations of command manager. - *

- * Notification is sent to all registered listeners if this property changes. - *

- * - * @return the active platform. May be null. - */ - @Deprecated - String getActivePlatform(); - - /** - * Returns a handle to a category given an identifier. - * - * @param categoryId an identifier. Must not be null - * @return a handle to a category. - */ - @Deprecated - ICategory getCategory(String categoryId); - - /** - * Returns a handle to a command given an identifier. - * - * @param commandId an identifier. Must not be null - * @return a handle to a command; never null. - */ - @Deprecated - ICommand getCommand(String commandId); - - /** - *

- * Returns the set of identifiers to defined categories. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the set of identifiers to defined categories. This set may be empty, - * but is guaranteed not to be null. If this set is not - * empty, it is guaranteed to only contain instances of - * String. - */ - @Deprecated - Set getDefinedCategoryIds(); - - /** - *

- * Returns the set of identifiers to defined commands. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the set of identifiers to defined commands. This set may be empty, - * but is guaranteed not to be null. If this set is not - * empty, it is guaranteed to only contain instances of - * String. - */ - @Deprecated - Set getDefinedCommandIds(); - - /** - *

- * Returns the set of identifiers to defined key configurations. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the set of identifiers to defined key configurations. This set may be - * empty, but is guaranteed not to be null. If this set is - * not empty, it is guaranteed to only contain instances of - * String. - */ - @Deprecated - Set getDefinedKeyConfigurationIds(); - - /** - * Returns a handle to a key configuration given an identifier. - * - * @param keyConfigurationId an identifier. Must not be null - * @return a handle to a key configuration. - */ - @Deprecated - IKeyConfiguration getKeyConfiguration(String keyConfigurationId); - - /** - * Finds all of the commands which have key bindings that start with the given - * key sequence. - * - * @param keySequence The prefix to look for; must not be null. - * @return A map of all of the matching key sequences ( - * KeySequence) to command identifiers ( - * String). This map may be empty, but it is never - * null. - */ - @Deprecated - Map getPartialMatches(KeySequence keySequence); - - /** - * Finds the command which has the given key sequence as one of its key - * bindings. - * - * @param keySequence The key binding to look for; must not be - * null. - * @return The command id for the matching command, if any; null if - * none. - */ - @Deprecated - String getPerfectMatch(KeySequence keySequence); - - /** - * Checks to see whether there are any commands which have key bindings that - * start with the given key sequence. - * - * @param keySequence The prefix to look for; must not be null. - * @return true if at least one command has a key binding that - * starts with keySequence;false otherwise. - */ - @Deprecated - boolean isPartialMatch(KeySequence keySequence); - - /** - * Checks to see if there is a command with the given key sequence as one of its - * key bindings. - * - * @param keySequence The key binding to look for; must not be - * null. - * @return true if a command has a matching key binding; - * false otherwise. - */ - @Deprecated - boolean isPerfectMatch(KeySequence keySequence); - - /** - * Unregisters an instance of ICommandManagerListener listening for - * changes to attributes of this instance. - * - * @param commandManagerListener the instance of - * ICommandManagerListener to - * unregister. Must not be null. If - * an attempt is made to unregister an instance of - * ICommandManagerListener which is - * not already registered with this instance, no - * operation is performed. - */ - @Deprecated - void removeCommandManagerListener(ICommandManagerListener commandManagerListener); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java deleted file mode 100644 index 85020c54859..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandManagerListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * An instance of this interface can be used by clients to receive notification - * of changes to one or more instances of ICommandManager. - *

- * This interface may be implemented by clients. - *

- * - * @since 3.0 - * @see ICommandManager#addCommandManagerListener(ICommandManagerListener) - * @see ICommandManager#removeCommandManagerListener(ICommandManagerListener) - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.ICommandManagerListener - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface ICommandManagerListener { - - /** - * Notifies that one or more properties of an instance of - * ICommandManager have changed. Specific details are described in - * the CommandManagerEvent. - * - * @param commandManagerEvent the commandManager event. Guaranteed not to be - * null. - */ - @Deprecated - void commandManagerChanged(CommandManagerEvent commandManagerEvent); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java deleted file mode 100644 index b8e2fe14a96..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandler.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import java.util.Map; - -/** - * A handler is the pluggable piece of a command that handles execution. Each - * command can have zero or more handlers associated with it (in general), of - * which only one will be active at any given moment in time. When the command - * is asked to execute, it will simply pass that request on to its active - * handler, if any. - *

- * This interface is not intended to be extended by clients. - *

- * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.IHandler - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface IHandler { - - /** - * Registers an instance of IHandlerListener to listen for changes - * to properties of this instance. - * - * @param handlerListener the instance to register. Must not be - * null. If an attempt is made to register - * an instance which is already registered with this - * instance, no operation is performed. - */ - @Deprecated - void addHandlerListener(IHandlerListener handlerListener); - - /** - * Disposes of this handler. This method is run once when the object is no - * longer referenced. This can be used as an opportunity to unhook listeners - * from other objects. - */ - @Deprecated - void dispose(); - - /** - * Executes with the map of parameter values by name. - * - * @param parameterValuesByName the map of parameter values by name. Reserved - * for future use, must be null. - * @return the result of the execution. Reserved for future use, must be - * null. - * @throws ExecutionException if an exception occurred during execution. - */ - @Deprecated - Object execute(Map parameterValuesByName) throws ExecutionException; - - /** - * Returns the map of attribute values by name. - *

- * Notification is sent to all registered listeners if this property changes. - *

- * - * @return the map of attribute values by name. This map may be empty, but is - * guaranteed not to be null. If this map is not empty, its - * collection of keys is guaranteed to only contain instances of - * String. - */ - @Deprecated - Map getAttributeValuesByName(); - - /** - * Unregisters an instance of IPropertyListener listening for - * changes to properties of this instance. - * - * @param handlerListener the instance to unregister. Must not be - * null. If an attempt is made to unregister - * an instance which is not already registered with this - * instance, no operation is performed. - */ - @Deprecated - void removeHandlerListener(IHandlerListener handlerListener); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java deleted file mode 100644 index 2609b634010..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IHandlerListener.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * An instance of this interface can be used by clients to receive notification - * of changes to one or more instances of IHandler. - *

- * This interface may be implemented by clients. - *

- * - * @since 3.0 - * @see IHandler#addHandlerListener(IHandlerListener) - * @see IHandler#removeHandlerListener(IHandlerListener) - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.IHandlerListener - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface IHandlerListener { - - /** - * Notifies that one or more properties of an instance of IHandler - * have changed. Specific details are described in the - * HandlerEvent. - * - * @param handlerEvent the handler event. Guaranteed not to be - * null. - */ - @Deprecated - void handlerChanged(HandlerEvent handlerEvent); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java deleted file mode 100644 index 31ab2649f45..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfiguration.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -/** - *

- * An instance of IKeyConfiguration is a handle representing a key - * configuration as defined by the extension point - * org.eclipse.ui.commands. The identifier of the handle is - * identifier of the key configuration being represented. - *

- *

- * An instance of IKeyConfiguration can be obtained from an - * instance of ICommandManager for any identifier, whether or not a - * key configuration with that identifier defined in the plugin registry. - *

- *

- * The handle-based nature of this API allows it to work well with runtime - * plugin activation and deactivation. If a key configuration is defined, that - * means that its corresponding plug-in is active. If the plug-in is then - * deactivated, the configuration will still exist but it will be undefined. An - * attempt to use an undefined key configuration will result in a - * NotDefinedException being thrown. - *

- *

- * This interface is not intended to be extended or implemented by clients. - *

- * - * @since 3.0 - * @see IKeyConfigurationListener - * @see ICommandManager - * @see org.eclipse.jface.bindings.Scheme - * @deprecated Please use the bindings support in the "org.eclipse.jface" - * plug-in instead. This API is scheduled for deletion, see Bug - * 431177 for details - * @noimplement This interface is not intended to be implemented by clients. - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface IKeyConfiguration extends Comparable { - - /** - * Registers an instance of IKeyConfigurationListener to listen for - * changes to attributes of this instance. - * - * @param keyConfigurationListener the instance of - * IKeyConfigurationListener to - * register. Must not be null. If - * an attempt is made to register an instance of - * IKeyConfigurationListener which - * is already registered with this instance, no - * operation is performed. - */ - @Deprecated - void addKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener); - - /** - *

- * Returns the description of the key configuration represented by this handle, - * suitable for display to the user. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the description of the key configuration represented by this handle. - * Guaranteed not to be null. - * @throws NotDefinedException if the key configuration represented by this - * handle is not defined. - */ - @Deprecated - String getDescription() throws NotDefinedException; - - /** - * Returns the identifier of this handle. - * - * @return the identifier of this handle. Guaranteed not to be - * null. - */ - @Deprecated - String getId(); - - /** - *

- * Returns the name of the key configuration represented by this handle, - * suitable for display to the user. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the name of the key configuration represented by this handle. - * Guaranteed not to be null. - * @throws NotDefinedException if the key configuration represented by this - * handle is not defined. - */ - @Deprecated - String getName() throws NotDefinedException; - - /** - *

- * Returns the identifier of the parent of the key configuration represented by - * this handle. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return the identifier of the parent of the key configuration represented by - * this handle. May be null. - * @throws NotDefinedException if the key configuration represented by this - * handle is not defined. - */ - @Deprecated - String getParentId() throws NotDefinedException; - - /** - *

- * Returns whether or not this command is active. Instances of - * ICommand are activated and deactivated by the instance of - * ICommandManager from whence they were brokered. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return true, iff this command is active. - */ - @Deprecated - boolean isActive(); - - /** - *

- * Returns whether or not the key configuration represented by this handle is - * defined. - *

- *

- * Notification is sent to all registered listeners if this attribute changes. - *

- * - * @return true, iff the key configuration represented by this - * handle is defined. - */ - @Deprecated - boolean isDefined(); - - /** - * Unregisters an instance of IKeyConfigurationListener listening - * for changes to attributes of this instance. - * - * @param keyConfigurationListener the instance of - * IKeyConfigurationListener to - * unregister. Must not be null. If - * an attempt is made to unregister an instance - * of IKeyConfigurationListener - * which is not already registered with this - * instance, no operation is performed. - */ - @Deprecated - void removeKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java deleted file mode 100644 index 28f87f02464..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeyConfigurationListener.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -/** - *

- * An instance of IKeyConfigurationListener can be used by clients - * to receive notification of changes to one or more instances of - * IKeyConfiguration. - *

- *

- * This interface may be implemented by clients. - *

- * - * @since 3.0 - * @see IKeyConfiguration#addKeyConfigurationListener(IKeyConfigurationListener) - * @see IKeyConfiguration#removeKeyConfigurationListener(IKeyConfigurationListener) - * @see org.eclipse.ui.commands.KeyConfigurationEvent - * @deprecated Please use the bindings support in the "org.eclipse.jface" - * plug-in instead. This API is scheduled for deletion, see Bug - * 431177 for details - * @see org.eclipse.jface.bindings.ISchemeListener - * @noreference This interface is scheduled for deletion. - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface IKeyConfigurationListener { - - /** - * Notifies that one or more attributes of an instance of - * IKeyConfiguration have changed. Specific details are described - * in the KeyConfigurationEvent. - * - * @param keyConfigurationEvent the keyConfiguration event. Guaranteed not to be - * null. - */ - @Deprecated - void keyConfigurationChanged(KeyConfigurationEvent keyConfigurationEvent); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java deleted file mode 100644 index 1ad110f19f4..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IKeySequenceBinding.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -import org.eclipse.ui.keys.KeySequence; - -/** - *

- * An instance of IKeySequenceBinding represents a binding between - * a command and a key sequence. This is a wrapper for the a key sequence. - *

- *

- * This interface is not intended to be extended or implemented by clients. - *

- * - * @since 3.0 - * @see org.eclipse.ui.commands.ICommand - * @deprecated Please use the bindings support in the "org.eclipse.jface" - * plug-in instead. This API is scheduled for deletion, see Bug - * 431177 for details - * @see org.eclipse.jface.bindings.keys.KeyBinding - * @noimplement This interface is not intended to be implemented by clients. - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface IKeySequenceBinding extends Comparable { - - /** - * Returns the key sequence represented in this binding. - * - * @return the key sequence. Guaranteed not to be null. - */ - @Deprecated - KeySequence getKeySequence(); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java deleted file mode 100644 index 7524d20300b..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/IWorkbenchCommandSupport.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -import java.util.Collection; - -/** - * An instance of this interface provides support for managing commands at the - * IWorkbench level. - *

- * This interface is not intended to be extended or implemented by clients. - *

- * - * @since 3.0 - * @deprecated Please use ICommandService and - * IHandlerService instead. This API is scheduled for - * deletion, see Bug 431177 for details - * @see org.eclipse.ui.commands.ICommandService - * @see org.eclipse.ui.handlers.IHandlerService - * @noimplement This interface is not intended to be implemented by clients. - * @noreference This interface is scheduled for deletion. - * @noextend This interface is not intended to be extended by clients. - */ -@Deprecated -@SuppressWarnings("all") -public interface IWorkbenchCommandSupport { - - /** - * Adds a single handler submissions for consideration by the workbench. The - * submission indicates to the workbench a set of conditions under which the - * handler should become active. The workbench, however, ultimately decides - * which handler becomes active (in the event of conflicts or changes in state). - * This could cause the handlers for one or more commands to change. - * - * @param handlerSubmission The submission to be added; must not be - * null. - */ - @Deprecated - void addHandlerSubmission(HandlerSubmission handlerSubmission); - - /** - * Adds a collection of handler submissions for consideration by the workbench. - * The submission indicates to the workbench a set of conditions under which the - * handler should become active. The workbench, however, ultimately decides - * which handler becomes active (in the event of conflicts or changes in state). - * This could cause the handlers for one or more commands to change. - * - * @param handlerSubmissions The submissions to be added; must not be - * null, and must contain zero or more - * instances of HandlerSubmission. - */ - @Deprecated - void addHandlerSubmissions(Collection handlerSubmissions); - - /** - * Returns the command manager for the workbench. - * - * @return the command manager for the workbench. Guaranteed not to be - * null. - */ - @Deprecated - ICommandManager getCommandManager(); - - /** - * Removes a single handler submission from consideration by the workbench. The - * handler submission must be the same as the one added (not just equivalent). - * This could cause the handlers for one or more commands to change. - * - * @param handlerSubmission The submission to be removed; must not be - * null. - */ - @Deprecated - void removeHandlerSubmission(HandlerSubmission handlerSubmission); - - /** - * Removes a single handler submission from consideration by the workbench. The - * handler submission must be the same as the one added (not just equivalent). - * This could cause the handlers for one or more commands to change. - * - * @param handlerSubmissions The submissions to be removed; must not be - * null, and must contain instances of - * HandlerSubmission only. - */ - @Deprecated - void removeHandlerSubmissions(Collection handlerSubmissions); -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java deleted file mode 100644 index d9555b1bc7e..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/KeyConfigurationEvent.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.commands; - -/** - * An instance of this class describes changes to an instance of - * IKeyConfiguration. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @see IKeyConfigurationListener#keyConfigurationChanged(KeyConfigurationEvent) - * @deprecated Please use the bindings support in the "org.eclipse.jface" - * plug-in instead. This API is scheduled for deletion, see Bug - * 431177 for details - * @see org.eclipse.jface.bindings.SchemeEvent - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class KeyConfigurationEvent { - - /** - * whether the key configuration has become or active or inactive. - */ - private final boolean activeChanged; - - /** - * Whether the key configuration has become defined or undefined. - */ - private final boolean definedChanged; - - /** - * The key configuration that has changed; this value is never - * null. - */ - private final IKeyConfiguration keyConfiguration; - - /** - * Whether the name of the key configuration has changed. - */ - private final boolean nameChanged; - - /** - * Whether the parent identifier has changed. - */ - private final boolean parentIdChanged; - - /** - * Creates a new instance of this class. - * - * @param keyConfiguration the instance of the interface that changed. - * @param activeChanged true, iff the active property changed. - * @param definedChanged true, iff the defined property changed. - * @param nameChanged true, iff the name property changed. - * @param parentIdChanged true, iff the parentId property changed. - */ - @Deprecated - public KeyConfigurationEvent(IKeyConfiguration keyConfiguration, boolean activeChanged, boolean definedChanged, - boolean nameChanged, boolean parentIdChanged) { - if (keyConfiguration == null) { - throw new NullPointerException(); - } - - this.keyConfiguration = keyConfiguration; - this.activeChanged = activeChanged; - this.definedChanged = definedChanged; - this.nameChanged = nameChanged; - this.parentIdChanged = parentIdChanged; - } - - /** - * Returns the instance of the interface that changed. - * - * @return the instance of the interface that changed. Guaranteed not to be - * null. - */ - @Deprecated - public IKeyConfiguration getKeyConfiguration() { - return keyConfiguration; - } - - /** - * Returns whether or not the active property changed. - * - * @return true, iff the active property changed. - */ - @Deprecated - public boolean hasActiveChanged() { - return activeChanged; - } - - /** - * Returns whether or not the defined property changed. - * - * @return true, iff the defined property changed. - */ - @Deprecated - public boolean hasDefinedChanged() { - return definedChanged; - } - - /** - * Returns whether or not the name property changed. - * - * @return true, iff the name property changed. - */ - @Deprecated - public boolean hasNameChanged() { - return nameChanged; - } - - /** - * Returns whether or not the parentId property changed. - * - * @return true, iff the parentId property changed. - */ - @Deprecated - public boolean hasParentIdChanged() { - return parentIdChanged; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java deleted file mode 100644 index fd0569b9b11..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotDefinedException.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * Signals that an attempt was made to access the properties of an undefined - * object. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.common.NotDefinedException - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class NotDefinedException extends CommandException { - - /** - * Generated serial version UID for this class. - * - * @since 3.1 - */ - private static final long serialVersionUID = 3257572788998124596L; - - /** - * Creates a new instance of this class with the specified detail message. - * - * @param s the detail message. - */ - @Deprecated - public NotDefinedException(String s) { - super(s); - } - - /** - * Constructs a legacy NotDefinedException based on the new - * NotDefinedException. - * - * @param e The exception from which this exception should be created; must not - * be null. - * @since 3.1 - */ - @Deprecated - public NotDefinedException(final org.eclipse.core.commands.common.NotDefinedException e) { - super(e.getMessage(), e); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java deleted file mode 100644 index e968113eed5..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/NotHandledException.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -/** - * Signals that an attempt was made to access the properties of an unhandled - * object. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @deprecated Please use the "org.eclipse.core.commands" plug-in instead. This - * API is scheduled for deletion, see Bug 431177 for details - * @see org.eclipse.core.commands.NotHandledException - * @noreference This class is scheduled for deletion. - */ -@Deprecated -@SuppressWarnings("all") -public final class NotHandledException extends CommandException { - - /** - * Generated serial version UID for this class. - * - * @since 3.1 - */ - private static final long serialVersionUID = 3256446914827726904L; - - /** - * Creates a new instance of this class with the specified detail message. - * - * @param s the detail message. - */ - @Deprecated - public NotHandledException(String s) { - super(s); - } - - /** - * Constructs a legacy NotHandledException based on the new - * NotHandledException - * - * @param e The exception from which this exception should be created; must not - * be null. - * @since 3.1 - */ - @Deprecated - public NotHandledException(final org.eclipse.core.commands.NotHandledException e) { - super(e.getMessage(), e); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java deleted file mode 100644 index deef616d060..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/Priority.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.commands; - -import org.eclipse.core.expressions.Expression; -import org.eclipse.ui.ISources; -import org.eclipse.ui.internal.util.Util; - -/** - *

- * An instance of this interface represents a priority for use with instances of - * HandlerSubmission. - *

- *

- * The order of precedence (from highest to lowest) is as follows. Submissions - * with higher priority will be preferred over those with lower priority. - *

- *
    - *
  1. MEDIUM
  2. - *
  3. LOW
  4. - *
  5. LEGACY
  6. - *
- *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - * @see HandlerSubmission - * @see org.eclipse.ui.ISources - * @see org.eclipse.ui.handlers.IHandlerService#activateHandler(String, - * org.eclipse.core.commands.IHandler, Expression) - * @deprecated This concept is now captured in the ISources integer - * constants. This API is scheduled for deletion, see Bug 431177 for - * details - * @noreference This class is scheduled for deletion. - */ -@Deprecated -public final class Priority implements Comparable { - - /** - * An instance representing 'legacy' priority. - */ - public static final Priority LEGACY = new Priority(ISources.LEGACY_LEGACY); - - /** - * An instance representing 'low' priority. - */ - public static final Priority LOW = new Priority(ISources.LEGACY_LOW); - - /** - * An instance representing 'medium' priority. - */ - public static final Priority MEDIUM = new Priority(ISources.LEGACY_MEDIUM); - - /** - * The string representation of this priority. This is computed once (lazily). - * Before it is computed, this value is null. - */ - private transient String string = null; - - /** - * The priority value for this instance. A lesser integer is considered to have - * a higher priority. - */ - private int value; - - /** - * Constructs a new instance of Priority using a value. This - * constructor should only be used internally. Priority instances should be - * retrieved from the static members defined above. - * - * @param value The priority value; a lesser integer is consider to have a - * higher priority value. - */ - private Priority(int value) { - this.value = value; - } - - /** - * @see Comparable#compareTo(java.lang.Object) - */ - @Override - @Deprecated - public int compareTo(Object object) { - Priority castedObject = (Priority) object; - return Util.compare(value, castedObject.value); - } - - /** - * The value for this priority. The lesser the value, the higher priority this - * represents. - * - * @return The integer priority value. - */ - @Deprecated - int getValue() { - return value; - } - - /** - * @see Object#toString() - */ - @Override - @Deprecated - public String toString() { - if (string == null) { - final StringBuilder stringBuffer = new StringBuilder(); - stringBuffer.append("[value="); //$NON-NLS-1$ - stringBuffer.append(value); - stringBuffer.append(']'); - string = stringBuffer.toString(); - } - - return string; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java index 25853abd436..4dbcdd4865b 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java @@ -189,7 +189,6 @@ import org.eclipse.ui.browser.IWorkbenchBrowserSupport; import org.eclipse.ui.commands.ICommandImageService; import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.contexts.IWorkbenchContextSupport; import org.eclipse.ui.handlers.IHandlerService; @@ -202,7 +201,6 @@ import org.eclipse.ui.internal.commands.CommandImageManager; import org.eclipse.ui.internal.commands.CommandImageService; import org.eclipse.ui.internal.commands.CommandService; -import org.eclipse.ui.internal.commands.WorkbenchCommandSupport; import org.eclipse.ui.internal.contexts.ActiveContextSourceProvider; import org.eclipse.ui.internal.contexts.ContextService; import org.eclipse.ui.internal.contexts.WorkbenchContextSupport; @@ -2413,8 +2411,6 @@ public void runWithException() { } }); workbenchContextSupport = new WorkbenchContextSupport(this, contextManager); - workbenchCommandSupport = new WorkbenchCommandSupport(bindingManager, commandManager, contextManager, - handlerService[0]); initializeCommandResolver(); bindingManager.addBindingManagerListener(bindingManagerListener); @@ -3167,8 +3163,6 @@ public IProgressService getProgressService() { private WorkbenchActivitySupport workbenchActivitySupport; - private WorkbenchCommandSupport workbenchCommandSupport; - private WorkbenchContextSupport workbenchContextSupport; /** @@ -3206,11 +3200,6 @@ public IWorkbenchActivitySupport getActivitySupport() { return e4Context.get(IWorkbenchActivitySupport.class); } - @Override - public IWorkbenchCommandSupport getCommandSupport() { - return workbenchCommandSupport; - } - @Override public IWorkbenchContextSupport getContextSupport() { return workbenchContextSupport; diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java deleted file mode 100644 index 8f737f6e28b..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandLegacyWrapper.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Lars Vogel - Bug 440810 - *******************************************************************************/ -package org.eclipse.ui.internal.commands; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ParameterizedCommand; -import org.eclipse.jface.bindings.BindingManager; -import org.eclipse.jface.bindings.TriggerSequence; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ExecutionException; -import org.eclipse.ui.commands.ICommand; -import org.eclipse.ui.commands.ICommandListener; -import org.eclipse.ui.commands.NotDefinedException; -import org.eclipse.ui.commands.NotHandledException; -import org.eclipse.ui.handlers.IHandlerService; -import org.eclipse.ui.internal.keys.KeySequenceBinding; -import org.eclipse.ui.keys.IBindingService; -import org.eclipse.ui.keys.KeySequence; - -/** - * A wrapper around a core command so that it satisfies the deprecated - * ICommand interface. - * - * @since 3.1 - */ -final class CommandLegacyWrapper implements ICommand { - - /** - * The supporting binding manager; never null. - */ - private final BindingManager bindingManager; - - /** - * The wrapped command; never null. - */ - private final Command command; - - /** - * A parameterized representation of the command. This is created lazily. If it - * has not yet been created, it is null. - */ - private ParameterizedCommand parameterizedCommand; - - /** - * Constructs a new CommandWrapper - * - * @param command The command to be wrapped; must not be - * null. - * @param bindingManager The binding manager to support this wrapper; must not - * be null. - */ - CommandLegacyWrapper(final Command command, final BindingManager bindingManager) { - if (command == null) { - throw new NullPointerException("The wrapped command cannot be null."); //$NON-NLS-1$ - } - - if (bindingManager == null) { - throw new NullPointerException("A binding manager is required to wrap a command"); //$NON-NLS-1$ - } - - this.command = command; - this.bindingManager = bindingManager; - } - - @Override - public void addCommandListener(final ICommandListener commandListener) { - command.addCommandListener(new LegacyCommandListenerWrapper(commandListener, bindingManager)); - } - - @Override - public Object execute(Map parameterValuesByName) throws ExecutionException, NotHandledException { - try { - IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class); - - return command.execute(new ExecutionEvent(command, - (parameterValuesByName == null) ? Collections.EMPTY_MAP : parameterValuesByName, null, - service.getCurrentState())); - } catch (final org.eclipse.core.commands.ExecutionException e) { - throw new ExecutionException(e); - } catch (final org.eclipse.core.commands.NotHandledException e) { - throw new NotHandledException(e); - } - } - - @Override - public Map getAttributeValuesByName() { - final Map attributeValues = new HashMap<>(); - // avoid using Boolean.valueOf to allow compilation against JCL - // Foundation (bug 80053) - attributeValues.put(ILegacyAttributeNames.ENABLED, command.isEnabled() ? Boolean.TRUE : Boolean.FALSE); - attributeValues.put(ILegacyAttributeNames.HANDLED, command.isHandled() ? Boolean.TRUE : Boolean.FALSE); - return attributeValues; - } - - @Override - public String getCategoryId() throws NotDefinedException { - try { - return command.getCategory().getId(); - } catch (final org.eclipse.core.commands.common.NotDefinedException e) { - throw new NotDefinedException(e); - } - } - - @Override - public String getDescription() throws NotDefinedException { - try { - return command.getDescription(); - } catch (final org.eclipse.core.commands.common.NotDefinedException e) { - throw new NotDefinedException(e); - } - } - - @Override - public String getId() { - return command.getId(); - } - - @Override - public List getKeySequenceBindings() { - final List legacyBindings = new ArrayList<>(); - if (parameterizedCommand == null) { - parameterizedCommand = new ParameterizedCommand(command, null); - } - IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class); - final TriggerSequence[] activeBindings = bindingService.getActiveBindingsFor(parameterizedCommand); - final int activeBindingsCount = activeBindings.length; - for (int i = 0; i < activeBindingsCount; i++) { - final TriggerSequence triggerSequence = activeBindings[i]; - if (triggerSequence instanceof org.eclipse.jface.bindings.keys.KeySequence) { - legacyBindings.add(new KeySequenceBinding( - KeySequence.getInstance((org.eclipse.jface.bindings.keys.KeySequence) triggerSequence), 0)); - } - } - - return legacyBindings; - } - - @Override - public String getName() throws NotDefinedException { - try { - return command.getName(); - } catch (final org.eclipse.core.commands.common.NotDefinedException e) { - throw new NotDefinedException(e); - } - } - - @Override - public boolean isDefined() { - return command.isDefined(); - } - - @Override - public boolean isHandled() { - return command.isHandled(); - } - - @Override - public void removeCommandListener(final ICommandListener commandListener) { - command.removeCommandListener(new LegacyCommandListenerWrapper(commandListener, bindingManager)); - } - - @Override - public int compareTo(final Object o) { - return command.compareTo(o); - } - -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java deleted file mode 100644 index 1ce8578a388..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.internal.commands; - -import org.eclipse.core.commands.CommandManager; -import org.eclipse.core.commands.contexts.ContextManager; -import org.eclipse.jface.bindings.BindingManager; - -/** - * This class allows clients to broker instances of - * ICommandManager. - *

- * This class is not intended to be extended by clients. - *

- * - * @since 3.0 - */ -public final class CommandManagerFactory { - - /** - * Creates a new instance of IMutableCommandManager. - * - * @param bindingManager The binding manager providing support for the command - * manager; must not be null. - * @param commandManager The command manager providing support for this command - * manager; must not be null. - * @param contextManager The context manager for this command manager; must not - * be null. - * @return a new instance of IMutableCommandManager. Clients should - * not make assumptions about the concrete implementation outside the - * contract of the interface. Guaranteed not to be null. - */ - public static CommandManagerLegacyWrapper getCommandManagerWrapper(final BindingManager bindingManager, - final CommandManager commandManager, final ContextManager contextManager) { - return new CommandManagerLegacyWrapper(bindingManager, commandManager, contextManager); - } - - private CommandManagerFactory() { - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java deleted file mode 100644 index 4ac2f8aebdc..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandManagerLegacyWrapper.java +++ /dev/null @@ -1,406 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.commands; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.CommandManager; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.contexts.ContextManager; -import org.eclipse.core.commands.contexts.ContextManagerEvent; -import org.eclipse.core.commands.contexts.IContextManagerListener; -import org.eclipse.e4.core.commands.internal.HandlerServiceImpl; -import org.eclipse.jface.bindings.Binding; -import org.eclipse.jface.bindings.BindingManager; -import org.eclipse.jface.bindings.BindingManagerEvent; -import org.eclipse.jface.bindings.IBindingManagerListener; -import org.eclipse.jface.bindings.Scheme; -import org.eclipse.jface.bindings.TriggerSequence; -import org.eclipse.jface.bindings.keys.ParseException; -import org.eclipse.ui.commands.CommandManagerEvent; -import org.eclipse.ui.commands.ICategory; -import org.eclipse.ui.commands.ICommand; -import org.eclipse.ui.commands.ICommandManager; -import org.eclipse.ui.commands.ICommandManagerListener; -import org.eclipse.ui.commands.IKeyConfiguration; -import org.eclipse.ui.internal.handlers.LegacyHandlerWrapper; -import org.eclipse.ui.internal.keys.SchemeLegacyWrapper; -import org.eclipse.ui.internal.util.Util; -import org.eclipse.ui.keys.KeySequence; -import org.eclipse.ui.keys.KeyStroke; - -/** - * Provides support for the old ICommandManager interface. - * - * @since 3.1 - */ -public final class CommandManagerLegacyWrapper implements ICommandManager, - org.eclipse.core.commands.ICommandManagerListener, IBindingManagerListener, IContextManagerListener { - - /** - * Whether commands should print out information about which handlers are being - * executed. Change this value if you want console output on command execution. - */ - public static boolean DEBUG_COMMAND_EXECUTION = false; - - /** - * Whether commands should print out information about handler changes. Change - * this value if you want console output when commands change handlers. - */ - public static boolean DEBUG_HANDLERS = false; - - /** - * Which command should print out debugging information. Change this value if - * you want to only here when a command with a particular identifier changes its - * handler. - */ - public static String DEBUG_HANDLERS_COMMAND_ID = null; - - static boolean validateKeySequence(KeySequence keySequence) { - if (keySequence == null) { - return false; - } - List keyStrokes = keySequence.getKeyStrokes(); - int size = keyStrokes.size(); - if (size == 0 || size > 4 || !keySequence.isComplete()) { - return false; - } - return true; - } - - /** - * The JFace binding machine that provides binding support for this workbench - * mutable command manager. This value will never be null. - * - * @since 3.1 - */ - private final BindingManager bindingManager; - - /** - * The command manager that provides functionality for this workbench command - * manager. This value will never be null. - * - * @since 3.1 - */ - private final CommandManager commandManager; - - private List commandManagerListeners; - - /** - * The context manager that provides functionality for this workbench command - * manager. This value will never be null. - * - * @since 3.1 - */ - private final ContextManager contextManager; - - /** - * Constructs a new instance of MutableCommandManager. The binding - * manager and command manager providing support for this manager are - * constructed at this time. - * - * @param bindingManager The binding manager providing support for the command - * manager; must not be null. - * @param commandManager The command manager providing support for this command - * manager; must not be null. - * @param contextManager The context manager to provide context support to this - * manager. This value must not be null. - */ - public CommandManagerLegacyWrapper(final BindingManager bindingManager, final CommandManager commandManager, - final ContextManager contextManager) { - if (contextManager == null) { - throw new NullPointerException("The context manager cannot be null."); //$NON-NLS-1$ - } - this.bindingManager = bindingManager; - this.commandManager = commandManager; - this.contextManager = contextManager; - } - - @Override - public void addCommandManagerListener(final ICommandManagerListener commandManagerListener) { - if (commandManagerListener == null) { - throw new NullPointerException("Cannot add a null listener."); //$NON-NLS-1$ - } - - if (commandManagerListeners == null) { - commandManagerListeners = new ArrayList<>(); - this.commandManager.addCommandManagerListener(this); - this.bindingManager.addBindingManagerListener(this); - this.contextManager.addContextManagerListener(this); - } - - if (!commandManagerListeners.contains(commandManagerListener)) { - commandManagerListeners.add(commandManagerListener); - } - } - - @Override - public void bindingManagerChanged(final BindingManagerEvent event) { - final boolean schemeDefinitionsChanged = event.getScheme() != null; - final Set previousSchemes; - if (schemeDefinitionsChanged) { - previousSchemes = new HashSet<>(); - final Scheme scheme = event.getScheme(); - final Scheme[] definedSchemes = event.getManager().getDefinedSchemes(); - final int definedSchemesCount = definedSchemes.length; - for (int i = 0; i < definedSchemesCount; i++) { - final Scheme definedScheme = definedSchemes[0]; - if ((definedScheme == scheme) && (event.isSchemeDefined())) { - continue; // skip this one, it was just defined. - } - previousSchemes.add(definedSchemes[0].getId()); - } - if (!event.isSchemeDefined()) { - previousSchemes.add(scheme.getId()); - } - } else { - previousSchemes = null; - } - - fireCommandManagerChanged(new CommandManagerEvent(this, false, event.isActiveSchemeChanged(), - event.isLocaleChanged(), event.isPlatformChanged(), false, false, schemeDefinitionsChanged, null, null, - previousSchemes)); - } - - @Override - public void commandManagerChanged(final org.eclipse.core.commands.CommandManagerEvent event) { - // Figure out the set of previous category identifiers. - final boolean categoryIdsChanged = event.isCategoryChanged(); - final Set previousCategoryIds; - if (categoryIdsChanged) { - previousCategoryIds = new HashSet(commandManager.getDefinedCategoryIds()); - final String categoryId = event.getCategoryId(); - if (event.isCategoryDefined()) { - previousCategoryIds.remove(categoryId); - } else { - previousCategoryIds.add(categoryId); - } - } else { - previousCategoryIds = null; - } - - // Figure out the set of previous command identifiers. - final boolean commandIdsChanged = event.isCommandChanged(); - final Set previousCommandIds; - if (commandIdsChanged) { - previousCommandIds = new HashSet(commandManager.getDefinedCommandIds()); - final String commandId = event.getCommandId(); - if (event.isCommandDefined()) { - previousCommandIds.remove(commandId); - } else { - previousCommandIds.add(commandId); - } - } else { - previousCommandIds = null; - } - - fireCommandManagerChanged(new CommandManagerEvent(this, false, false, false, false, categoryIdsChanged, - commandIdsChanged, false, previousCategoryIds, previousCommandIds, null)); - } - - @Override - public void contextManagerChanged(final ContextManagerEvent event) { - fireCommandManagerChanged(new CommandManagerEvent(this, event.isActiveContextsChanged(), false, false, false, - false, false, false, null, null, null)); - } - - private void fireCommandManagerChanged(CommandManagerEvent commandManagerEvent) { - if (commandManagerEvent == null) { - throw new NullPointerException(); - } - if (commandManagerListeners != null) { - for (ICommandManagerListener commandManagerListener : commandManagerListeners) { - commandManagerListener.commandManagerChanged(commandManagerEvent); - } - } - } - - @Override - public Set getActiveContextIds() { - return contextManager.getActiveContextIds(); - } - - @Override - public String getActiveKeyConfigurationId() { - final Scheme scheme = bindingManager.getActiveScheme(); - if (scheme != null) { - return scheme.getId(); - } - - /* - * TODO This is possibly a breaking change. The id should be non-null, and - * presumably, a real scheme id. - */ - return Util.ZERO_LENGTH_STRING; - } - - @Override - public String getActiveLocale() { - return bindingManager.getLocale(); - } - - @Override - public String getActivePlatform() { - return bindingManager.getPlatform(); - } - - @Override - public ICategory getCategory(String categoryId) { - // TODO Provide access to the categories. - // return new CategoryWrapper(commandManager.getCategory(categoryId)); - return null; - } - - @Override - public ICommand getCommand(String commandId) { - final Command command = commandManager.getCommand(commandId); - if (!command.isDefined()) { - command.setHandler(HandlerServiceImpl.getHandler(commandId)); - } - return new CommandLegacyWrapper(command, bindingManager); - } - - @Override - public Set getDefinedCategoryIds() { - return commandManager.getDefinedCategoryIds(); - } - - @Override - public Set getDefinedCommandIds() { - return commandManager.getDefinedCommandIds(); - } - - @Override - public Set getDefinedKeyConfigurationIds() { - final Set definedIds = new HashSet<>(); - final Scheme[] schemes = bindingManager.getDefinedSchemes(); - for (Scheme scheme : schemes) { - definedIds.add(scheme.getId()); - } - return definedIds; - } - - @Override - public IKeyConfiguration getKeyConfiguration(String keyConfigurationId) { - final Scheme scheme = bindingManager.getScheme(keyConfigurationId); - return new SchemeLegacyWrapper(scheme, bindingManager); - } - - @Override - public Map getPartialMatches(KeySequence keySequence) { - try { - final org.eclipse.jface.bindings.keys.KeySequence sequence = org.eclipse.jface.bindings.keys.KeySequence - .getInstance(keySequence.toString()); - final Map partialMatches = bindingManager.getPartialMatches(sequence); - final Map returnValue = new HashMap<>(); - final Iterator> matchItr = partialMatches.entrySet().iterator(); - while (matchItr.hasNext()) { - final Map.Entry entry = matchItr.next(); - final TriggerSequence trigger = entry.getKey(); - if (trigger instanceof org.eclipse.jface.bindings.keys.KeySequence) { - final org.eclipse.jface.bindings.keys.KeySequence triggerKey = (org.eclipse.jface.bindings.keys.KeySequence) trigger; - returnValue.put(KeySequence.getInstance(triggerKey.toString()), entry.getValue()); - } - } - return returnValue; - } catch (final ParseException | org.eclipse.ui.keys.ParseException e) { - return new HashMap<>(); - } - } - - @Override - public String getPerfectMatch(KeySequence keySequence) { - try { - final org.eclipse.jface.bindings.keys.KeySequence sequence = org.eclipse.jface.bindings.keys.KeySequence - .getInstance(keySequence.toString()); - final Binding binding = bindingManager.getPerfectMatch(sequence); - if (binding == null) { - return null; - } - - return binding.getParameterizedCommand().getId(); - - } catch (final ParseException e) { - return null; - } - } - - @Override - public boolean isPartialMatch(KeySequence keySequence) { - try { - final org.eclipse.jface.bindings.keys.KeySequence sequence = org.eclipse.jface.bindings.keys.KeySequence - .getInstance(keySequence.toString()); - return bindingManager.isPartialMatch(sequence); - } catch (final ParseException e) { - return false; - } - } - - @Override - public boolean isPerfectMatch(KeySequence keySequence) { - try { - final org.eclipse.jface.bindings.keys.KeySequence sequence = org.eclipse.jface.bindings.keys.KeySequence - .getInstance(keySequence.toString()); - return bindingManager.isPerfectMatch(sequence); - } catch (final ParseException e) { - return false; - } - } - - @Override - public void removeCommandManagerListener(ICommandManagerListener commandManagerListener) { - if (commandManagerListener == null) { - throw new NullPointerException("Cannot remove a null listener"); //$NON-NLS-1$ - } - - if (commandManagerListeners != null) { - commandManagerListeners.remove(commandManagerListener); - if (commandManagerListeners.isEmpty()) { - commandManagerListeners = null; - this.commandManager.removeCommandManagerListener(this); - this.bindingManager.removeBindingManagerListener(this); - this.contextManager.removeContextManagerListener(this); - } - } - } - - /** - * Updates the handlers for a block of commands all at once. - * - * @param handlersByCommandId The map of command identifier - * (String) to handler - * (IHandler). - */ - public void setHandlersByCommandId(final Map handlersByCommandId) { - // Wrap legacy handlers so they can be passed to the new API. - final Iterator> entryItr = handlersByCommandId.entrySet().iterator(); - while (entryItr.hasNext()) { - final Map.Entry entry = entryItr.next(); - final Object handler = entry.getValue(); - if (handler instanceof org.eclipse.ui.commands.IHandler) { - final String commandId = entry.getKey(); - handlersByCommandId.put(commandId, - new LegacyHandlerWrapper((org.eclipse.ui.commands.IHandler) handler)); - } - } - - commandManager.setHandlersByCommandId(handlersByCommandId); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java deleted file mode 100644 index c16951d507a..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/LegacyCommandListenerWrapper.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.commands; - -import org.eclipse.core.commands.CommandEvent; -import org.eclipse.core.commands.ICommandListener; -import org.eclipse.jface.bindings.BindingManager; -import org.eclipse.ui.commands.ICommand; - -/** - * Wraps a legacy listener in a new listener interface. This simply forwards - * incoming events through to the old interface. - * - * @since 3.1 - */ -final class LegacyCommandListenerWrapper implements ICommandListener { - - /** - * The supporting binding manager; never null. - */ - private final BindingManager bindingManager; - - /** - * The listener which is being wrapped. This value should never be - * null. - */ - private final org.eclipse.ui.commands.ICommandListener listener; - - /** - * Constructs a new instance of CommandListenerWrapper around a - * legacy listener. - * - * @param listener The listener to be wrapped; must not be null. - */ - LegacyCommandListenerWrapper(final org.eclipse.ui.commands.ICommandListener listener, - final BindingManager bindingManager) { - if (listener == null) { - throw new NullPointerException("Cannot wrap a null listener."); //$NON-NLS-1$ - } - - if (bindingManager == null) { - throw new NullPointerException("Cannot create a listener wrapper without a binding manager"); //$NON-NLS-1$ - } - - this.listener = listener; - this.bindingManager = bindingManager; - } - - @Override - public void commandChanged(final CommandEvent commandEvent) { - final ICommand command = new CommandLegacyWrapper(commandEvent.getCommand(), bindingManager); - final boolean definedChanged = commandEvent.isDefinedChanged(); - final boolean descriptionChanged = commandEvent.isDescriptionChanged(); - final boolean handledChanged = commandEvent.isHandledChanged(); - final boolean nameChanged = commandEvent.isNameChanged(); - - listener.commandChanged(new org.eclipse.ui.commands.CommandEvent(command, false, false, definedChanged, - descriptionChanged, handledChanged, false, nameChanged, null)); - - } - - @Override - public boolean equals(final Object object) { - if (object instanceof LegacyCommandListenerWrapper) { - final LegacyCommandListenerWrapper wrapper = (LegacyCommandListenerWrapper) object; - return listener.equals(wrapper.listener); - } - - if (object instanceof org.eclipse.ui.commands.ICommandListener) { - final org.eclipse.ui.commands.ICommandListener other = (org.eclipse.ui.commands.ICommandListener) object; - return listener.equals(other); - } - - return false; - } - - @Override - public int hashCode() { - return listener.hashCode(); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java deleted file mode 100644 index 33d85b03fa1..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.commands; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.core.commands.CommandManager; -import org.eclipse.core.commands.contexts.ContextManager; -import org.eclipse.jface.bindings.BindingManager; -import org.eclipse.ui.LegacyHandlerSubmissionExpression; -import org.eclipse.ui.commands.HandlerSubmission; -import org.eclipse.ui.commands.ICommandManager; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.handlers.IHandlerActivation; -import org.eclipse.ui.handlers.IHandlerService; -import org.eclipse.ui.internal.handlers.LegacyHandlerWrapper; - -/** - * Provides command support in terms of the workbench. - * - * @since 3.0 - */ -public class WorkbenchCommandSupport implements IWorkbenchCommandSupport { - - /** - * The map of activations that have been given to the handler service - * (IHandlerActivation), indexed by the submissions - * (HandlerSubmission). This map should be null if - * there are no such activations. - */ - private Map activationsBySubmission = null; - - /** - * The mutable command manager that should be notified of changes to the list of - * active handlers. This value is never null. - */ - private final CommandManagerLegacyWrapper commandManagerWrapper; - - /** - * The handler service for the workbench. This value is never null. - */ - private final IHandlerService handlerService; - - /** - * Constructs a new instance of WorkbenchCommandSupport - * - * @param bindingManager The binding manager providing support for the command - * manager; must not be null. - * @param commandManager The command manager for the workbench; must not be - * null. - * @param contextManager The context manager providing support for the command - * manager and binding manager; must not be - * null. - * @param handlerService The handler service for the workbench; must not be - * null. - */ - public WorkbenchCommandSupport(final BindingManager bindingManager, final CommandManager commandManager, - final ContextManager contextManager, final IHandlerService handlerService) { - if (handlerService == null) { - throw new NullPointerException("The handler service cannot be null"); //$NON-NLS-1$ - } - - this.handlerService = handlerService; - - commandManagerWrapper = CommandManagerFactory.getCommandManagerWrapper(bindingManager, commandManager, - contextManager); - - // Initialize the old key formatter settings. - org.eclipse.ui.keys.KeyFormatterFactory - .setDefault(org.eclipse.ui.keys.SWTKeySupport.getKeyFormatterForPlatform()); - } - - @Override - public final void addHandlerSubmission(final HandlerSubmission handlerSubmission) { - final IHandlerActivation activation = handlerService.activateHandler(handlerSubmission.getCommandId(), - new LegacyHandlerWrapper(handlerSubmission.getHandler()), - new LegacyHandlerSubmissionExpression(handlerSubmission.getActivePartId(), - handlerSubmission.getActiveShell(), handlerSubmission.getActiveWorkbenchPartSite())); - if (activationsBySubmission == null) { - activationsBySubmission = new HashMap<>(); - } - activationsBySubmission.put(handlerSubmission, activation); - } - - @Override - public final void addHandlerSubmissions(final Collection handlerSubmissions) { - final Iterator submissionItr = handlerSubmissions.iterator(); - while (submissionItr.hasNext()) { - addHandlerSubmission(submissionItr.next()); - } - } - - @Override - public ICommandManager getCommandManager() { - return commandManagerWrapper; - } - - @Override - public final void removeHandlerSubmission(final HandlerSubmission handlerSubmission) { - if (activationsBySubmission == null) { - return; - } - - final IHandlerActivation activation = activationsBySubmission.remove(handlerSubmission); - if (activation != null) { - handlerService.deactivateHandler(activation); - } - } - - @Override - public final void removeHandlerSubmissions(final Collection handlerSubmissions) { - final Iterator submissionItr = handlerSubmissions.iterator(); - while (submissionItr.hasNext()) { - removeHandlerSubmission(submissionItr.next()); - } - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java index 9224c26e0ee..d761601513e 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/HandlerPersistence.java @@ -305,6 +305,7 @@ private void readHandlersFromRegistry(final IConfigurationElement[] configuratio * should be added; must not be * null. */ + @Deprecated private void readHandlerSubmissionsFromRegistry(final IConfigurationElement[] configurationElements, final int configurationElementCount) { final List warningsToLog = new ArrayList<>(1); @@ -318,9 +319,8 @@ private void readHandlerSubmissionsFromRegistry(final IConfigurationElement[] co if (commandId == null) { continue; } - - handlerActivations.add(handlerService.activateHandler(commandId, - new LegacyHandlerWrapper(new LegacyHandlerProxy(configurationElement)))); + throw new UnsupportedOperationException( + "org.eclipse.ui.commands.IHandler support removed: " + configurationElement.toString()); //$NON-NLS-1$ } logWarnings(warningsToLog, diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java deleted file mode 100644 index a314fbc7536..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerListenerWrapper.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.handlers; - -import org.eclipse.core.commands.IHandler; -import org.eclipse.ui.commands.HandlerEvent; -import org.eclipse.ui.commands.IHandlerListener; -import org.eclipse.ui.internal.commands.ILegacyAttributeNames; - -/** - * A wrapper so that the new handler listener can work with legacy handlers. - * This class is only intended for backward compatibility with Eclipse 3.0. - * - * @since 3.1 - */ -public final class LegacyHandlerListenerWrapper implements IHandlerListener { - - /** - * The handler on which this listener is listening; never null. - */ - private final IHandler handler; - - /** - * The wrapped listener; never null. - */ - private final org.eclipse.core.commands.IHandlerListener listener; - - /** - * Constructs a new instance of LegacyHandlerListenerWrapper. - * - * @param listener The listener to wrap; must not be null. - */ - public LegacyHandlerListenerWrapper(final IHandler handler, - final org.eclipse.core.commands.IHandlerListener listener) { - if (handler == null) { - throw new NullPointerException("A listener wrapper cannot be created on a null handler"); //$NON-NLS-1$ - } - - if (listener == null) { - throw new NullPointerException("A listener wrapper cannot be created on a null listener"); //$NON-NLS-1$ - } - - this.handler = handler; - this.listener = listener; - } - - @Override - public void handlerChanged(HandlerEvent event) { - final boolean enabledChanged = ((Boolean) event.getPreviousAttributeValuesByName() - .get(ILegacyAttributeNames.ENABLED)).booleanValue() != handler.isEnabled(); - final boolean handledChanged = ((Boolean) event.getPreviousAttributeValuesByName() - .get(ILegacyAttributeNames.HANDLED)).booleanValue() != handler.isHandled(); - listener.handlerChanged(new org.eclipse.core.commands.HandlerEvent(handler, enabledChanged, handledChanged)); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java deleted file mode 100644 index 8e4659453a3..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerProxy.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.internal.handlers; - -import java.util.Collections; -import java.util.Map; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.ui.commands.AbstractHandler; -import org.eclipse.ui.commands.ExecutionException; -import org.eclipse.ui.commands.IHandler; -import org.eclipse.ui.internal.WorkbenchPlugin; - -/** - *

- * A proxy for a handler that has been defined in XML. This delays the class - * loading until the handler is really asked for information (besides the - * priority or the command identifier). Asking a proxy for anything but the - * attributes defined publicly in this class will cause the proxy to instantiate - * the proxied handler. - *

- * - * @since 3.0 - */ -public final class LegacyHandlerProxy extends AbstractHandler { - - /** - * The name of the configuration element attribute which contains the - * information necessary to instantiate the real handler. - */ - private static final String HANDLER_ATTRIBUTE_NAME = "handler"; //$NON-NLS-1$ - - /** - * The configuration element from which the handler can be created. This value - * will exist until the element is converted into a real class -- at which point - * this value will be set to null. - */ - private IConfigurationElement configurationElement; - - /** - * The real handler. This value is null until the proxy is forced - * to load the real handler. At this point, the configuration element is - * converted, nulled out, and this handler gains a reference. - */ - private IHandler handler; - - /** - * Constructs a new instance of HandlerProxy with all the - * information it needs to try to avoid loading until it is needed. - * - * @param newConfigurationElement The configuration element from which the real - * class can be loaded at run-time. - */ - public LegacyHandlerProxy(final IConfigurationElement newConfigurationElement) { - configurationElement = newConfigurationElement; - handler = null; - } - - /** - * Passes the dipose on to the proxied handler, if it has been loaded. - */ - @Override - public void dispose() { - if (handler != null) { - handler.dispose(); - } - } - - @Override - public Object execute(Map parameters) throws ExecutionException { - if (loadHandler()) { - return handler.execute(parameters); - } - - return null; - } - - @Override - public Map getAttributeValuesByName() { - if (loadHandler()) { - return handler.getAttributeValuesByName(); - } - return Collections.EMPTY_MAP; - } - - /** - * Loads the handler, if possible. If the handler is loaded, then the member - * variables are updated accordingly. - * - * @return true if the handler is now non-null; false - * otherwise. - */ - private boolean loadHandler() { - if (handler == null) { - // Load the handler. - try { - handler = (IHandler) configurationElement.createExecutableExtension(HANDLER_ATTRIBUTE_NAME); - configurationElement = null; - return true; - } catch (final CoreException e) { - /* - * TODO If it can't be instantiated, should future attempts to instantiate be - * blocked? - */ - final String message = "The proxied handler for '" //$NON-NLS-1$ - + configurationElement.getAttribute(HANDLER_ATTRIBUTE_NAME) + "' could not be loaded"; //$NON-NLS-1$ - IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e); - WorkbenchPlugin.log(message, status); - return false; - } - } - - return true; - } - - @Override - public String toString() { - final StringBuilder buffer = new StringBuilder(); - - buffer.append("LegacyProxy("); //$NON-NLS-1$ - if (handler == null) { - final String className = configurationElement.getAttribute(HANDLER_ATTRIBUTE_NAME); - buffer.append(className); - } else { - buffer.append(handler); - } - buffer.append(')'); - - return buffer.toString(); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java deleted file mode 100644 index 7eca6010e15..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerWrapper.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.commands.util.Tracing; -import org.eclipse.ui.internal.commands.ILegacyAttributeNames; -import org.eclipse.ui.internal.misc.Policy; - -/** - * A handler that wraps a legacy handler. This provide backward compatibility - * with the handlers release in Eclipse 3.0. - * - * @since 3.1 - */ -public final class LegacyHandlerWrapper implements IHandler { - - /** - * This flag can be set to true if commands should print - * information to System.out when changing handlers. - */ - private static final boolean DEBUG_HANDLERS = Policy.DEBUG_HANDLERS && Policy.DEBUG_HANDLERS_VERBOSE; - - /** - * The wrapped handler; never null. - */ - private final org.eclipse.ui.commands.IHandler handler; - - /** - * Constructs a new instance of HandlerWrapper. - * - * @param handler The handler that should be wrapped; must not be - * null. - */ - public LegacyHandlerWrapper(final org.eclipse.ui.commands.IHandler handler) { - if (handler == null) { - throw new NullPointerException("A handler wrapper cannot be constructed on a null handler"); //$NON-NLS-1$ - } - - this.handler = handler; - } - - @Override - public void addHandlerListener(final IHandlerListener handlerListener) { - handler.addHandlerListener(new LegacyHandlerListenerWrapper(this, handlerListener)); - } - - @Override - public void dispose() { - handler.dispose(); - } - - @Override - public boolean equals(final Object object) { - if (object instanceof org.eclipse.ui.commands.IHandler) { - return this.handler == object; - } - - if (object instanceof LegacyHandlerWrapper) { - return this.handler == ((LegacyHandlerWrapper) object).handler; - } - - return false; - } - - @Override - public Object execute(final ExecutionEvent event) throws ExecutionException { - // Debugging output - if (DEBUG_HANDLERS) { - final StringBuilder buffer = new StringBuilder("Executing LegacyHandlerWrapper for "); //$NON-NLS-1$ - if (handler == null) { - buffer.append("no handler"); //$NON-NLS-1$ - } else { - buffer.append('\''); - buffer.append(handler.getClass().getName()); - buffer.append('\''); - } - Tracing.printTrace("HANDLERS", buffer.toString()); //$NON-NLS-1$ - } - - try { - return handler.execute(event.getParameters()); - } catch (final org.eclipse.ui.commands.ExecutionException e) { - throw new ExecutionException(e.getMessage(), e.getCause()); - } - } - - @Override - public int hashCode() { - return this.handler.hashCode(); - } - - @Override - public boolean isEnabled() { - final Object enabled = handler.getAttributeValuesByName().get(ILegacyAttributeNames.ENABLED); - if (enabled instanceof Boolean) { - return ((Boolean) enabled).booleanValue(); - } - - return true; - } - - @Override - public boolean isHandled() { - final Object handled = handler.getAttributeValuesByName().get(ILegacyAttributeNames.HANDLED); - if (handled instanceof Boolean) { - return ((Boolean) handled).booleanValue(); - } - - return true; - } - - @Override - public void removeHandlerListener(final IHandlerListener handlerListener) { - handler.removeHandlerListener(new LegacyHandlerListenerWrapper(this, handlerListener)); - } - - @Override - public String toString() { - final StringBuilder buffer = new StringBuilder(); - - buffer.append("LegacyHandlerWrapper("); //$NON-NLS-1$ - buffer.append(handler); - buffer.append(')'); - - return buffer.toString(); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java index 53de63c672a..d129e21bca1 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java @@ -41,7 +41,6 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ICommand; import org.eclipse.ui.help.AbstractHelpUI; import org.eclipse.ui.help.IWorkbenchHelpSystem; import org.eclipse.ui.internal.IWorkbenchHelpContextIds; @@ -674,30 +673,6 @@ public void setHelp(MenuItem item, Object[] contexts) { item.addHelpListener(getHelpListener()); } - /** - * Creates a new help listener for the given command. This retrieves the help - * context ID from the command, and creates an appropriate listener based on - * this. - * - * @param command The command for which the listener should be created; must not - * be null. - * @return A help listener; never null. - */ - public HelpListener createHelpListener(ICommand command) { - // TODO Need a help ID from the context - // final String contextId = command.getHelpId(); - final String contextId = ""; //$NON-NLS-1$ - return event -> { - if (getHelpUI() != null) { - IContext context = HelpSystem.getContext(contextId); - if (context != null) { - Point point = computePopUpLocation(event.widget.getDisplay()); - displayContext(context, point.x, point.y); - } - } - }; - } - @Override public void displayHelp() { AbstractHelpUI helpUI = getHelpUI(); diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java deleted file mode 100644 index 933cb30b34d..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/KeySequenceBinding.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.internal.keys; - -import java.util.Objects; -import org.eclipse.ui.commands.IKeySequenceBinding; -import org.eclipse.ui.internal.util.Util; -import org.eclipse.ui.keys.KeySequence; - -public final class KeySequenceBinding implements IKeySequenceBinding { - - /** - * This is the identifier for the default context. This is used wherever some - * default is needed. For example, this is the context that is used for key - * bindings that specify no context. This is also used to select a default - * context in the keys preference page. - */ - public static final String DEFAULT_CONTEXT_ID = "org.eclipse.ui.contexts.window"; //$NON-NLS-1$ - - private static final int HASH_FACTOR = 89; - - private static final int HASH_INITIAL = KeySequenceBinding.class.getName().hashCode(); - - private transient int hashCode; - - private transient boolean hashCodeComputed; - - private KeySequence keySequence; - - private int match; - - private transient String string; - - public KeySequenceBinding(KeySequence keySequence, int match) { - if (keySequence == null) { - throw new NullPointerException(); - } - - if (match < 0) { - throw new IllegalArgumentException(); - } - - this.keySequence = keySequence; - this.match = match; - } - - @Override - public int compareTo(Object object) { - KeySequenceBinding castedObject = (KeySequenceBinding) object; - int compareTo = Util.compare(match, castedObject.match); - - if (compareTo == 0) { - compareTo = Util.compare(keySequence, castedObject.keySequence); - } - - return compareTo; - } - - @Override - public boolean equals(Object object) { - if (!(object instanceof KeySequenceBinding)) { - return false; - } - - final KeySequenceBinding castedObject = (KeySequenceBinding) object; - return Objects.equals(keySequence, castedObject.keySequence) && match == castedObject.match; - } - - @Override - public KeySequence getKeySequence() { - return keySequence; - } - - public int getMatch() { - return match; - } - - @Override - public int hashCode() { - if (!hashCodeComputed) { - hashCode = HASH_INITIAL; - hashCode = hashCode * HASH_FACTOR + Objects.hashCode(keySequence); - hashCode = hashCode * HASH_FACTOR + Integer.hashCode(match); - hashCodeComputed = true; - } - - return hashCode; - } - - @Override - public String toString() { - if (string == null) { - final StringBuilder stringBuffer = new StringBuilder(); - stringBuffer.append('['); - stringBuffer.append(keySequence); - stringBuffer.append(','); - stringBuffer.append(match); - stringBuffer.append(']'); - string = stringBuffer.toString(); - } - - return string; - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java deleted file mode 100644 index 2b8fef57a35..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/LegacySchemeListenerWrapper.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.keys; - -import org.eclipse.jface.bindings.BindingManager; -import org.eclipse.jface.bindings.ISchemeListener; -import org.eclipse.jface.bindings.SchemeEvent; -import org.eclipse.ui.commands.IKeyConfiguration; -import org.eclipse.ui.commands.IKeyConfigurationListener; -import org.eclipse.ui.commands.KeyConfigurationEvent; - -/** - * A wrapper for old-style listeners to be hooked on to new style schemes. - * - * @since 3.1 - */ -final class LegacySchemeListenerWrapper implements ISchemeListener { - - /** - * The binding manager; never null. - */ - private final BindingManager bindingManager; - - /** - * The listener that is being wrapped. This value is never null. - */ - private final IKeyConfigurationListener listener; - - /** - * Constructs a new instance of SchemeListenerWrapper with the - * given listener. - * - * @param listener The listener to be wrapped; must mot be null. - */ - LegacySchemeListenerWrapper(final IKeyConfigurationListener listener, final BindingManager bindingManager) { - if (listener == null) { - throw new NullPointerException("Cannot wrap a null listener"); //$NON-NLS-1$ - } - - if (bindingManager == null) { - throw new NullPointerException("Cannot wrap a listener without a binding manager"); //$NON-NLS-1$ - } - - this.listener = listener; - this.bindingManager = bindingManager; - } - - @Override - public boolean equals(final Object object) { - if (object instanceof LegacySchemeListenerWrapper) { - final LegacySchemeListenerWrapper wrapper = (LegacySchemeListenerWrapper) object; - return listener.equals(wrapper.listener); - } - - if (object instanceof IKeyConfigurationListener) { - final IKeyConfigurationListener other = (IKeyConfigurationListener) object; - return listener.equals(other); - } - - return false; - } - - @Override - public int hashCode() { - return listener.hashCode(); - } - - @Override - public void schemeChanged(final SchemeEvent schemeEvent) { - final IKeyConfiguration keyConfiguration = new SchemeLegacyWrapper(schemeEvent.getScheme(), bindingManager); - final boolean definedChanged = schemeEvent.isDefinedChanged(); - final boolean nameChanged = schemeEvent.isNameChanged(); - final boolean parentIdChanged = schemeEvent.isParentIdChanged(); - - listener.keyConfigurationChanged( - new KeyConfigurationEvent(keyConfiguration, false, definedChanged, nameChanged, parentIdChanged)); - } -} diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java deleted file mode 100644 index 2cc36e34dc2..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/SchemeLegacyWrapper.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal.keys; - -import org.eclipse.jface.bindings.BindingManager; -import org.eclipse.jface.bindings.Scheme; -import org.eclipse.ui.commands.IKeyConfiguration; -import org.eclipse.ui.commands.IKeyConfigurationListener; -import org.eclipse.ui.commands.NotDefinedException; - -/** - * A wrapper around the new {@link Scheme} class, providing supported for the - * old {@code IKeyConfiguration} interface. - * - * @since 3.1 - */ -public final class SchemeLegacyWrapper implements IKeyConfiguration { - - /** - * The binding manager managing this scheme. This value is never - * null. - */ - private final BindingManager bindingManager; - - /** - * The wrapped scheme; never null - */ - private final Scheme scheme; - - /** - * Constructs a new instance of SchemeWrapper. - * - * @param scheme The scheme to be wrapped; must not be - * null. - * @param bindingManager The binding manager for this scheme; must not be - * null. - */ - public SchemeLegacyWrapper(final Scheme scheme, final BindingManager bindingManager) { - if (scheme == null) { - throw new NullPointerException("Cannot wrap a null scheme"); //$NON-NLS-1$ - } - - if (bindingManager == null) { - throw new NullPointerException("Cannot wrap a scheme without a binding manager"); //$NON-NLS-1$ - } - - this.scheme = scheme; - this.bindingManager = bindingManager; - } - - @Override - public void addKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener) { - scheme.addSchemeListener(new LegacySchemeListenerWrapper(keyConfigurationListener, bindingManager)); - } - - @Override - public int compareTo(Object o) { - return scheme.compareTo(o); - } - - @Override - public String getDescription() throws NotDefinedException { - try { - return scheme.getDescription(); - } catch (final org.eclipse.core.commands.common.NotDefinedException e) { - throw new NotDefinedException(e); - } - } - - @Override - public String getId() { - return scheme.getId(); - } - - @Override - public String getName() throws NotDefinedException { - try { - return scheme.getName(); - } catch (final org.eclipse.core.commands.common.NotDefinedException e) { - throw new NotDefinedException(e); - } - } - - @Override - public String getParentId() throws NotDefinedException { - try { - return scheme.getParentId(); - } catch (final org.eclipse.core.commands.common.NotDefinedException e) { - throw new NotDefinedException(e); - } - } - - @Override - public boolean isActive() { - return scheme.getId().equals(bindingManager.getActiveScheme().getId()); - } - - @Override - public boolean isDefined() { - return scheme.isDefined(); - } - - @Override - public void removeKeyConfigurationListener(IKeyConfigurationListener keyConfigurationListener) { - scheme.removeSchemeListener(new LegacySchemeListenerWrapper(keyConfigurationListener, bindingManager)); - - } - -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug66182Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug66182Test.java deleted file mode 100644 index 5e548ad7f66..00000000000 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug66182Test.java +++ /dev/null @@ -1,353 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jeanderson Candido - Bug 433603 - *******************************************************************************/ - -package org.eclipse.ui.tests.commands; - -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import java.util.Map; - -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.AbstractHandler; -import org.eclipse.ui.commands.ExecutionException; -import org.eclipse.ui.commands.HandlerSubmission; -import org.eclipse.ui.commands.ICommand; -import org.eclipse.ui.commands.IHandler; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.commands.NotHandledException; -import org.eclipse.ui.commands.Priority; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.eclipse.ui.tests.harness.util.UITestCase; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; - -/** - * Tests that dialogs will inherit the handlers from the workbench window, if - * none is defined for the dialog itself. It tests all of the various - * combinations of this situation. - * - * @since 3.0 - */ -@Ignore("broke during e4 transition and still need adjustments") -public final class Bug66182Test { - - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - - /** - * Tests that the dialog handlers will take priority. The set-up is a - * workbench window with a handler registered for the command to test. Then - * there is a dialog opened with a handler for the same command. The test is - * to see that the dialog's handler gets priority. - * - * @throws ExecutionException - * This should never happen, and indicates a problem with the - * test. - * @throws NotHandledException - * Indicates that no handler was found where one should have - * been found. - */ - @Test - @Ignore - public final void testDialogHandlers() throws ExecutionException, - NotHandledException { - // Open a test window. -// final IWorkbenchWindow window = openTestWindow(); -// -// // Define a handler for some random command identifier. -// final Object windowResult = new Object(); -// final IHandler windowHandler = new AbstractHandler() { -// -// public Object execute(Map parameterValuesByName) -// throws ExecutionException { -// // Do nothing. -// return windowResult; -// } -// }; -// final IWorkbenchCommandSupport commandSupport = fWorkbench -// .getCommandSupport(); -// final String commandId = "org.eclipse.ui.tests.Bug66182"; -// final Shell windowShell = window.getShell(); -// final HandlerSubmission windowSubmission = new HandlerSubmission(null, -// windowShell, null, commandId, windowHandler, Priority.MEDIUM); -// commandSupport.addHandlerSubmission(windowSubmission); -// -// // Open a dialog. -// final Shell dialogShell = new Shell(windowShell); -// dialogShell.pack(); -// dialogShell.open(); -// final Display display = dialogShell.getDisplay(); -// while (display.readAndDispatch()) -// ; -// -// /* -// * Define a handler for the same command identifier, but for this -// * dialog. -// */ -// final Object dialogResult = new Object(); -// final IHandler dialogHandler = new AbstractHandler() { -// -// public Object execute(Map parameterValuesByName) -// throws ExecutionException { -// // Do nothing. -// return dialogResult; -// } -// }; -// final HandlerSubmission dialogSubmission = new HandlerSubmission(null, -// dialogShell, null, commandId, dialogHandler, Priority.MEDIUM); -// commandSupport.addHandlerSubmission(dialogSubmission); -// -// // Check to see which handler is the right handler. -// final ICommand command = commandSupport.getCommandManager().getCommand( -// commandId); -// assertSame( -// "The active shell must be the dialog. If you are activating other shells while this test is running, then this test will fail", -// dialogShell, display.getActiveShell()); -// assertSame( -// "The active workbench window must be the window created in this test. If you are activating other workbench windows, then this test will fail", -// windowShell, fWorkbench.getActiveWorkbenchWindow().getShell()); -// final Object result = command.execute(Collections.EMPTY_MAP); -// assertSame( -// "The dialog handler was not chosen when both a window and dialog handler were defined.", -// dialogResult, result); -// -// // Close the dialog and let the event loop spin. -// commandSupport.removeHandlerSubmission(windowSubmission); -// commandSupport.removeHandlerSubmission(dialogSubmission); -// dialogShell.close(); -// while (display.readAndDispatch()) -// ; - } - - /** - * Tests that, in the absence of a dialog handler, that the window handler - * will be given a chance to take over. The set-up is a workbench window - * with a handler registered for the command to test. Then there is a dialog - * opened, but with no handler. The test is to see that the window's handler - * is active. - * - * @throws ExecutionException - * This should never happen, and indicates a problem with the - * test. - * @throws NotHandledException - * Indicates that no handler was found where one should have - * been found. - */ - @Test - @Ignore - public final void testFallbackToWindow() throws ExecutionException, - NotHandledException { - // Open a test window. -// final IWorkbenchWindow window = openTestWindow(); -// -// // Define a handler for some random command identifier. -// final Object windowResult = new Object(); -// final IHandler windowHandler = new AbstractHandler() { -// -// public Object execute(Map parameterValuesByName) -// throws ExecutionException { -// // Do nothing. -// return windowResult; -// } -// }; -// final IWorkbenchCommandSupport commandSupport = fWorkbench -// .getCommandSupport(); -// final String commandId = "org.eclipse.ui.tests.Bug66182"; -// final Shell windowShell = window.getShell(); -// final HandlerSubmission windowSubmission = new HandlerSubmission(null, -// windowShell, null, commandId, windowHandler, Priority.MEDIUM); -// commandSupport.addHandlerSubmission(windowSubmission); -// -// // Open a dialog. -// final Shell dialogShell = new Shell(windowShell); -// final IWorkbenchContextSupport contextSupport = fWorkbench -// .getContextSupport(); -// contextSupport.registerShell(dialogShell, -// IWorkbenchContextSupport.TYPE_WINDOW); -// dialogShell.pack(); -// dialogShell.open(); -// final Display display = dialogShell.getDisplay(); -// while (display.readAndDispatch()) -// ; -// -// // Check to see which handler is the right handler. -// final ICommand command = commandSupport.getCommandManager().getCommand( -// commandId); -// assertSame( -// "The active shell must be the dialog. If you are activating other shells while this test is running, then this test will fail", -// dialogShell, display.getActiveShell()); -// assertSame( -// "The active workbench window must be the window created in this test. If you are activating other workbench windows, then this test will fail", -// windowShell, fWorkbench.getActiveWorkbenchWindow().getShell()); -// final Object result = command.execute(new HashMap()); -// assertSame( -// "The window handler was not chosen when both a dialog was open with no handler, but the active workbench window did have a handler.", -// windowResult, result); -// -// // Close the dialog and let the event loop spin. -// commandSupport.removeHandlerSubmission(windowSubmission); -// contextSupport.unregisterShell(dialogShell); -// dialogShell.close(); -// while (display.readAndDispatch()) -// ; - } - - /** - * Tests that if a dialog is open, that the application will not fall back - * to the dialog. The set-up is a workbench window with a handler registered - * for the command to test. Then there is a dialog opened, but with no - * handler. The test is to see that no handler is active. - * - * @throws ExecutionException - * This should never happen, and indicates a problem with the - * test. - * @throws NotHandledException - * Indicates that no handler was found where one should have - * been found. - */ - @Test - public final void testFallbackToWindowBlockedByDialog() - throws ExecutionException, NotHandledException { - // Open a test window. - final IWorkbenchWindow window = UITestCase.openTestWindow(); - - // Define a handler for some random command identifier. - final Object windowResult = new Object(); - final IHandler windowHandler = new AbstractHandler() { - - @Override - public Object execute(Map parameterValuesByName) { - // Do nothing. - return windowResult; - } - }; - final IWorkbenchCommandSupport commandSupport = PlatformUI.getWorkbench() - .getCommandSupport(); - final String commandId = "org.eclipse.ui.tests.Bug66182"; - final Shell windowShell = window.getShell(); - final HandlerSubmission windowSubmission = new HandlerSubmission(null, - windowShell, null, commandId, windowHandler, Priority.MEDIUM); - commandSupport.addHandlerSubmission(windowSubmission); - - // Open a dialog. - final Shell dialogShell = new Shell(windowShell); - dialogShell.pack(); - dialogShell.open(); - final Display display = dialogShell.getDisplay(); - while (display.readAndDispatch()) { - } - - // Check to see which handler is the right handler. - final ICommand command = commandSupport.getCommandManager().getCommand( - commandId); - assertSame( - "The active shell must be the dialog. If you are activating other shells while this test is running, then this test will fail", - dialogShell, display.getActiveShell()); - assertSame( - "The active workbench window must be the window created in this test. If you are activating other workbench windows, then this test will fail", - windowShell, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - assertTrue( - "When a dialog is open, it should not fall back to the active workbench window.", - !command.isHandled()); - - // Close the dialog and let the event loop spin. - commandSupport.removeHandlerSubmission(windowSubmission); - dialogShell.close(); - while (display.readAndDispatch()) { - } - } - - /** - * Tests that if the workbench window is the active shell, that its handlers - * will take priority. The scenario has two handlers defined: one for the - * workbench window, and one for a dialog that is not open. The workbench - * window handler should be the active handler. - * - * @throws ExecutionException - * This should never happen, and indicates a problem with the - * test. - * @throws NotHandledException - * Indicates that no handler was found where one should have - * been found. - */ - @Test - @Ignore - public final void testWindow() throws ExecutionException, - NotHandledException { - // Open a test window. -// final IWorkbenchWindow window = openTestWindow(); -// -// // Define a handler for some random command identifier. -// final Object windowResult = new Object(); -// final IHandler windowHandler = new AbstractHandler() { -// -// public Object execute(Map parameterValuesByName) -// throws ExecutionException { -// // Do nothing. -// return windowResult; -// } -// }; -// final IWorkbenchCommandSupport commandSupport = fWorkbench -// .getCommandSupport(); -// final String commandId = "org.eclipse.ui.tests.Bug66182"; -// final Shell windowShell = window.getShell(); -// final HandlerSubmission windowSubmission = new HandlerSubmission(null, -// windowShell, null, commandId, windowHandler, Priority.MEDIUM); -// commandSupport.addHandlerSubmission(windowSubmission); -// -// // Create a dialog. -// final Shell dialogShell = new Shell(windowShell); -// -// /* -// * Define a handler for the same command identifier, but for this -// * dialog. -// */ -// final Object dialogResult = new Object(); -// final IHandler dialogHandler = new AbstractHandler() { -// -// public Object execute(Map parameterValuesByName) -// throws ExecutionException { -// // Do nothing. -// return dialogResult; -// } -// }; -// final HandlerSubmission dialogSubmission = new HandlerSubmission(null, -// dialogShell, null, commandId, dialogHandler, Priority.MEDIUM); -// commandSupport.addHandlerSubmission(dialogSubmission); -// -// // Check to see which handler is the right handler. -// final ICommand command = commandSupport.getCommandManager().getCommand( -// commandId); -// assertSame( -// "The active shell must be the dialog. If you are activating other shells while this test is running, then this test will fail", -// windowShell, fWorkbench.getDisplay().getActiveShell()); -// assertSame( -// "The active workbench window must be the window created in this test. If you are activating other workbench windows, then this test will fail", -// windowShell, fWorkbench.getActiveWorkbenchWindow().getShell()); -// final Object result = command.execute(new HashMap()); -// assertSame( -// "The window handler was not chosen when both a dialog was open with no handler, but the active workbench window did have a handler.", -// windowResult, result); -// -// // Close the dialog and let the event loop spin. -// commandSupport.removeHandlerSubmission(windowSubmission); -// dialogShell.dispose(); - } -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug70503Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug70503Test.java deleted file mode 100644 index 45b4278c21a..00000000000 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug70503Test.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.tests.commands; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.actions.RetargetAction; -import org.eclipse.ui.commands.ActionHandler; -import org.junit.Test; - -/** - * This test whether an ActionHandler will update its internal cache of - * properties when a RetargetAction changes only its handler. - * - * @since 3.0.1 - */ -public class Bug70503Test { - - private class PubliclyRetargettableAction extends RetargetAction { - /** - * Constructs a new instance of PubliclyRetargettableAction. - * - * @param actionID - * The action identifier to pass to the - * RetargetAction; should not be - * null. - * @param text - * The text to be displayed on the action; may be - * null if there should be no text. - */ - public PubliclyRetargettableAction(String actionID, String text) { - super(actionID, text); - } - - /** - * A public version of the setActionHandler method. - * - * @param handler - * The new action handler; may be null if - * there is no handler currently. - */ - private final void changeHandler(final IAction handler) { - super.setActionHandler(handler); - } - } - - /** - * Tests whether changing only the handler will update an action handler. - * The set up is a RetargetAction wrapped in an - * ActionHandler. The test verifies a switch back and forth - * to make sure that the updates are happening. - */ - @Test - public final void testHandlerChangeCausesUpdate() { - final PubliclyRetargettableAction retargetAction = new PubliclyRetargettableAction( - "actionID", "text"); - final ActionHandler actionHandler = new ActionHandler(retargetAction); - assertFalse("The retarget action handler should start 'unhandled'", - ((Boolean) actionHandler.getAttributeValuesByName().get( - "handled")).booleanValue()); - retargetAction.changeHandler(new PubliclyRetargettableAction( - "actionID", "text")); - assertTrue( - "The retarget action handler should recognize the new handler.", - ((Boolean) actionHandler.getAttributeValuesByName().get( - "handled")).booleanValue()); - retargetAction.changeHandler(null); - assertFalse( - "The retarget action handler should recognize that the handler is now gone.", - ((Boolean) actionHandler.getAttributeValuesByName().get( - "handled")).booleanValue()); - } -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug74982Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug74982Test.java deleted file mode 100644 index f0badb652d6..00000000000 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug74982Test.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.tests.commands; - -import static org.junit.Assert.assertTrue; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ExecutionException; -import org.eclipse.ui.commands.ICommand; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.commands.NotHandledException; -import org.eclipse.ui.internal.Workbench; -import org.junit.After; -import org.junit.Test; - -/** - * A test for whether the select all handler will send a selection event. - * - * @since 3.1 - */ -public final class Bug74982Test { - - /** - * Whether the selection event has been fired. - */ - private boolean selectionEventFired = false; - - private Shell dialog; - - @After - public void doTearDown() throws Exception { - if (dialog != null) { - dialog.dispose(); - } - } - - /** - * Tests that the SelectAllHandler triggers a selection - * event. Creates a dialog with a text widget, gives the text widget focus, - * and then calls the select all command. This should then call the - * SelectAllHandler and trigger a selection event. - * - * @throws ExecutionException - * If the SelectAllHandler is broken in some way. - * @throws NotHandledException - * If the dialog does not have focus, or if the - * WorkbenchCommandSupport class is broken in - * some way. - */ - @Test - public final void testSelectAllHandlerSendsSelectionEvent() - throws ExecutionException, NotHandledException { - // Create a dialog with a text widget. - IWorkbench fWorkbench = PlatformUI.getWorkbench(); - dialog = new Shell(fWorkbench.getActiveWorkbenchWindow().getShell()); - dialog.setLayout(new GridLayout()); - final Text text = new Text(dialog, SWT.SINGLE); - text.setText("Mooooooooooooooooooooooooooooo"); - text.setLayoutData(new GridData()); - text.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectionEventFired = true; - } - }); - - // Open the dialog and give the text widget focus. - dialog.pack(); - dialog.open(); - text.setFocus(); - - // Spin the event loop to make sure focus is set-up properly. - final Display display = fWorkbench.getDisplay(); - while (display.readAndDispatch()) { - ((Workbench)fWorkbench).getContext().processWaiting(); - } - - // Get the select all command and execute it. - final IWorkbenchCommandSupport commandSupport = fWorkbench - .getCommandSupport(); - final ICommand selectAllCommand = commandSupport.getCommandManager() - .getCommand("org.eclipse.ui.edit.selectAll"); - selectAllCommand.execute(null); - - // Check to see if the selection event has been fired. - assertTrue( - "The selection event was not fired when the SelectAllHandler was used.", - selectionEventFired); - } -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug74990Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug74990Test.java deleted file mode 100644 index 0c3efa4e5c1..00000000000 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug74990Test.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2014 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jeanderson Candido - Bug 433603 - *******************************************************************************/ -package org.eclipse.ui.tests.commands; - -import static org.junit.Assert.assertTrue; - -import java.util.Map; - -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.AbstractHandler; -import org.eclipse.ui.commands.HandlerSubmission; -import org.eclipse.ui.commands.ICommand; -import org.eclipse.ui.commands.IHandler; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.commands.Priority; -import org.eclipse.ui.internal.Workbench; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.eclipse.ui.tests.harness.util.UITestCase; -import org.junit.Rule; -import org.junit.Test; - -/** - * A test for whether part identifiers work properly for HandlerSubmissions. - * - * @since 3.1 - */ -public final class Bug74990Test { - - @Rule - public CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); - - /** - * Tests whether a part-specific handler -- submitted via Java code -- is - * matched properly. This is only using the part id. The test verifies that it - * is active when the part is active, and not active when the part is not - * active. - * - * @throws PartInitException If something goes wrong creating the part to which - * this handler is tied. - */ - @Test - public final void testPartIdSubmission() throws PartInitException { - // Define a command. - final String testCommandId = "org.eclipse.ui.tests.commands.Bug74990"; - IWorkbench fWorkbench = PlatformUI.getWorkbench(); - final IWorkbenchCommandSupport commandSupport = fWorkbench.getCommandSupport(); - final ICommand testCommand = commandSupport.getCommandManager().getCommand(testCommandId); - - // Create a handler submission. - final IHandler handler = new AbstractHandler() { - @Override - public final Object execute(final Map parameterValuesByName) { - // Do nothing. - return null; - } - }; - final HandlerSubmission testSubmission = new HandlerSubmission("org.eclipse.ui.tests.api.MockViewPart", null, - null, testCommandId, handler, Priority.MEDIUM); - commandSupport.addHandlerSubmission(testSubmission); - - try { - // Test to make sure the command is not currently handled. - assertTrue("The MockViewPart command should not be handled", !testCommand.isHandled()); - - /* - * Open a window with the MockViewPart, and make sure it is now handled. - */ - final IWorkbenchPage page = UITestCase.openTestWindow().getActivePage(); - final IViewPart openedView = page.showView("org.eclipse.ui.tests.api.MockViewPart"); - page.activate(openedView); - while (fWorkbench.getDisplay().readAndDispatch()) { - ((Workbench) fWorkbench).getContext().processWaiting(); - } - - assertTrue("The MockViewPart command should be handled", testCommand.isHandled()); - - // Hide the view, and test that is becomes unhandled again. - page.hideView(openedView); - while (fWorkbench.getDisplay().readAndDispatch()) { - // Read the event queue - } - assertTrue("The MockViewPart command should not be handled", !testCommand.isHandled()); - - } finally { - commandSupport.removeHandlerSubmission(testSubmission); - } - - } -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug87856Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug87856Test.java deleted file mode 100644 index d4ff358820f..00000000000 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/Bug87856Test.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Jeanderson Candido - Bug 433603 - *******************************************************************************/ - -package org.eclipse.ui.tests.commands; - -import static org.junit.Assert.assertTrue; - -import java.lang.ref.WeakReference; -import java.util.Map; - -import org.eclipse.core.commands.Command; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.AbstractHandler; -import org.eclipse.ui.commands.HandlerSubmission; -import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.commands.IHandler; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.commands.Priority; -import org.junit.Test; - -/** - * This tests whether we are leaking handlers after their submission has been - * removed. - * - * @since 3.1 - */ -public class Bug87856Test { - - /** - * Tests whether the workbench command support (or its dependencies) will leak - * handlers when the process loop is run. Basically, we're checking to see that - * removing a handler submission really works. - */ - @Test - public final void testHandlerLeak() { - IWorkbench fWorkbench = PlatformUI.getWorkbench(); - final IWorkbenchCommandSupport commandSupport = fWorkbench.getCommandSupport(); - final ICommandService commandService = fWorkbench.getAdapter(ICommandService.class); - final String commandId = Bug87856Test.class.getName(); - final Command command = commandService.getCommand(commandId); - - // Submit a handler. - IHandler handler = new AbstractHandler() { - - @Override - public Object execute(Map parameterValuesByName) { - // Do nothing - return null; - } - - }; - HandlerSubmission submission = new HandlerSubmission(null, null, null, command.getId(), handler, - Priority.MEDIUM); - commandSupport.addHandlerSubmission(submission); - - /* - * Remove the handler with no replacement, and hold on to the handler via a weak - * reference. - */ - commandSupport.removeHandlerSubmission(submission); - submission = null; - final WeakReference reference = new WeakReference<>(handler); - handler = null; - - // Attempt to force garbage collection. - System.gc(); - System.runFinalization(); - Thread.yield(); - System.gc(); - System.runFinalization(); - Thread.yield(); - System.gc(); - System.runFinalization(); - Thread.yield(); - - // Check to see if the reference has been cleared. - assertTrue("We should not hold on to a handler after the submission has been removed.", - reference.isEnqueued() || (reference.get() == null)); - } -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandsTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandsTestSuite.java index 18c7e6dbde8..8e920e6ab4c 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandsTestSuite.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandsTestSuite.java @@ -23,11 +23,7 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ CommandExecutionTest.class, - Bug70503Test.class, Bug73756Test.class, - Bug74982Test.class, - Bug74990Test.class, - Bug87856Test.class, Bug125792Test.class, Bug417762Test.class, CommandManagerTest.class, @@ -37,7 +33,6 @@ CommandCallbackTest.class, CommandActionTest.class, HelpContextIdTest.class, - Bug66182Test.class, StateTest.class, CommandEnablementTest.class, ActionDelegateProxyTest.class, diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36420Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36420Test.java deleted file mode 100644 index 72134fa0766..00000000000 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug36420Test.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -package org.eclipse.ui.tests.keys; - -import static org.junit.Assert.assertTrue; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ICommandManager; -import org.eclipse.ui.internal.IWorkbenchConstants; -import org.eclipse.ui.keys.KeySequence; -import org.junit.Ignore; -import org.junit.Test; - -/** - * Tests Bug 36420 - * - * @since 3.0 - */ -@Ignore("This no longer works due to focus issues related to key bindings") -// See commit f4f9a6680173270f913891b1d2a8b5f05854b6f4 -public class Bug36420Test { - - /** - * Tests that importing key preferences actually has an effect. - * - * @throws CoreException - * If the preferences can't be imported. - * @throws FileNotFoundException - * If the temporary file is removed after it is created, but - * before it is opened. (Wow) - * @throws IOException - * If something fails during output of the preferences file. - */ - @Test - public void testImportKeyPreferences() throws CoreException, - FileNotFoundException, IOException { - String commandId = "org.eclipse.ui.window.nextView"; //$NON-NLS-1$ - String keySequenceText = "F S C K"; //$NON-NLS-1$ - - /* - * DO NOT USE PreferenceMutator for this section. This test case must - * use these exact steps, while PreferenceMutator might use something - * else in the future. - */ - // Set up the preferences. - Properties preferences = new Properties(); - String key = "org.eclipse.ui.workbench/org.eclipse.ui.commands"; //$NON-NLS-1$ - String value = "\n"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - preferences.put(key, value); - - // This is the first pass way to "walk" through the list - // of bundles - String[] pluginIds = Platform.getExtensionRegistry().getNamespaces(); - for (String pluginId : pluginIds) { - preferences.put(pluginId, Platform.getBundle(pluginId).getVersion().toString()); - } - - // Export the preferences. - File file = File.createTempFile("preferences", ".txt"); //$NON-NLS-1$//$NON-NLS-2$ - file.deleteOnExit(); - try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) { - preferences.store(bos, null); - } - - // Attempt to import the key binding. - Preferences.importPreferences(IPath.fromOSString(file.getAbsolutePath())); - /* - * END SECTION - */ - - // Check to see that the key binding for the given command matches. - ICommandManager manager = PlatformUI.getWorkbench().getCommandSupport() - .getCommandManager(); - List keyBindings = manager.getCommand(commandId) - .getKeySequenceBindings(); - boolean found = false; - for (KeySequence keyBinding : keyBindings) { - String currentText = keyBinding.toString(); - if (keySequenceText.equals(currentText)) { - found = true; - } - } - - assertTrue("Key binding not imported.", found); //$NON-NLS-1$ - } -} diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java index 7d620b02e86..71b62cb0177 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/Bug53489Test.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; -import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; @@ -25,11 +24,9 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.commands.CommandException; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.tests.harness.util.AutomationUtil; import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; @@ -54,13 +51,9 @@ public class Bug53489Test { /** * Tests that pressing delete in a styled text widget (in a running Eclipse) * does not cause a double delete. - * - * @throws CommandException If execution of the handler fails. - * @throws CoreException If the test project cannot be created and opened. - * @throws IOException If the file cannot be read. */ @Test - public void testDoubleDelete() throws CommandException, CoreException, IOException { + public void testDoubleDelete() throws Exception { IWorkbenchWindow window = UITestCase.openTestWindow(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IProject testProject = workspace.getRoot().getProject("DoubleDeleteestProject"); //$NON-NLS-1$ diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/KeysTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/KeysTestSuite.java index 33041ab992a..f23b86020dd 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/KeysTestSuite.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/keys/KeysTestSuite.java @@ -25,7 +25,6 @@ BindingManagerTest.class, DispatcherTest.class, BindingPersistenceTest.class, - Bug36420Test.class, Bug36537Test.class, Bug40023Test.class, Bug42024Test.class, diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiPageKeyBindingTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiPageKeyBindingTest.java index 3ecd39a96a2..f2a61f6b089 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiPageKeyBindingTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/multipageeditor/MultiPageKeyBindingTest.java @@ -25,9 +25,6 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.commands.ICommandManager; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.keys.KeySequence; import org.eclipse.ui.keys.ParseException; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.tests.harness.util.UITestCase; @@ -93,14 +90,5 @@ public void testSwitch() throws CoreException, ParseException { while (display.readAndDispatch()) { } multiPageEditorPart.setPage(1); - - // Check that "Ctrl+Shift+5" is the bound key. - IWorkbenchCommandSupport commandSupport = window.getWorkbench() - .getCommandSupport(); - ICommandManager commandManager = commandSupport.getCommandManager(); - KeySequence expectedKeyBinding = KeySequence - .getInstance("Ctrl+Shift+5"); //$NON-NLS-1$ - String commandId = commandManager.getPerfectMatch(expectedKeyBinding); - assertEquals("org.eclipse.ui.tests.TestCommandId", commandId); //$NON-NLS-1$ } }