Having created a sample application, the next step is to create a view, known as a part in E4. Parts are the generic name for views, editors, and other grouping components in an E4 application. Unlike views in Eclipse 3, the view class doesn't have to have any references to the Eclipse APIs. This makes it particularly easy to build and test in isolation.
Open the
plugin.xml
file of thecom.packtpub.e4.application
project, and go to the Dependencies tab. Add a dependency to theorg.eclipse.ui.di
bundle, if it's not already added.Create a new class called
Hello
in thecom.packtpub.e4.application.parts
package.Add a field called
label
of typeLabel
.Add a
create()
method, annotated with@PostConstruct
that instantiates theLabel
and sets its text toHello
.Note
If
@PostConstruct
appears not to work, ensurejavax.annotation
is added as a package import to the bundle (see http://www.vogella.com/articles/EclipseRCP/article.html#tutorial_api2).Add a
focus()
method...