Extract fragment now possible with e4 tools by Sopot Cela

Some time ago a enhancement request was filed in the Eclipse 4 tooling project. As you know an Eclipse 4 application has an application model which is a sort of tree with children which have their own children and so on. Also it is known that in Eclipse 4 you can extend your application by providing fragments to the main model (Application.e4xmi). Basically fragments are an addition of subtrees to this tree which get merged when the application starts.

For example, you might have an application with two windows (MWindow is a child of MApplication) in the main model. If you want to contribute another window you provide a fragment in which you “glue” another window, along with all it’s children like part stacks, parts etc. to the parent which in this case is the MApplication. This contribution can be done in a separate plugin as long as you know the ID of the parent you are contributing to.

The bug I mentioned requested that when you have a big main application model you should have the possibility to extract parts of this model into fragments so that you can make them independent contributions from another plugin rather than a part of the big monolithic application model. If you have ever used a fragment you know that the mandatory stuff you need is the feature you want to contribute (a command, a handler or an addon?) and the ID of the parent you want to contribute. By right clicking in the model tree you have all this information so now you can extract any part of your main application model in separate fragments. You can extract individual elements (for example a PartStack) along with all its children or a group of elements (for example all the handlers). What is left for you is just register those fragments in your plugin.xml.

I think it is useful if you thought at some point that your application model would be in one place but then decide to make it more granular by splitting it in one main model and certain other contributions. To have this and other cool features we added lately you should have the latest tools build which can be found in this update site.

This entry was posted in Eclipse. Bookmark the permalink.

One Response to Extract fragment now possible with e4 tools by Sopot Cela

  1. Rob says:

    Fragment extraction is definitely an important part and it’s nice to see it is possible with Eclipse 4. Thanks for the info Lars.

    Oh and btw, your blog has been mentioned in the list of programming and software development blogs here-> http://www.talkora.com/technology/List-of-programming-and-software-development-blogs_105 (look for entry #14 in the list)

Comments are closed.