Time for action – creating commands and handlers

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.

  1. Open the fragment for the project, or double-click on the fragment.e4xmi file.

    Tip

    This should open a model editor; if it opens plain XML content, then verify that the E4 tools have been installed correctly.

  2. Select the Model Fragment Definition element and click on Add to create a ...

Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.