+ if (operationsCount() == 1) {
+ ModuleBase_Operation* aCurrentOperation = currentOperation();
+ if (canStopOperation(aCurrentOperation)) {
+ abortOperation(aCurrentOperation);
+ }
+ else
+ aResult = false;
+ }
+ else {
+ aResult = QMessageBox::question(qApp->activeWindow(),
+ tr("Abort operation"),
+ tr("All active operations will be aborted."),
+ QMessageBox::Ok | QMessageBox::Cancel,
+ QMessageBox::Cancel) == QMessageBox::Ok;
+ while(aResult && hasOperation()) {
+ abortOperation(currentOperation());
+ }
+ }
+ return aResult;
+}
+
+bool XGUI_OperationMgr::commitAllOperations()
+{
+ bool isCompositeCommitted = false;
+ while (hasOperation()) {
+ ModuleBase_Operation* anOperation = currentOperation();
+ if (isApplyEnabled()) {
+ onCommitOperation();
+ } else {
+ abortOperation(anOperation);
+ }
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (anOperation);
+ if (aFOperation) {
+ FeaturePtr aFeature = aFOperation->feature();
+ CompositeFeaturePtr aComposite =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
+ isCompositeCommitted = aComposite.get();
+ if (isCompositeCommitted)
+ break;
+ }
+ }