Salome HOME
Copyright update 2021
[modules/gui.git] / src / GuiHelpers / StandardApp_Module.cxx
index e969ed113f4c57b8a652cb5b4b696e4509c341de..380beaad9ec228ccccec6a2798e82eea7d7e2a30 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2011-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,8 @@
 
 #include "StandardApp_Module.hxx"
 
+#include "SALOME_GuiServices.hxx"
+
 #include <SUIT_Desktop.h>
 #include <SUIT_Study.h>
 #include <SalomeApp_Application.h>
@@ -136,9 +138,9 @@ int StandardApp_Module::createStandardAction(const QString& label,
   }
 
   // Creating the action
-  QAction * action= this->createAction( effIdentifier, label, actionIcon,
-                                        label, effToolTip, 0, getApp()->desktop(),
-                                        false, slotobject, slotmember);
+  this->createAction( effIdentifier, label, actionIcon,
+                      label, effToolTip, 0, getApp()->desktop(),
+                      false, slotobject, slotmember);
 
   return effIdentifier;
 }
@@ -279,7 +281,7 @@ bool StandardApp_Module::activateModule( SUIT_Study* theStudy )
   setToolShown( true );
 
   if ( this->createStudyComponentAtActivation() ) {
-    this->createStudyComponent(theStudy);
+    this->createStudyComponent();
   }
 
   return bOk;
@@ -301,12 +303,9 @@ bool StandardApp_Module::createStudyComponentAtActivation() {
  * the module. This component is associated to the engine (return by
  * getEngine()) if the engine is a SALOMEDS::Driver.
  */
-void StandardApp_Module::createStudyComponent(SUIT_Study* theStudy) {
+void StandardApp_Module::createStudyComponent() {
 
-  SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
-  CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
-  SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(theStudy->id());
+  SALOMEDS::Study_var aDSStudy = GUI::getStudyServant();
 
   SALOMEDS::SComponent_var aFather = aDSStudy->FindComponent(QCHARSTAR(moduleName()));
   if (aFather->_is_nil())