Search code examples
dependency-injectioneclipse-rcpe4

Where are the platform services in eclipse rcp/e4?


I have the latest eclipse rcp/e4 and I'm trying to access the platform services listed here:

http://www.vogella.com/tutorials/Eclipse4Services/article.html

However, I can't even find ECommandService, EHandlerService or any IEclipseContext type object. I do however have the ability to inject EModelService and EContextService.

I'm simply trying to execute a handler/command from my code, and I think I need to @inject those objects above and execute them. I don't see any documentation saying this process has changed, so what would I need to do?

My ultimate goal is to create a Button somewhere, and cause it to change perspectives. My strategy is to put this in a handler, and then in there, use the modelService to find that perspective and switch to it.

I'm using the Eclipse Mars 4.5.1, and Eclipse E4 Tools.


Solution

  • You probably just need to add the appropriate plugins to your plugin dependencies (Set this on the 'Required Plug-ins' list on the 'Dependencies' tab in the MANIFEST.MF editor).

    ECommandService and EHandlerService are in the org.eclipse.e4.core.commands plugin.

    IEclipseContext is in the org.eclipse.e4.core.contexts plugin.