Skip to main content
Jump to: navigation, search

FAQ What is the difference between a command and an action?

Revision as of 16:27, 14 March 2006 by Claffra (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Commands and actions are two aspects of the same thing. You can think of commands as the declarative part—specified in the plug-in manifest—and actions as the programmatic part. Commands are used mainly to associate customizable key bindings with actions. If you look in the Workbench > Keys preference page, you will see a list of all commands known to the platform, including what context and configuration they belong to. Key bindings are hooked to commands, and then commands are hooked to actions. This extra level of indirection allows for added flexibility in the implementation. The user can change key bindings for a command without the associated actions knowing about it, and the action for a command can be dynamically changed for different circumstances without affecting the key bindings.

Note that although the Eclipse APIs contain both commands and actions, the UI very clearly uses only the term command when referring to them. The term action is avoided in the user interface. There’s no point in confusing users with two names for the same thing!

This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

Back to the top