+ // make the current state correct and synchronised in the module and sub-documents
+ if (isOperation()) { // do it only in transaction, not on opening of document
+ if (myCurrentDoc == moduleDocument()) {
+ // make the current feature the latest in root, in previous root current become also last
+ makeCurrentLast(aPrevious);
+ makeCurrentLast(myCurrentDoc);
+ } else {
+ // make the current feature the latest in sub, root current feature becomes this sub
+ makeCurrentLast(myCurrentDoc);
+ DocumentPtr aRoot = moduleDocument();
+ ResultPtr aPartRes = ModelAPI_Tools::findPartResult(aRoot, myCurrentDoc);
+ if (aPartRes.get()) {
+ FeaturePtr aPartFeat = aRoot->feature(aPartRes);
+ if (aPartFeat.get()) {
+ aRoot->setCurrentFeature(aPartFeat, false);
+ }
+ }
+ }
+ }