| 1078 | } |
| 1079 | |
| 1080 | void PartSashContainer::Stack(LayoutPart::Pointer newPart, |
| 1081 | ILayoutContainer::Pointer container) |
| 1082 | { |
| 1083 | //this->GetControl().setRedraw(false); |
| 1084 | |
| 1085 | // Only deref the part if it is being referenced in -this- perspective |
| 1086 | Perspective::Pointer persp = page->GetActivePerspective(); |
| 1087 | PerspectiveHelper* pres = (persp != 0) ? persp->GetPresentation() : nullptr; |
| 1088 | if (pres != nullptr && container.Cast<PartStack>()->GetAppearance() != PresentationFactoryUtil::ROLE_EDITOR) |
| 1089 | { |
| 1090 | IWorkbenchPartReference::Pointer newPartRef = |
| 1091 | newPart.Cast<PartPane> ()->GetPartReference(); |
| 1092 | IViewReference::Pointer vRef = newPartRef.Cast<IViewReference> (); |
| 1093 | if (vRef != 0) |
| 1094 | { |
| 1095 | LayoutPart::Pointer fpp = pres->FindPart(vRef->GetId(), |
| 1096 | vRef->GetSecondaryId()); |
| 1097 | |
| 1098 | if (fpp != 0) |
| 1099 | { |
| 1100 | // Remove the part from old container. |
| 1101 | this->DerefPart(newPart); |
| 1102 | } |
| 1103 | } |
| 1104 | } |
| 1105 | else |
| 1106 | { |
| 1107 | // Remove the part from old container. |
| 1108 | this->DerefPart(newPart); |
| 1109 | } |
| 1110 | |
| 1111 | // Reparent part and add it to the workbook |
| 1112 | newPart->Reparent(this->GetParent()); |
| 1113 | container->Add(newPart); |
| 1114 | |
| 1115 | //getControl().setRedraw(true); |
| 1116 | |
| 1117 | } |
| 1118 | |
| 1119 | void PartSashContainer::DerefPart(LayoutPart::Pointer sourcePart) |
| 1120 | { |