{
if (!myFeature)
return true; // rename operation
+ if (myFeature->isAction())
+ return true;
//Get validators for the Id
SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
return aFactory->validate(myFeature);
}
-//void ModuleBase_Operation::storeCustomValue()
-//{
-// if (!myFeature) {
-//#ifdef _DEBUG
-// qDebug() << "ModuleBase_Operation::storeCustom: " <<
-// "trying to store value without opening a transaction.";
-//#endif
-// return;
-// }
-//
-// ModuleBase_ModelWidget* aCustom = dynamic_cast<ModuleBase_ModelWidget*>(sender());
-// if (aCustom)
-// aCustom->storeValue();
-//}
-
bool ModuleBase_Operation::canBeCommitted() const
{
FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
{
- if (myParentFeature) {
+ if (myParentFeature.get()) {
myFeature = myParentFeature->addFeature(getDescription()->operationId().toStdString());
} else {
std::shared_ptr<ModelAPI_Document> aDoc = document();
void ModuleBase_Operation::start()
{
- ModelAPI_Session::get()->startOperation();
+ QString anId = getDescription()->operationId();
+ ModelAPI_Session::get()->startOperation(anId.toStdString());
if (!myIsEditing)
createFeature();
void ModuleBase_Operation::postpone()
{
- if (myPropertyPanel)
- disconnect(myPropertyPanel, 0, this, 0);
+ postponeOperation();
emit postponed();
}
void ModuleBase_Operation::resume()
{
- // connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
- // this, SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
+ resumeOperation();
emit resumed();
}
{
abortOperation();
emit aborted();
- if (myPropertyPanel)
- disconnect(myPropertyPanel, 0, this, 0);
stopOperation();
bool ModuleBase_Operation::commit()
{
if (canBeCommitted()) {
- if (myPropertyPanel)
- disconnect(myPropertyPanel, 0, this, 0);
-
commitOperation();
// check whether there are modifications performed during the current operation
// in the model
}
+void ModuleBase_Operation::setParentFeature(CompositeFeaturePtr theParent)
+{
+ myParentFeature = theParent;
+}
+
+CompositeFeaturePtr ModuleBase_Operation::parentFeature() const
+{
+ return myParentFeature;
+}
+
void ModuleBase_Operation::initSelection(ModuleBase_ISelection* theSelection,
ModuleBase_IViewer* theViewer)
{
{
myPropertyPanel = theProp;
myPropertyPanel->setEditingMode(isEditOperation());
- //connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), this,
- // SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
// Do not activate widgets by default if the current operation is editing operation
// Because we don't know which widget is going to be edited.