#P org.eclipse.ui.workbench
diff --git Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
index aeaedc2..abd25e0 100644
--- Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
+++ Eclipse UI/org/eclipse/ui/internal/commands/CommandPersistence.java
@@ -13,20 +13,19 @@ package org.eclipse.ui.internal.commands;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.core.commands.AbstractParameterValueConverter;
import org.eclipse.core.commands.Category;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ParameterType;
import org.eclipse.core.commands.State;
import org.eclipse.core.commands.common.HandleObject;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionDelta;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
import org.eclipse.ui.internal.services.RegistryPersistence;
@@ -34,7 +33,9 @@ import org.eclipse.ui.internal.util.PrefUtil;
/**
*
- * A static class for accessing the registry and the preference store.
+ * CommandPersistence is responsible to read commands, categories, parameters,
+ * states and aliases from the extension registry and to register them with the
+ * {@link CommandService}.
*
*
* @since 3.1
@@ -72,14 +73,10 @@ public final class CommandPersistence extends RegistryPersistence {
* @param configurationElementCount
* The number of configuration elements that are really in the
* array.
- * @param commandService
- * The command service to which the categories should be added;
- * must not be null
.
*/
- private static final void readCategoriesFromRegistry(
+ private final void readCategoriesFromRegistry(
final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final ICommandService commandService) {
+ final int configurationElementCount) {
// Undefine all the previous handle objects.
final HandleObject[] handleObjects = commandService
.getDefinedCategories();
@@ -138,14 +135,10 @@ public final class CommandPersistence extends RegistryPersistence {
* @param configurationElementCount
* The number of configuration elements that are really in the
* array.
- * @param commandService
- * The command service to which the commands should be added;
- * must not be null
.
*/
- private static final void readCommandsFromRegistry(
+ private final void readCommandsFromRegistry(
final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final ICommandService commandService) {
+ final int configurationElementCount) {
// Undefine all the previous handle objects.
final HandleObject[] handleObjects = commandService
.getDefinedCommands();
@@ -167,6 +160,20 @@ public final class CommandPersistence extends RegistryPersistence {
continue;
}
+ IConfigurationElement[] aliases = configurationElement
+ .getChildren(TAG_COMMAND_ALIAS_FOR);
+ if (aliases.length > 0) {
+ if (aliases.length > 1) {
+ logWarnings(warningsToLog, "There should only be only one aliasFor element"); //$NON-NLS-1$
+ }
+ String targetCommandId = readRequired(aliases[0], ATT_COMMAND_ID, warningsToLog,
+ "aliasFor needs a commandId"); //$NON-NLS-1$
+ commandService.defineAlias(commandId, targetCommandId);
+ // Other attributes are ignored for alias commands
+ // as documented in extension point description
+ continue;
+ }
+
// Read out the name.
final String name = readRequired(configurationElement, ATT_NAME,
warningsToLog, "Commands need a name"); //$NON-NLS-1$
@@ -190,7 +197,7 @@ public final class CommandPersistence extends RegistryPersistence {
// Read out the parameters.
final Parameter[] parameters = readParameters(configurationElement,
- warningsToLog, commandService);
+ warningsToLog);
// Read out the returnTypeId.
final String returnTypeId = readOptional(configurationElement,
@@ -241,15 +248,12 @@ public final class CommandPersistence extends RegistryPersistence {
* The list of warnings found during parsing. Warnings found
* while parsing the parameters will be appended to this list.
* This value must not be null
.
- * @param commandService
- * The command service from which the parameter can get parameter
- * types; must not be null
.
* @return The array of parameters found for this configuration element;
* null
if none can be found.
*/
- private static final Parameter[] readParameters(
+ private final Parameter[] readParameters(
final IConfigurationElement configurationElement,
- final List warningsToLog, final ICommandService commandService) {
+ final List warningsToLog) {
final IConfigurationElement[] parameterElements = configurationElement
.getChildren(TAG_COMMAND_PARAMETER);
if ((parameterElements == null) || (parameterElements.length == 0)) {
@@ -318,15 +322,11 @@ public final class CommandPersistence extends RegistryPersistence {
* @param configurationElementCount
* The number of configuration elements that are really in the
* array.
- * @param commandService
- * The command service to which the commands should be added;
- * must not be null
.
* @since 3.2
*/
- private static final void readParameterTypesFromRegistry(
+ private final void readParameterTypesFromRegistry(
final IConfigurationElement[] configurationElements,
- final int configurationElementCount,
- final ICommandService commandService) {
+ final int configurationElementCount) {
// Undefine all the previous handle objects.
final HandleObject[] handleObjects = commandService
@@ -425,7 +425,7 @@ public final class CommandPersistence extends RegistryPersistence {
* The command service with which this persistence class is associated;
* never null
.
*/
- private final ICommandService commandService;
+ private final CommandService commandService;
/**
* Constructs a new instance of CommandPersistence
.
@@ -434,10 +434,8 @@ public final class CommandPersistence extends RegistryPersistence {
* The command service which should be populated with the values
* from the registry; must not be null
.
*/
- CommandPersistence(final ICommandService commandService) {
- if (commandService == null) {
- throw new NullPointerException("The command service cannot be null"); //$NON-NLS-1$
- }
+ CommandPersistence(final CommandService commandService) {
+ Assert.isNotNull(commandService, "commandService"); //$NON-NLS-1$
this.commandService = commandService;
}
@@ -462,10 +460,6 @@ public final class CommandPersistence extends RegistryPersistence {
/**
* Reads all of the commands and categories from the registry,
- *
- * @param commandService
- * The command service which should be populated with the values
- * from the registry; must not be null
.
*/
protected final void read() {
super.read();
@@ -519,12 +513,12 @@ public final class CommandPersistence extends RegistryPersistence {
readCategoriesFromRegistry(
indexedConfigurationElements[INDEX_CATEGORY_DEFINITIONS],
- categoryDefinitionCount, commandService);
+ categoryDefinitionCount);
readCommandsFromRegistry(
indexedConfigurationElements[INDEX_COMMAND_DEFINITIONS],
- commandDefinitionCount, commandService);
+ commandDefinitionCount);
readParameterTypesFromRegistry(
indexedConfigurationElements[INDEX_PARAMETER_TYPE_DEFINITIONS],
- parameterTypeDefinitionCount, commandService);
+ parameterTypeDefinitionCount);
}
}
diff --git Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
index 2c448fd..2f91b1b 100644
--- Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
+++ Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
@@ -17,7 +17,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-
import org.eclipse.core.commands.Category;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.CommandManager;
@@ -31,9 +30,9 @@ import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.commands.PersistentState;
+import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementReference;
import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.menus.UIElement;
@@ -335,4 +334,17 @@ public final class CommandService implements ICommandService {
public CommandPersistence getCommandPersistence() {
return commandPersistence;
}
+
+ /**
+ * Defines an alias in the underlying CommandManager.
+ *
+ * @see CommandManager#defineAlias(String, String)
+ * @param sourceCommandId
+ * alias command id
+ * @param targetCommandId
+ * alias target command id
+ */
+ protected void defineAlias(String sourceCommandId, String targetCommandId) {
+ commandManager.defineAlias(sourceCommandId, targetCommandId);
+ }
}
diff --git Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
index 90123e0..f61a2e1 100644
--- Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
+++ Eclipse UI/org/eclipse/ui/internal/registry/IWorkbenchRegistryConstants.java
@@ -945,6 +945,11 @@ public interface IWorkbenchRegistryConstants {
public static String TAG_COMMAND = "command"; //$NON-NLS-1$
/**
+ * The name of the element storing an alias.
+ */
+ public static String TAG_COMMAND_ALIAS_FOR = "aliasFor"; //$NON-NLS-1$
+
+ /**
* The name of the element storing a parameter.
*/
public static String TAG_COMMAND_PARAMETER = "commandParameter"; //$NON-NLS-1$
#P org.eclipse.core.commands
diff --git src/org/eclipse/core/commands/CommandManager.java src/org/eclipse/core/commands/CommandManager.java
index 1fa61a8..a98b209 100644
--- src/org/eclipse/core/commands/CommandManager.java
+++ src/org/eclipse/core/commands/CommandManager.java
@@ -285,6 +285,13 @@ public final class CommandManager extends HandleObjectManager implements
*/
private final Map parameterTypesById = new HashMap();
+
+ /**
+ * Map holding command aliases mapping from sourceCommandId
+ * to targetCommandId.
+ */
+ private Map commandIdAliases = new HashMap();
+
/**
* Adds a listener to this command manager. The listener will be notified
* when the set of defined commands changes. This can be used to track the
@@ -543,7 +550,7 @@ public final class CommandManager extends HandleObjectManager implements
public final Command getCommand(final String commandId) {
checkId(commandId);
- Command command = (Command) handleObjectsById.get(commandId);
+ Command command = (Command) handleObjectsById.get(resolveAlias(commandId));
if (command == null) {
command = new Command(commandId);
handleObjectsById.put(commandId, command);
@@ -1048,4 +1055,31 @@ public final class CommandManager extends HandleObjectManager implements
executionListener.postExecuteFailure(commandId, exception);
}
}
+
+ /**
+ * Defines an alias from sourceCommandId to targetCommandId. This makes
+ * getCommand(sourceCommandId) equivalent to getCommand(targetCommandId).
+ *
+ * @param sourceCommandId
+ * command id of alias command
+ * @param targetCommandId
+ * command id of alias target
+ */
+ public void defineAlias(String sourceCommandId, String targetCommandId) {
+ commandIdAliases.put(sourceCommandId, targetCommandId);
+ }
+
+ /**
+ * Returns the alias target command id if an alias for the given commandId was
+ * defined. If no alias is defined, the given commandId is returned unchanged.
+ *
+ * @param commandId
+ * command id to resolve
+ * @return alias target command id or given command id if no alias was
+ * defined.
+ */
+ private String resolveAlias(String commandId) {
+ String targetCommandId = (String) commandIdAliases.get(commandId);
+ return targetCommandId != null ? targetCommandId : commandId;
+ }
}
#P org.eclipse.ui
diff --git schema/commands.exsd schema/commands.exsd
index 157ce95..ff99d35 100644
--- schema/commands.exsd
+++ schema/commands.exsd
@@ -2,9 +2,9 @@
-
+
-
+
<p>
The <code>org.eclipse.ui.commands</code> extension point is used to declare commands and command categories, using the <code>command</code> and <code>category</code> elements. A command is an abstract representation of some semantic behaviour, but not it's actual implementation. This allows different developers to contribute specific behaviour for their individual parts. For example, there might be a "paste" command with one implementation in an editor and a different implementation in an explorer widget. These implementations are called handlers. Commands can also be viewed as declarative function pointers, or signal handlers.
@@ -13,6 +13,11 @@ The <code>org.eclipse.ui.commands</code> extension point is used to
+
+
+
+
+
@@ -36,9 +41,9 @@ The <code>org.eclipse.ui.commands</code> extension point is used to
An optional name of the extension instance.
-
+
-
+
@@ -64,15 +69,16 @@ This element is used to define commands. A command represents an request from th
+
Please use <code>categoryId</code> instead.
-
+
-
+
@@ -80,9 +86,9 @@ This element is used to define commands. A command represents an request from th
A translatable short description of this command for display in the UI.
-
+
-
+
@@ -97,9 +103,9 @@ This element is used to define commands. A command represents an request from th
The translatable name of this command for display in the UI. Commands are typically named in the form of an imperative verb.
-
+
-
+
@@ -110,9 +116,9 @@ The unique id of the category for this command. If this command does not specify
</p>
<p><em>Since: 3.0</em></p>
-
+
-
+
@@ -123,9 +129,9 @@ The default handler for this command (see the <a href="org_eclipse_ui_ha
</p>
<p><em>Since: 3.1</em></p>
-
+
-
+
@@ -136,9 +142,9 @@ The id of a <code>commandParameterType</code> indicating the type of
</p>
<p><em>Since: 3.2</em></p>
-
+
-
+
@@ -168,9 +174,9 @@ In the UI, commands are often organized by category to make them more manageable
A translatable short description of this category for display in the UI.
-
+
-
+
@@ -185,9 +191,9 @@ In the UI, commands are often organized by category to make them more manageable
The translatable name of this category for display in the UI.
-
+
-
+
@@ -195,9 +201,9 @@ In the UI, commands are often organized by category to make them more manageable
-
+
-
+
<p>
Defines a parameter that a command should understand. A parameter is a way to provide more information to a handler at execution time. For example, a "show view" command might take a view as a parameter. Handlers should be able to understand these parameters, so they should be treated like API.
@@ -221,9 +227,9 @@ Defines a parameter that a command should understand. A parameter is a way to p
The name for the parameter. This is the name as it will be displayed to an end-user. As such, it should be translatable. The name should be short -- preferrably one word.
-
+
-
+
@@ -231,9 +237,9 @@ Defines a parameter that a command should understand. A parameter is a way to p
The class providing a list of parameter values for the user to select. This class should implement <code>org.eclipse.core.commands.IParameterValues</code>. If this class is not specified, you must specify the more verbose <code>values</code> element. Please see <code>org.eclipse.core.runtime.IExecutableExtension</code>.
-
+
-
+
@@ -241,9 +247,9 @@ Defines a parameter that a command should understand. A parameter is a way to p
The id of a commandParameterType for this commandParameter. Specifying a typeId allows handlers of a command to convert string parameter values to objects in a consistent way and it allows potential callers of a command to look for commands that take objects of various types for their parameters.
-
+
-
+
@@ -278,9 +284,9 @@ Defines the object type of a commandParameter and may specify an <code>org
The fully qualified name of a Java class or interface to use as the type of this command parameter. This attribute is optional, however if omitted, <code>java.lang.Object</code> will be used as the parameter type.
-
+
-
+
@@ -288,9 +294,9 @@ Defines the object type of a commandParameter and may specify an <code>org
The class for converting between objects and string representations of objects for command parameter values. This class should extend <code>org.eclipse.core.commands.AbstractParameterValueConverter</code>. The converter should produce and consume objects of the type indicated in the <code>type</code> attribute. If this class is not specified, this facility to convert between string and object values for this parameter type will not be available (the <code>getValueConverter()</code> on class <code>ParameterType</code> will return <code>null</code>).
-
+
-
+
@@ -298,9 +304,9 @@ Defines the object type of a commandParameter and may specify an <code>org
-
+
-
+
<p>
The more verbose version of the <code>values</code> attribute on the <code>commandParameter</code>.
@@ -317,9 +323,9 @@ The more verbose version of the <code>values</code> attribute on the
The class providing a list of parameter values for the user to select. This class should implement <code>org.eclipse.core.commands.IParameterValues</code>. If this class is not specified, you must specify the more verbose <code>values</code> element. Please see <code>org.eclipse.core.runtime.IExecutableExtension</code>.
-
+
-
+
@@ -327,9 +333,9 @@ The more verbose version of the <code>values</code> attribute on the
-
+
-
+
<p>
A possible value for a parameter.
@@ -357,9 +363,9 @@ A possible value for a parameter.
-
+
-
+
<p>
The default handler for this command. If no other handler is active, this handler will be active. This handler will conflict with other handler definitions that specify no <code>activeWhen</code> conditions. If you are not creating an <code>IExecutableExtension</code>, you can use the <code>defaultHandler</code> attribute instead.
@@ -376,9 +382,9 @@ The default handler for this command. If no other handler is active, this handl
The class which implements <code>org.eclipse.core.commands.IHandler</code>.
-
+
-
+
@@ -386,9 +392,9 @@ The default handler for this command. If no other handler is active, this handl
-
+
-
+
<p>
State information shared between all handlers, and potentially persisted between sessions.The state is simply a class that is loaded to look after the state. See the API Information for more details. This is not used for UI attributes like a menu contribution check box state or label.
@@ -405,9 +411,9 @@ State information shared between all handlers, and potentially persisted between
The class that can be loaded to store the state of this command. State is shared amongst handlers, and can be persisted between sessions. This class must subclass <code>org.eclipse.core.commands.State</code>. Please see API Information.
-
+
-
+
@@ -424,9 +430,9 @@ A unique identifier for this state. This is used for persisting the state betwe
-
+
-
+
<p>
The class that can be loaded to store the state of this command. This element is used if you wish to pass multiple parameters to an <code>org.eclipse.core.runtime.IExecutableExtension</code>.
@@ -443,9 +449,9 @@ The class that can be loaded to store the state of this command. This element i
The class that can be loaded to store the state of this command. State is shared amongst handlers, and can be persisted between sessions. This class must implement <code>org.eclipse.core.commands.State</code>. Please see API Information.
-
+
-
+
@@ -453,9 +459,9 @@ The class that can be loaded to store the state of this command. This element i
-
+
-
+
This element is used to define key configurations. If more than one of these elements exist with the same <code>id</code> attribute, only the last declared element (in order of reading the plugin registry) is considered valid. Please use the "org.eclipse.ui.bindings" extension point instead.
@@ -466,9 +472,9 @@ The class that can be loaded to store the state of this command. This element i
A translatable short description of this key configuration for display in the UI.
-
+
-
+
@@ -476,9 +482,9 @@ The class that can be loaded to store the state of this command. This element i
The unique identifier of this key configuration.
-
+
-
+
@@ -486,9 +492,9 @@ The class that can be loaded to store the state of this command. This element i
The translatable name of this key configuration for display in the UI. If this key configuration has a parent, it is not necessary to add "(extends ...)" to the name. This will be automatically added by the UI where necessary.
-
+
-
+
@@ -497,9 +503,9 @@ The class that can be loaded to store the state of this command. This element i
The unique id of the parent key configuration. If this key configuration has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own key configuration.
@deprecated Please use parentId instead.
-
+
-
+
@@ -507,9 +513,9 @@ The class that can be loaded to store the state of this command. This element i
The unique id of the parent key configuration. If this key configuration has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own key configuration.
-
+
-
+
@@ -517,9 +523,9 @@ The class that can be loaded to store the state of this command. This element i
-
+
-
+
This element is used to define contexts. If more than one of these elements exist with the same <code>id</code> attribute, only the last declared element (in order of reading the plugin registry) is considered valid. Please use the <a href="org_eclipse_ui_contexts.html">org.eclipse.ui.contexts</a> extension point instead.
@@ -530,9 +536,9 @@ The class that can be loaded to store the state of this command. This element i
A translatable short description of this context for display in the UI.
-
+
-
+
@@ -540,9 +546,9 @@ The class that can be loaded to store the state of this command. This element i
The unique identifier of this context.
-
+
-
+
@@ -550,9 +556,9 @@ The class that can be loaded to store the state of this command. This element i
The translatable name of this context for display in the UI. If this context has a parent, it is not necessary to add "(extends parent)" to the name. This will be automatically added by the UI where necessary.
-
+
-
+
@@ -561,9 +567,9 @@ The class that can be loaded to store the state of this command. This element i
The unique id of the parent context. If this context has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own context.
@deprecated Please use "parentId" instead.
-
+
-
+
@@ -571,9 +577,9 @@ The class that can be loaded to store the state of this command. This element i
The unique id of the parent context. If this context has a parent, it will borrow all key bindings from its parent, in addition to the key bindings defined in its own context.
-
+
-
+
@@ -581,9 +587,9 @@ The class that can be loaded to store the state of this command. This element i
-
+
-
+
This element is used to define scopes. If more than one of these elements exist with the same <code>id</code> attribute, only the last declared element (in order of reading the plugin registry) is considered valid.
@deprecated Please use the "org.eclipse.ui.contexts" extension point instead.
@@ -597,9 +603,9 @@ The class that can be loaded to store the state of this command. This element i
@deprecated Please use the "org.eclipse.ui.contexts" extension point instead.
-
+
-
+
@@ -609,9 +615,9 @@ The class that can be loaded to store the state of this command. This element i
@deprecated Please use the "org.eclipse.ui.contexts" extension point instead.
-
+
-
+
@@ -621,9 +627,9 @@ The class that can be loaded to store the state of this command. This element i
@deprecated Please use the "org.eclipse.ui.contexts" extension point instead.
-
+
-
+
@@ -633,9 +639,9 @@ The class that can be loaded to store the state of this command. This element i
@deprecated Please use the "org.eclipse.ui.contexts" extension point instead.
-
+
-
+
@@ -643,9 +649,9 @@ The class that can be loaded to store the state of this command. This element i
-
+
-
+
<p>
This element is used to define the initial active key configuration for Eclipse. If more than one of these elements exist, only the last declared element (in order of reading the plugin registry) is considered valid.
@@ -661,9 +667,9 @@ This element has been replaced with a preference. If your application needs to
The unique id (<code>id</code> attribute) of the keyConfiguration element one wishes to be initially active.
-
+
-
+
@@ -671,9 +677,9 @@ This element has been replaced with a preference. If your application needs to
The unique id (<code>id</code> attribute) of the keyConfiguration element one wishes to be initially active.
-
+
-
+
@@ -681,9 +687,9 @@ This element has been replaced with a preference. If your application needs to
-
+
-
+
This element allows one to assign key sequences to commands. Please use the <code>key</code> element in the "org.eclipse.ui.bindings" extension point instead.
@@ -695,9 +701,9 @@ This element has been replaced with a preference. If your application needs to
The unique id of the key configuration of this key binding.
@deprecated Please use keyConfigurationId instead.
-
+
-
+
@@ -706,9 +712,9 @@ This element has been replaced with a preference. If your application needs to
The unique identifier of the command to which the key sequence specified by this key binding is assigned. If the value of this attribute is an empty string, the key sequence is assigned to an internal 'no operation' command. This is useful for 'undefining' key bindings in specific key configurations and contexts which may have been borrowed from their parents.
@deprecated Please use "commandId" instead.
-
+
-
+
@@ -716,9 +722,9 @@ This element has been replaced with a preference. If your application needs to
An optional attribute indicating that this key binding is only defined for the specified locale. Locales are specified according to the format declared in <code>java.util.Locale</code>.
-
+
-
+
@@ -726,9 +732,9 @@ This element has been replaced with a preference. If your application needs to
An optional attribute indicating that this key binding is only defined for the specified platform. The possible values of the <code>platform</code> attribute are the set of the possible values returned by <code>org.eclipse.swt.SWT.getPlatform()</code>.
-
+
-
+
@@ -736,9 +742,9 @@ This element has been replaced with a preference. If your application needs to
The unique id of the context of this key binding.
-
+
-
+
@@ -747,9 +753,9 @@ This element has been replaced with a preference. If your application needs to
The key sequence to assign to the command. Key sequences consist of one or more key strokes, where a key stroke consists of a key on the keyboard, optionally pressed in combination with one or more of the following modifiers: Ctrl, Alt, Shift, and Command. Key strokes are separated by spaces, and modifiers are separated by '+' characters.
@deprecated Please use "keySequence" instead.
-
+
-
+
@@ -758,9 +764,9 @@ This element has been replaced with a preference. If your application needs to
The unique id of the context of this key binding.
@deprecated Please use "contextId" instead. The old default scope, "org.eclipse.ui.globalScope", has been changed to "org.eclipse.ui.contexts.window". The old name is still supported, but it is deprecated.
-
+
-
+
@@ -769,9 +775,9 @@ This element has been replaced with a preference. If your application needs to
The unique id of the key configuration of this key binding.
@deprecated Please use the <code>schemeId</code> attribute on the <code>key</code> element in the new "org.eclipse.ui.bindings" extension point.
-
+
-
+
@@ -779,9 +785,9 @@ This element has been replaced with a preference. If your application needs to
The unique identifier of the command to which the key sequence specified by this key binding is assigned. If the value of this attribute is an empty string, the key sequence is assigned to an internal 'no operation' command. This is useful for 'undefining' key bindings in specific key configurations and contexts which may have been borrowed from their parents.
-
+
-
+
@@ -791,27 +797,47 @@ This element has been replaced with a preference. If your application needs to
<p>The modifier keys can also be expressed in a platform-independent way. On MacOS X, for example, "Command" is almost always used in place of "Ctrl". So, we provide "M1" which will map to either "Ctrl" or "Command", as appropriate. Similarly, "M2" is "Shift"; "M3" is "Alt"; and "M4" is "Ctrl" (MacOS X). If more platforms are added, then you can count on these aliases being mapped to good platform defaults.</p>
<p>The syntax for this string is defined in <code>org.eclipse.ui.internal.keys</code>. Briefly, the string is case insensitive -- though all capitals is preferred stylistically. If the key is a letter, then simply append the letter. If the key is a special key (i.e., non-ASCII), then use one of the following: ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BREAK, CAPS_LOCK, END, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, HOME, INSERT, NUM_LOCK, NUMPAD_0, NUMPAD_1, NUMPAD_2, NUMPAD_3, NUMPAD_4, NUMPAD_5, NUMPAD_6, NUMPAD_7, NUMPAD_8, NUMPAD_9, NUMPAD_ADD, NUMPAD_DECIMAL, NUMPAD_DIVIDE, NUMPAD_ENTER, NUMPAD_EQUAL, NUMPAD_MULTIPLY, NUMPAD_SUBTRACT, PAGE_UP, PAGE_DOWN, PAUSE, PRINT_SCREEN, or SCROLL_LOCK. If the key is a non-printable ASCII key, then use one of the following: BS, CR, DEL, ESC, FF, LF, NUL, SPACE, TAB, or VT. Note that the main keyboard enter/return key is CR.</p>
-
+
-
+
+
+
+
+
+
+
+
+
+ Adding an "aliasFor" element to a command makes the command an alias for another command specified by the "commandId" attribute of the "aliasFor" element. This allows to refactor commands and change their ids in a backward-compatible fashion by defining a new command and making the old one an alias for the new one. All attributes of the alias command except the id will be ignored. The command itself will not be defined, wherever the command id is used, the alias command is used instead.
+
+
+
+
+
+
+ This is the id of the Command that this command is an alias for.
+
+
+
+
-
+
-
+
-2.1
+ 2.1
-
+
-
+
<p>
The <code>plugin.xml</code> file in the <code>org.eclipse.ui</code> plugin makes extensive use of the <code>org.eclipse.ui.commands</code> extension point.
@@ -820,9 +846,9 @@ The <code>plugin.xml</code> file in the <code>org.eclipse.ui&l
-
+
-
+
<p>
Handlers can be registered with commands using the <code>org.eclipse.ui.handlers.IHandlerService</code>. This can be retrieved from various workbench components (e.g., workbench, workbench window, part site, etc.) by calling <code>getService(IHandlerService.class)</code>.
@@ -845,11 +871,10 @@ There are a few default implementations of handler states that may be useful to
-
-
+
-
+
Copyright (c) 2000, 2007 IBM Corporation and others.<br>
All rights reserved. This program and the accompanying materials are made