if(CORBA::is_nil(aStudy))
{
CORBA::ORB_ptr orb = KERNEL::getORB();
- SALOMEDS_Study_i *servant = new SALOMEDS_Study_i(orb);
+ SALOMEDS_Study_i *servant = new SALOMEDS_Study_i(orb,SALOME::Session::_nil());
aStudy = servant->_this();
}
return SALOMEDS::Study::_duplicate(aStudy);
};
+ //================================================================================
+ /*!
+ * \brief emitMessageOneWay to SALOME::Session
+ */
+ //================================================================================
+
+ void sendMessageToGUIGivenSession(SALOME::Session_ptr session, const char* msg )
+ {
+ if ( !CORBA::is_nil(session) ) {
+ SALOMEDS::unlock();
+ session->emitMessageOneWay( msg );
+ SALOMEDS::lock();
+ }
+ }
+
//================================================================================
/*!
* \brief emitMessageOneWay to SALOME::Session
SALOME_NamingService *aNamingService = KERNEL::getNamingService();
CORBA::Object_var obj = aNamingService->Resolve("/Kernel/Session");
SALOME::Session_var aSession = SALOME::Session::_narrow(obj);
- if ( !CORBA::is_nil(aSession) ) {
- SALOMEDS::unlock();
- aSession->emitMessageOneWay( msg );
- SALOMEDS::lock();
- }
+ sendMessageToGUIGivenSession(aSession,msg);
}
} // namespace SALOMEDS
+SALOMEDS_Study_i::SALOMEDS_Study_i(CORBA::ORB_ptr orb)
+{
+ _orb = CORBA::ORB::_duplicate(orb);
+ _impl = new SALOMEDSImpl_Study();
+ _factory = new SALOMEDS_DriverFactory_i(_orb);
+ _closed = true;
+ SALOME_NamingService *aNamingService = KERNEL::getNamingService();
+ CORBA::Object_var obj = aNamingService->Resolve("/Kernel/Session");
+ SALOME::Session_var aSession = SALOME::Session::_narrow(obj);
+ Init(aSession);
+}
+
//============================================================================
/*! Function : SALOMEDS_Study_i
* Purpose : SALOMEDS_Study_i constructor
*/
//============================================================================
-SALOMEDS_Study_i::SALOMEDS_Study_i(CORBA::ORB_ptr orb)
+SALOMEDS_Study_i::SALOMEDS_Study_i(CORBA::ORB_ptr orb, SALOME::Session_ptr session)
{
_orb = CORBA::ORB::_duplicate(orb);
_impl = new SALOMEDSImpl_Study();
_factory = new SALOMEDS_DriverFactory_i(_orb);
_closed = true;
- Init();
+ Init(session);
}
//============================================================================
delete _impl;
}
+void SALOMEDS_Study_i::Init()
+{
+ SALOME_NamingService *aNamingService = KERNEL::getNamingService();
+ CORBA::Object_var obj = aNamingService->Resolve("/Kernel/Session");
+ SALOME::Session_var aSession = SALOME::Session::_narrow(obj);
+ Init(aSession);
+}
+
//============================================================================
/*! Function : Init
* Purpose : Initialize study components
*/
//============================================================================
-void SALOMEDS_Study_i::Init()
+void SALOMEDS_Study_i::Init(SALOME::Session_ptr session)
{
if (!_closed)
//throw SALOMEDS::Study::StudyInvalidReference();
_impl->setGenObjRegister( _genObjRegister );
// Notify GUI that study was created
- SALOMEDS::sendMessageToGUI( "studyCreated" );
+ SALOMEDS::sendMessageToGUIGivenSession( session, "studyCreated" );
// update desktop title with new study name
- NameChanged();
+ NameChanged(session);
}
//============================================================================
_impl->URL(Kernel_Utils::encode_s(wurl));
// update desktop title with new study name
- NameChanged();
+ SALOME_NamingService *aNamingService = KERNEL::getNamingService();
+ CORBA::Object_var obj = aNamingService->Resolve("/Kernel/Session");
+ SALOME::Session_var aSession = SALOME::Session::_narrow(obj);
+ NameChanged(aSession);
}
void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR, const char* anEntry)
return reinterpret_cast<CORBA::LongLong>(_impl);
}
-void SALOMEDS_Study_i::NameChanged()
+void SALOMEDS_Study_i::NameChanged(SALOME::Session_ptr session)
{
- SALOMEDS::sendMessageToGUI( "studyNameChanged" );
+
+ SALOMEDS::sendMessageToGUIGivenSession(session,"studyNameChanged" );
}
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_GenericObj)
#include CORBA_SERVER_HEADER(SALOMEDS)
-
+#include CORBA_CLIENT_HEADER(SALOME_Session)
#include <stdio.h>
//SALOMEDS headers
{
private:
- void NameChanged();
+ void NameChanged(SALOME::Session_ptr session);
CORBA::ORB_var _orb;
SALOMEDSImpl_Study* _impl;
SALOMEDS_StudyBuilder_i* _builder;
bool _closed;
public:
-
//! standard constructor
SALOMEDS_Study_i(CORBA::ORB_ptr);
+ //! standard constructor
+ SALOMEDS_Study_i(CORBA::ORB_ptr, SALOME::Session_ptr session);
//! standard destructor
virtual PortableServer::POA_ptr _default_POA();
- virtual void Init();
+ virtual void Init() override;
+ virtual void Init(SALOME::Session_ptr session);
virtual void Clear();
//! method to open a Study