Menu items are typically decoupled from the code that is executed to promote flexibility and re-use. In both Eclipse 3.x and Eclipse 4.x, commands are used to represent logical operations whilst handlers are used to execute the code. In order to create menus, the handlers and commands must be defined in the fragment.
Open the
fragment.e4xmi
file and go to the Model Fragments element in the tree. Click on Add to add a new Model Fragment, and then useorg.eclipse.e4.legacy.ide.application
as the Extended Element ID andcommands
as the Feature Name.Select Command from the drop-down menu and click on Add to add new commands. Create a command with the ID
com.packtpub.e4.migration.command.one
and a Name ofAction 1
; then do the same withcom.packtpub.e4.migration.command.two
andcom.packtpub.e4.migration.command.double
. It should now look like:Click on Model Fragments and then Add to create a new Model Fragment, this time using a Feature Name...