Search code examples
javaeclipsercpe4

Using default command in Eclipse RCP 4.X


I want to use some default commands that the Eclipse Framework provide for us. For example I want to use a default command (Handler) which are implementing the Copy/Paste/Cut etc. mechanism.

I found some information, that eclipse define some default keys like these:

  • Save: org.eclipse.ui.file.save
  • Save All: org.eclipse.ui.file.saveAll
  • Undo: org.eclipse.ui.edit.undo
  • Copy: org.eclipse.ui.edit.copy

Now I have use these keys to define some commands etc. in the Application.e4xmi file.

Application.e4xmi Command

Application.e4xmi Command Category

Application.e4xmi MenuHandleItem

But this configuration is not working, did I have miss some config setting, or did I make something complete wrong?


Solution

  • An Eclipse e4 application does not define default handlers for anything. You must provide handlers for everything.

    The commands you mention (such as org.eclipse.ui.file.save) have predefined ids because some things in the Eclipse code reference them by the id.

    You may see references to 'default handlers' but this will be talking about Eclipse 3.x style command handling.