+ class TEvent: public SALOME_Event {
+ std::string myStudyName;
+ public:
+ TEvent(const std::string theStudyName):myStudyName(theStudyName)
+ {}
+ virtual void Execute()
+ {
+ bool isActive = false;
+ SUIT_Session* aSession = SUIT_Session::session();
+ QPtrList<SUIT_Application> anApplications = aSession->applications();
+ QPtrListIterator<SUIT_Application> anIter (anApplications);
+ SUIT_Application* aFirstApp = anIter.current();
+ while (SUIT_Application* anApp = anIter.current()) {
+ ++anIter;
+ if (SUIT_Study* aSStudy = anApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ MESSAGE("There is an application with active study : StudyId = "
+ << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
+ if (myStudyName == aCStudy->Name()) {
+ isActive = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!isActive) {
+ MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!");
+ // Has to be loaded in an empty or in a new application
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
+ anApp->onLoadDoc(myStudyName);
+ }
+ }
+ };
+