+ if (isModified)
+ aDisplayer->updateViewer();
+}
+
+bool PartSet_Module::customizeObject(ObjectPtr theObject, const bool theUpdateViewer)
+{
+ bool isRedisplayed = false;
+ if (myCustomPrs->isActive())
+ isRedisplayed = myCustomPrs->redisplay(theObject, theUpdateViewer);
+
+ return isRedisplayed;
+}
+
+void PartSet_Module::customizeObjectBrowser(QWidget* theObjectBrowser)
+{
+ XGUI_ObjectsBrowser* aOB = dynamic_cast<XGUI_ObjectsBrowser*>(theObjectBrowser);
+ if (aOB) {
+ //QLineEdit* aLabel = aOB->activeDocLabel();
+ //QPalette aPalet = aLabel->palette();
+ //aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
+ //aLabel->setPalette(aPalet);
+ aOB->treeView()->setExpandsOnDoubleClick(false);
+ connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
+ SLOT(onTreeViewDoubleClick(const QModelIndex&)));
+#ifdef ModuleDataModel
+ connect(aOB, SIGNAL(headerMouseDblClicked(const QModelIndex&)),
+ SLOT(onTreeViewDoubleClick(const QModelIndex&)));
+ connect(aOB->treeView(), SIGNAL(doubleClicked(const QModelIndex&)),
+ myDataModel, SLOT(onMouseDoubleClick(const QModelIndex&)));
+#endif
+ }
+}
+
+ObjectPtr PartSet_Module::findPresentedObject(const AISObjectPtr& theAIS) const
+{
+ ObjectPtr anObject;
+ ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
+ if (aOperation) {
+ /// If last line finished on vertex the lines creation sequence has to be break
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
+ // if there is an active widget, find the presented object in it
+ if (!anActiveWidget)
+ anActiveWidget = aPanel->preselectionWidget();
+
+ ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
+ (anActiveWidget);
+ if (aWidgetValidated)
+ anObject = aWidgetValidated->findPresentedObject(theAIS);
+ }
+ return anObject;
+}
+
+void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
+{
+ QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
+ int aSelected = aObjects.size();
+ SessionPtr aMgr = ModelAPI_Session::get();
+ QAction* aActivatePartAction = myMenuMgr->action("ACTIVATE_PART_CMD");
+ QAction* aActivatePartSetAction = myMenuMgr->action("ACTIVATE_PARTSET_CMD");
+ if (aSelected == 1) {
+ bool hasResult = false;
+ bool hasFeature = false;
+ bool hasParameter = false;
+ bool hasSubFeature = false;
+ ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter, hasSubFeature);
+
+ ObjectPtr aObject = aObjects.first();
+ if (aObject) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+ FeaturePtr aPartFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ bool isPart = aPart.get() ||
+ (aPartFeature.get() && (aPartFeature->getKind() == PartSetPlugin_Part::ID()));
+ if (isPart) {
+ DocumentPtr aPartDoc;
+ if (!aPart.get()) {
+ aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPartFeature->firstResult());
+ }
+ if (aPart.get()) // this may be null is Part feature is disabled
+ aPartDoc = aPart->partDoc();
+
+ theMenu->addAction(aActivatePartAction);
+ aActivatePartAction->setEnabled((aMgr->activeDocument() != aPartDoc));
+
+ } else if (aObject->document() == aMgr->activeDocument()) {
+ if (hasParameter || hasFeature)
+ theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
+ }
+
+ ResultBodyPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObject);
+ if( aResult.get() )
+ theMenu->addAction(myMenuMgr->action("SELECT_PARENT_CMD"));
+ } else { // If feature is 0 the it means that selected root object (document)
+ theMenu->addAction(aActivatePartSetAction);
+ aActivatePartSetAction->setEnabled((aMgr->activeDocument() != aMgr->moduleDocument()));