Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Utils.cxx
index 6f921cd220b89ec61998a93c0776ca269c1b05a9..dfe7788315b6dea065c0b093f302042cc2b26d0b 100644 (file)
@@ -205,6 +205,20 @@ namespace SMESH
     return SObjectToObject(theSObject,aStudy);
   }
 
+  _PTR(SObject) ObjectToSObject( CORBA::Object_ptr theObject )
+  {
+    _PTR(SObject) res;
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+      (SUIT_Session::session()->activeApplication());
+    if ( app ) {
+      QString IOR = app->orb()->object_to_string( theObject );
+      SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+      if ( study && !IOR.isEmpty() )
+       res = study->studyDS()->FindObjectIOR( IOR.toLatin1().constData() );
+    }
+    return res;
+  }
+
   CORBA::Object_var IObjectToObject (const Handle(SALOME_InteractiveObject)& theIO)
   {
     if (!theIO.IsNull()) {