// TBD is this the best method?
 // TBD this should be a general utility method somewhere in the fragment
 private IWorkbenchPartReference toPartRef(MPart part) {
   if (part == null) return null;
   Object impl = part.getObject();
   if (!(impl instanceof IWorkbenchPart)) return null;
   PartSite site = (PartSite) ((IWorkbenchPart) impl).getSite();
   return site.getPartReference();
 }
 // TBD default hidden/shown state
 private void changeVisibility(MPart oldPart, MPart newPart) {
   // TBD old parent vs new parent: should we apply the same logic to both?
   // if parent was a stack: hide the previously active part
   MElementContainer oldParent = oldPart.getParent();
   if (oldParent instanceof MViewStack || oldParent instanceof MEditorStack)
     visiblityChange(oldPart, false);
   // show new part
   visiblityChange(newPart, true);
 }