I'm starting my first Eclipse 4 plugin (we've been doing xtext-based plugins at my companies for a few years now, but using Eclipse 3 API) and I'm struggling to configure the context's injector. Following vogella's tutorial I've tried using the following addon:
public class InjectionAddOn {
@PostConstruct
public void init(IEclipseContext context) {
System.out.println("Addon runs");
/* Bind IProjectHelper to ProjectHelper */
final ProjectHelper helper = contextInjectionFactory.make(ProjectHelper.class, context);
context.set(IProjectHelper.class, helper);
}
}
with the following in fragments.e4xmi (generated from Application.e4xmi and extracted as a fragment):
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_z-S-YGd1EemrgfwG7sTuLQ" featurename="addons" parentElementId="com.provenrun.pncide.eclipse.ui.application">
<elements xsi:type="application:Addon" xmi:id="_z-S-YWd1EemrgfwG7sTuLQ" elementId="com.provenrun.pncide.eclipse.ui.addon.0" contributionURI="bundleclass://com.provenrun.pncide.eclipse.ui/com.provenrun.pncide.eclipse.ui.InjectionAddOn"/>
</fragments>
But the init method never gets called. What am I doing wrong ? I'm sure I'm missing something obvious, as the e4 environment is new to me.