As with Eclipse 3.x, a command has an identifier and an associated Handler
class, which can be bound to Menus. Unlike Eclipse 3.x, it is not specified in the plugin.xml
file; instead, it is specified in the Application.e4xmi
file.
Open the
Application.e4xmi
file in thecom.packtpub.e4.application
project.Navigate to the Application | Commands node in the tree, and click on Add child to add a new command:
ID:
com.packtpub.e4.application.command.hello
Name:
helloCommand
Description:
Says Hello
Create a
HelloHandler
class in thecom.packtpub.e4.application.handlers
package. It doesn't need to have any specific superclass or method implementation. Instead, create a method calledhello()
which takes no arguments, and prints a message toSystem.out
. The method needs the@Execute
annotation:package com.packtpub.e4.application.handlers; import org.eclipse.e4.core.di.annotations.Execute; public class HelloHandler { @Execute public void...