+ aWorkshop->updateCommandStatus();
+
+ // Update displayed objects in order to update active color
+ XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+ QObjectPtrList aObjects = aDisplayer->displayedObjects();
+ foreach(ObjectPtr aObj, aObjects)
+ aDisplayer->redisplay(aObj, false);
+ aDisplayer->updateViewer();
+ }
+}
+
+void PartSet_Module::onTreeViewDoubleClick(const QModelIndex& theIndex)
+{
+ if (myWorkshop->currentOperation()) // Do not change activation of parts if an operation active
+ return;
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (!theIndex.isValid()) {
+ aMgr->setActiveDocument(aMgr->moduleDocument());
+ return;
+ }
+ if (theIndex.column() != 0) // Use only first column
+ return;
+ ObjectPtr aObj = myDataModel->object(theIndex);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+ if (!aPart.get()) { // Probably this is Feature
+ FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID())) {
+ aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartFeature->firstResult());
+ }
+ }
+ if (aPart.get()) { // if this is a part
+ if (aPart->partDoc() == aMgr->activeDocument()) {
+ aMgr->setActiveDocument(aMgr->moduleDocument());
+ } else {
+ aPart->activate();
+ }
+ }
+}
+
+
+void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*)
+{
+ // z layer is created for all started operations in order to visualize operation AIS presentation
+ // over the object
+ Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
+ if (myVisualLayerId == 0) {
+ if (myVisualLayerId == 0)
+ aViewer->AddZLayer(myVisualLayerId);
+ } else {
+ TColStd_SequenceOfInteger aZList;
+ aViewer->GetAllZLayers(aZList);
+ bool aFound = false;
+ for (int i = 1; i <= aZList.Length(); i++) {
+ if (aZList(i) == myVisualLayerId) {
+ aFound = true;
+ break;
+ }
+ }
+ if (!aFound)
+ aViewer->AddZLayer(myVisualLayerId);