Salome HOME
Modif for salome gui without neither NS nor other servers.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index ff88035b1238d665f0230d67d0da51ea0eed8203..e96570c1f06233a1e4e7d7c9d0bf14033abebf41 100644 (file)
 #include "SMESH_ControlsDef.hxx"
 #include "SMESH_ScalarBarActor.h"
 #include "SMESH_TypeFilter.hxx"
+#include "SMESH_Component_Generator.hxx"
 
 // SALOME GUI includes
 #include <LightApp_DataOwner.h>
@@ -2155,13 +2156,20 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
  *
  */
 //=============================================================================
-SMESHGUI::SMESHGUI() :
-SalomeApp_Module( "SMESH" )
+SMESHGUI::SMESHGUI() : SalomeApp_Module( "SMESH" )
 {
   if ( CORBA::is_nil( myComponentSMESH ) )
   {
     CORBA::Boolean anIsEmbeddedMode;
-    myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
+    SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
+    if( dynamic_cast<SALOME_NamingService *>(ns) )
+      myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
+    else
+      {
+        Engines::EngineComponent_var comp = RetrieveSMESHInstance();
+        myComponentSMESH = SMESH::SMESH_Gen::_narrow(comp);
+      }
+    
     //MESSAGE("-------------------------------> anIsEmbeddedMode=" << anIsEmbeddedMode);
 
     //  0019923: EDF 765 SMESH : default values of hypothesis