Salome HOME
Fix of unstable behavior of results creation events on Linux
[modules/shaper.git] / src / Model / Model_ResultPart.cpp
index cc1666e5b3a43976ba1d61d718bebbcc69565d1d..cd60eb2a6007a66cf45c945d210fb706b884b93c 100644 (file)
@@ -21,6 +21,7 @@ std::shared_ptr<ModelAPI_Feature> Model_ResultPart::owner()
 
 Model_ResultPart::Model_ResultPart()
 {
+  myIsDisabled = true; // by default it is not initialized and false to be after created
   setIsConcealed(false);
 }
 
@@ -28,7 +29,7 @@ void Model_ResultPart::setData(std::shared_ptr<ModelAPI_Data> theData)
 {
   ModelAPI_Result::setData(theData);
   if (theData) {
-    data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::type());
+    data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::typeId());
   }
 }
 
@@ -36,12 +37,19 @@ void Model_ResultPart::activate()
 {
   std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->document(DOC_REF());
   
-  if (!aDocRef->value()) {  // create (or open) a document if it is not yet created
+  if (!aDocRef->value().get()) {  // create (or open) a document if it is not yet created
     std::shared_ptr<ModelAPI_Document> aDoc = document()->subDocument(data()->name());
     if (aDoc) {
       aDocRef->setValue(aDoc);
     }
   }
-  if (aDocRef->value())
+  if (aDocRef->value().get()) {
     ModelAPI_Session::get()->setActiveDocument(aDocRef->value());
+  }
+}
+
+bool Model_ResultPart::isActivated() 
+{
+  std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->document(DOC_REF());
+  return aDocRef->value().get();
 }