A command is the declaration of a behaviour by id. Commands are used to declare semantic behaviour so that action implementations defined elsewhere by handlers. The separation of the command from the behaviour implementation allows multiple plug-ins to define implementations that implement the same semantic command. The command is what gets associated with a particular key binding.
The workbench defines many common commands in its plugin.xml file, and plug-ins are encouraged to associate their own implementations with these commands where it makes sense. In this way, semantically similar behaviour implemented in different plug-ins may share the same key binding.
Commands are defined using the org.eclipse.ui.commands extension point. The following comes from the Info example markup:
<extension point="org.eclipse.ui.commands"> ... <command categoryId="org.eclipse.ui.examples.contributions.commands.category" id="org.eclipse.ui.examples.contributions.view.count" description="%contributions.view.count.desc" name="%contributions.view.count.name"> </command> ...
The command definition specifies a name, description, and id for the behaviour. It also specifies the id of a category for the command, which is used to group commands in the preferences dialog. The categories are also defined in the org.eclipse.ui.commands extension point:
... <category name="%contributions.commands.category.name" description="%contributions.commands.category.desc" id="org.eclipse.ui.examples.contributions.commands.category"> </category> ...
Note that there is no implementation specified for a command. A command only becomes concrete when a plug-in associates its handler or action with the command id. We'll talk about the different ways to associate handler implementations with commands in the org.eclipse.ui.handlers section. We'll talk about binding key sequences to commands in the org.eclipse.ui.bindings section.