Community
Participate
Working Groups
See https://git.eclipse.org/r/#/c/162592/4/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java We frequently (also in client code) need to access the parent of a part. As any part can be a placeholder, we frequently have to use the pattern of checking if the part.getCurSharedRef() != null and if not null access the parent of the placeholder and if not present access the parent of the part. I suggest we add a method to the model service: MUIElement getParentForPart(MPart part)
New Gerrit change created: https://git.eclipse.org/r/162623
Shared elements are at least MPart, MArea, MPartSashContainer, MPartStack (those are shown in the model spy). For all these elements a similar method would be beneficial. Not sure how to name the method though. The parent of a MPlaceholder can and will change. It should be clear that the parent is not the same as the container of an element. suggestions: MUIElement getCurrentParent(MUIElement element) MUIElement getEffectiveParent(MUIElement element) MUIElement getGuardian(MUIElement element) Guardian captures best the nature of what this method does, that is determine which element currently has custody of the element. However, not many people will guess that this method would be around if it has that name.