SUIT_Desktop*
GetDesktop(const CAM_Module* theModule)
{
- return theModule->application()->desktop();
+ return theModule && theModule->application() ? theModule->application()->desktop() : 0;
}
//------------------------------------------------------------
LightApp_SelectionMgr*
GetSelectionMgr(const SalomeApp_Module* theModule)
{
- return theModule->getApp()->selectionMgr();
+ return theModule && theModule->getApp() ? theModule->getApp()->selectionMgr() : 0;
}
//------------------------------------------------------------
SalomeApp_Study*
GetAppStudy(const CAM_Module* theModule)
{
- return
- dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy());
+ return theModule && theModule->application() ?
+ dynamic_cast<SalomeApp_Study*>(theModule->application()->activeStudy()) : 0;
}
//------------------------------------------------------------
_PTR(Study)
GetCStudy(const SalomeApp_Study* theStudy)
{
- return theStudy->studyDS();
+ return theStudy ? theStudy->studyDS() : _PTR(Study)();
}
//------------------------------------------------------------
bool
IsStudyLocked( _PTR(Study) theStudy )
{
- if( theStudy )
- return theStudy->GetProperties()->IsLocked();
- return true;
+ return theStudy ? theStudy->GetProperties()->IsLocked() : true;
}
//------------------------------------------------------------
TSelectionInfo aSelectionInfo;
const SalomeApp_Study* aStudy = GetAppStudy(theModule);
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
- SALOME_ListIO aListIO;
- aSelectionMgr->selectedObjects(aListIO);
- SALOME_ListIteratorOfListIO anIter(aListIO);
- while(anIter.More())
- {
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if(anIO->hasEntry())
+ if ( aStudy && aSelectionMgr ) {
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ while(anIter.More())
{
- TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry());
- if(anObjectInfo.mySObject){
- TSelectionItem aSelectionItem;
- aSelectionItem.myObjectInfo = anObjectInfo;
- aSelectionItem.myIO = anIO;
- aSelectionInfo.push_back(aSelectionItem);
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if(anIO->hasEntry())
+ {
+ TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry());
+ if(anObjectInfo.mySObject){
+ TSelectionItem aSelectionItem;
+ aSelectionItem.myObjectInfo = anObjectInfo;
+ aSelectionItem.myIO = anIO;
+ aSelectionInfo.push_back(aSelectionItem);
+ }
}
+ anIter.Next(); // MULTIPR fixed
}
- anIter.Next(); // MULTIPR fixed
}
return aSelectionInfo;
}