Salome HOME
Make initialization plugin:
[modules/shaper.git] / src / Model / Model_Session.cpp
index e9edb8856c2c0d1c9ba490caa0c8400951cbc07e..9618362e823e60de18874e85d6efd33650ca7035 100644 (file)
@@ -53,6 +53,7 @@ void Model_Session::closeAll()
 void Model_Session::startOperation(const std::string& theId)
 {
   ROOT_DOC->startOperation();
+  ROOT_DOC->operationId(theId);
   static std::shared_ptr<Events_Message> aStartedMsg
     (new Events_Message(Events_Loop::eventByName("StartOperation")));
   Events_Loop::loop()->send(aStartedMsg);
@@ -121,17 +122,12 @@ void Model_Session::redo()
 //! Returns stack of performed operations
 std::list<std::string> Model_Session::undoList()
 {
-  std::list<std::string> temp;
-  temp.push_front("Part");
-  temp.push_front("Sketch");
-  temp.push_front("Extrusion");
-  return temp;
+  return ROOT_DOC->undoList();
 }
 //! Returns stack of rolled back operations
 std::list<std::string> Model_Session::redoList()
 {
-  std::list<std::string> temp;
-  return temp;
+  return ROOT_DOC->redoList();
 }
 
 FeaturePtr Model_Session::createFeature(string theFeatureID)
@@ -176,8 +172,18 @@ FeaturePtr Model_Session::createFeature(string theFeatureID)
 
 std::shared_ptr<ModelAPI_Document> Model_Session::moduleDocument()
 {
-  return std::shared_ptr<ModelAPI_Document>(
+  bool aFirstCall = !Model_Application::getApplication()->hasDocument("root");
+  if (aFirstCall) {
+    // creation of the root document is always outside of the transaction, so, avoid checking it
+    setCheckTransactions(false);
+  }
+  std::shared_ptr<ModelAPI_Document> aDoc = std::shared_ptr<ModelAPI_Document>(
       Model_Application::getApplication()->getDocument("root"));
+  if (aFirstCall) {
+    // creation of the root document is always outside of the transaction, so, avoid checking it
+    setCheckTransactions(true);
+  }
+  return aDoc;
 }
 
 std::shared_ptr<ModelAPI_Document> Model_Session::document(std::string theDocID)
@@ -303,7 +309,10 @@ void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessa
         if(aMsgAttr->isConcealment()) {
           validators()->registerConcealment(aMsgAttr->featureId(), aMsgAttr->attributeId());
         }
-        
+        if (!aMsgAttr->caseId().empty()) {
+          validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(),
+            aMsgAttr->switchId(), aMsgAttr->caseId());
+        }
       }
     }
     // plugins information was started to load, so, it will be loaded