Resolving empty views in Eclipse e4, postConstruct is not called

The issue with views turning up empty in e4 might be related to the postConstruct method not being called. First, verify the view part is actually created, for example by printing a statement via System.out in the constructor of the part.

If this does show up, but the postConstruct method is not called, the issue may be the wrong resolution of javax.annotation, which takes care of the dependency injection.

The e4 FAQ addresses this issue as follows:

“Ensure your bundles use Import-Package with a package version to pull in the standard annotations rather than a Require-Bundle on the javax.annotation bundle.” (Eclipse 4 FAQ).

Import-Package: javax.annotation; version=”1.1.0″

In other words, ensure none of the bundles has the javax.annotation bundle under “Required Plug-Ins” but rather imports it with a minimum version of 1.1.0

Leave a comment