clearPreselection();
}
-void ModuleBase_OperationFeature::setEditOperation()
+void ModuleBase_OperationFeature::setEditOperation(const bool theRestartTransaction)
{
if (isEditOperation())
return;
myIsEditing = true;
+ if (theRestartTransaction) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ DocumentPtr aDoc = aMgr->activeDocument();
+ FeaturePtr aFeature = aDoc->currentFeature(false);
+ ModelAPI_Session::get()->finishOperation();
+ FeaturePtr anAFeature = aDoc->currentFeature(false);
+
+ QString anId = getDescription()->operationId();
+ if (myIsEditing) {
+ anId = anId.append(EditSuffix());
+ }
+ ModelAPI_Session::get()->startOperation(anId.toStdString());
+ emit beforeStarted();
+ }
+
propertyPanel()->setEditingMode(isEditOperation());
}
/// Change the operation mode from create to edit.
/// The transaction and the operation name in the model history of transaction are the same.
/// It updates the edit state in the widgets of property panel
- void setEditOperation();
+ /// \param theRestartTransaction if true, the current model transaction is committed and
+ /// the new one is started
+ void setEditOperation(const bool theRestartTransaction);
/// Returns the operation feature
/// \return the feature
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(myWorkshop->currentOperation());
- aFOperation->setEditOperation();
+ aFOperation->setEditOperation(true);
FeaturePtr anOperationFeature = aFOperation->feature();
if (anOperationFeature.get() != NULL) {