Salome HOME
Issue #1080 generation of plugin Shaper v1.4 with VisualStudio 2010
authornds <nds@opencascade.com>
Fri, 13 Nov 2015 16:16:12 +0000 (19:16 +0300)
committernds <nds@opencascade.com>
Fri, 13 Nov 2015 16:16:12 +0000 (19:16 +0300)
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_OperationFeature.cpp
src/ModuleBase/ModuleBase_OperationFeature.h
src/XGUI/XGUI_OperationMgr.cpp

index 66b0a51aaea3e7bba7235649affbb0df5912f54d..8b19dcd8270b9c0a57a0f5f1826ba605c911b774 100644 (file)
@@ -75,7 +75,7 @@ bool ModuleBase_Operation::canBeCommitted() const
   return isValid();
 }
 
-void ModuleBase_Operation::start()
+bool ModuleBase_Operation::start()
 {
   myIsModified = false;
 
@@ -83,6 +83,8 @@ void ModuleBase_Operation::start()
 
   startOperation();
   emit started();
+
+  return true;
 }
 
 void ModuleBase_Operation::postpone()
index a7cf23c5b9942f074f1965ac722215e7686f667f..0fffbc0fdae9bea6f8bfd4fbf3e9678e2b79f2f1 100644 (file)
@@ -121,7 +121,8 @@ signals:
   /// to change behavior of operation. There is no point in using this method. It would
   /// be better to inherit own operator from base one and redefine startOperation method
   /// instead.
-  virtual void start();
+  /// \return true if the start is successful
+  virtual bool start();
 
   /// Deactivates current operation which can be resumed later.
   virtual void postpone();
index da5ff1fcb2c3f5325ad25c0e63fbf2621719d138..c8f1224b69d97c89ed9dcd2e6c79b790861d7147 100755 (executable)
@@ -200,7 +200,7 @@ bool ModuleBase_OperationFeature::isDisplayedOnStart(ObjectPtr theObject)
   return myVisualizedObjects.find(theObject) != myVisualizedObjects.end();
 }
 
-void ModuleBase_OperationFeature::start()
+bool ModuleBase_OperationFeature::start()
 {
   setIsModified(false);
   QString anId = getDescription()->operationId();
@@ -220,12 +220,12 @@ void ModuleBase_OperationFeature::start()
       // in order to update commands status in the workshop, to be exact the feature action
       // to be unchecked
       abort();
-      return;
+      return false;
     }
   }
   //Already called startOperation();
   emit started();
-
+  return true;
 }
 
 void ModuleBase_OperationFeature::abort()
index 32e648bd9b0fc96797cf4c76613e55984fcf857a..ab0ce8c900ab13485f5ecf6333ff950674daf10b 100755 (executable)
@@ -133,7 +133,8 @@ signals:
   /// to change behavior of operation. There is no point in using this method. It would
   /// be better to inherit own operator from base one and redefine startOperation method
   /// instead.
-  void start();
+  /// \return true if the start is successful
+  virtual bool start();
 
   /// Aborts operation
   /// Public slot. Aborts operation. This slot is not virtual and cannot be redefined.
index e0139d8f511cb460a2e64661f4d1ea1f045a00ce..d441258e806a1f7e0a7bea31c2c309d129dca3c6 100644 (file)
@@ -136,9 +136,10 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
     connect(aFOperation, SIGNAL(activatedByPreselection()),
             SIGNAL(operationActivatedByPreselection()));
 
-  theOperation->start();
-  onValidateOperation();
-  return true;
+  bool isStarted = theOperation->start();
+  if (isStarted)
+    onValidateOperation();
+  return isStarted;
 }
 
 bool XGUI_OperationMgr::abortAllOperations()