+ //ModuleBase_Operation* anOperation = currentOperation();
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (currentOperation());
+ if(aFOperation && aFOperation->feature().get()) {
+ //bool aCanCommit = myWorkshop->module()->canCommitOperation();
+ //setApplyEnabled(!myIsValidationLock && aCanCommit && anOperation->isValid());
+ setApplyEnabled(myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty());
+ }
+}
+
+void XGUI_OperationMgr::setLockValidating(bool toLock)
+{
+ myIsValidationLock = toLock;
+ onValidateOperation();
+}
+
+void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled)
+{
+ myIsApplyEnabled = theEnabled;
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (currentOperation());
+ if (aFOperation) {
+ workshop()->errorMgr()->updateActions(aFOperation->feature());
+ }
+ //emit validationStateChanged(theEnabled);
+}
+
+void XGUI_OperationMgr::updateApplyOfOperations(ModuleBase_Operation* theOperation)
+{
+ XGUI_ErrorMgr* anErrorMgr = workshop()->errorMgr();
+ if (theOperation) {
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ if (aFOperation)
+ anErrorMgr->updateAcceptAllAction(aFOperation->feature());
+ //emit nestedStateChanged(theOperation->getDescription()->operationId().toStdString(),
+ // theOperation->isValid());
+ }
+ else {
+ foreach(ModuleBase_Operation* anOperation, myOperations) {
+ if (anOperation)
+ updateApplyOfOperations(anOperation);
+ //emit nestedStateChanged(anOperation->getDescription()->operationId().toStdString(),
+ // anOperation->isValid());
+ }
+ }
+}
+
+bool XGUI_OperationMgr::isApplyEnabled() const
+{
+ return myIsApplyEnabled;
+}
+
+bool XGUI_OperationMgr::isParentOperationValid() const
+{
+ bool isValid = false;
+ // the enable state of the parent operation of the nested one is defined by the rules that
+ // firstly there are nested operations and secondly the parent operation is valid
+ ModuleBase_Operation* aPrevOp = 0;
+ Operations::const_iterator anIt = myOperations.end();
+ if (anIt != myOperations.begin()) { // there are items in the operations list
+ --anIt;
+ aPrevOp = *anIt; // the last top operation, the operation which is started
+ if (anIt != myOperations.begin()) { // find the operation where the started operation is nested
+ --anIt;
+ aPrevOp = *anIt;
+ }