Question

I'm trying to inject the ECommandService into a Part of my application, and I've added the plugin org.eclipse.e4.core.commands;bundle-version="0.10.2" to the dependencies of my application (plugin.xml), but when I declare the

@Inject private ECommandService commandService;

I'm getting a warning saying:

Discouraged access: The type ECommandService is not accessible due to 
restriction on required library C:\Data\andrelop\transnet\eclipse-
kepler\plugins\org.eclipse.e4.core.commands_0.10.2.v20130515-1857.jar

Is this normal or Am I adding the wrong dependency?

Was it helpful?

Solution

This is normal for a number of e4 APIs. These APIs have not yet been finalized so they are left 'discouraged' - but you have to use them for e4 applications. There is a chance that they may change in future Eclipse releases.

You can turn off the warning in Preferences > Java > Compiler > Errors/Warning in the Deprecated and restricted API section change Discouraged reference (access rules) to ignore. Or you can use @SuppressWarning("restriction") on your class.

Eclipse bug 412373 will list the APIs which will finalized in Eclipse 4.4 (Luna), but currently it is empty. Some e4 APIs were finalized when 4.3 was released.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top