Commands and handlers are common to both Eclipse 3.x and the Eclipse 4 model. In Eclipse 3.x, they are represented as extension points in the plugin.xml
file under org.eclipse.ui.commands
. In Eclipse 4, they are stored in the E4 fragment file.
A command will be created to represent saying "hello world," and a handler will be created to display the message. These will then be used to add a menu item to execute the operation.
Open the fragment for the project, or double-click on the
fragment.e4xmi
file.Select the Model Fragment Definition element and click on Add to create a new fragment. Fill in the fields as follows:
Extended Element ID:
org.eclipse.e4.legacy.ide.application
(this can be found under the Container-Type: Application from the search field)Feature Name:
commands