]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix TestParameterRename
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 18 Sep 2015 08:30:49 +0000 (11:30 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 18 Sep 2015 08:31:23 +0000 (11:31 +0300)
src/ParametersPlugin/ParametersPlugin_EvalListener.cpp
src/ParametersPlugin/ParametersPlugin_EvalListener.h

index 8b5e915eeb7e8738996239d481757839d23f2411..183a027f4962a42e35fc2031ed3da1e4079a978f 100644 (file)
@@ -280,17 +280,9 @@ void ParametersPlugin_EvalListener::renameInAttribute(
 }
 
 void ParametersPlugin_EvalListener::renameInDependants(std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
+                                                       const std::string& theOldName,
                                                        const std::string& theNewName)
 {
-  // get parameter feature for the result
-  std::shared_ptr<ParametersPlugin_Parameter> aParameter =
-      std::dynamic_pointer_cast<ParametersPlugin_Parameter>(
-          ModelAPI_Feature::feature(theResultParameter));
-  if (!aParameter.get())
-    return;
-
-  std::string anOldName = aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->value();
-
   std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes =
       theResultParameter->data()->refsToMe();
   std::set<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anAttributeIt =
@@ -303,10 +295,10 @@ void ParametersPlugin_EvalListener::renameInDependants(std::shared_ptr<ModelAPI_
               anAttribute->owner());
       if (aParameter.get())
         // Rename
-        renameInParameter(aParameter, anOldName, theNewName);
+        renameInParameter(aParameter, theOldName, theNewName);
     } else
         // Rename
-        renameInAttribute(anAttribute, anOldName, theNewName);
+        renameInAttribute(anAttribute, theOldName, theNewName);
   }
 }
 
@@ -366,7 +358,7 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent(
     return;
   }
 
-  renameInDependants(aResultParameter, aMessage->newName());
+  renameInDependants(aResultParameter, aMessage->oldName(), aMessage->newName());
 }
 
 void ParametersPlugin_EvalListener::processReplaceParameterEvent(
@@ -391,5 +383,5 @@ void ParametersPlugin_EvalListener::processReplaceParameterEvent(
   double aRealValue = aResultParameter->data()->real(ModelAPI_ResultParameter::VALUE())->value();
   std::string aValue = toStdString(aRealValue);
 
-  renameInDependants(aResultParameter, aValue);
+  renameInDependants(aResultParameter, aResultParameter->data()->name(), aValue);
 }
index 56bb88dd47fe12acf9c62121e31fc497b41b7534..c24831780ebf1b2cf53dfa7eb8b101867681a94e 100644 (file)
@@ -43,6 +43,7 @@ class ParametersPlugin_EvalListener : public Events_Listener
                          const std::string& theOldName,
                          const std::string& theNewName);
   void renameInDependants(std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
+                          const std::string& theOldName,
                           const std::string& theNewName);
 
  private: