Eclipse 4.x applications use a
model fragment to define the UI. It is necessary to create a model fragment to define the part descriptors, handlers, and commands to simplify the code shown previously. To start with, the e4view
extension will be replaced by a part descriptor in the fragment.
e4view
extension from the plugin.xml
to prevent it from being loaded.fragment.e4xmi
file, click on Model Fragments and click on Add to add a new fragment.org.eclipse.e4.legacy.ide.application
as the Extended Element ID and descriptors
as the Feature Name. com.packtpub.e4.migration.views.SampleView
Sample View
platform:/plugin/com.packtpub.e4.migration/icons/sample.gif
(the Find … button will allow the plug-in's contents to be browsed through a graphical user interface and the file selected instead of typing it in)bundleclass://com.packtpub.e4.migration/com.packtpub.e4.migration.views.SampleView
(the Find … button will allow the plug-in's classes to be browsed through a graphical user interface instead of typing it in)Sample Category
View
and clicking on the Add button:The Eclipse 3.x way of defining views was through a view
extension point. To facilitate migration towards Eclipse 4.x APIs, an e4view
extension was created. This allows a view to participate in the dependency injection provided by the Eclipse 4.x platform but in a simple way.
However, it is more appropriate to declare views with an Eclipse 4.x fragment and a part descriptor. The part descriptor represents the logical view (similar to an object class) whilst the part represents the actual instance shown in a window (similar to an object instance).
Parts in Eclipse 4.x are more flexible than views; they can have properties such as whether they are closable or not, or whether there can be multiple copies of them at one time. These options can be configured in the fragment rather than code.
3.145.191.169