|"Abstract" Eclipse perspective to avoid redundant e4xmi [message #1727225]
||Mon, 21 March 2016 12:30
| Max Hohenegger
Registered: April 2012
What is the best way to replace elements in the Eclipse e4 application model, depending on the active perspective?|
Most of the perspectives in my RCP application have a fairly similar layout, and include mostly the same parts. These perspectives are distributed over multiple fragment.e4xmi files in multiple plug-ins. Currently, each of them redundantly defines the layout, using PartSashContainers, PartStacks, and Placeholders for the parts. If I have to add a new perspective, I have to clone an existing one, without missing any detail. If I make changes, I usually have to make them in each clone.
I want to follow the DRY principle, so I set up a standard "root" PartSashContainer in my Application.e4xmi, containing the generic layout. I imported it in the fragment.e4xmi files, and then replaced the root control of each perspective with a PlaceHolder, pointing to the imported PartSashContainer.
Finally, I extended the PartStacks from my "abstract" perspective (Application.e4xmi), with model fragments, adding the perspective-specific parts.
Unfortunately for my users, this is not equivalent to what I had before because each fragment.e4xmi will add new elements, e.g. parts to a PartStack, but I need to replace them, depending on the active perspective. There are some other minor issues, but I can live with and/or work around them.
Powered by FUDForum
. Page generated in 0.01335 seconds