std::string::size_type debut = 0;
std::string::size_type fin;
SalomeApp_DataObject* anObj = dynamic_cast<SalomeApp_DataObject*>( myStudy->root() );
- while ( 1 ) {
+ while ( anObj ) {
fin = obj_id.find_first_of( ':', debut );
if ( fin == std::string::npos ) {
//last id
anObj = dynamic_cast<SalomeApp_DataObject*>(anObj->childObject(atoi(obj_id.substr(debut).c_str())-1));
- entry2SuitObject[parent_id] = anObj;
+ if ( anObj )
+ entry2SuitObject[parent_id] = anObj;
break;
}
anID = root_id + obj_id.substr( 0, fin );
if ( it2 == entry2SuitObject.end() ) {
//the ID is not known in entry2SuitObject
anObj = dynamic_cast<SalomeApp_DataObject*>(anObj->childObject(atoi(obj_id.substr(debut, fin-debut).c_str())-1));
- entry2SuitObject[anID] = anObj;
+ if ( anObj )
+ entry2SuitObject[anID] = anObj;
}
else
anObj = it2->second;
debut = fin+1;
}
- anObj->insertChildAtTag( suit_obj, tag );
+ if ( anObj )
+ anObj->insertChildAtTag( suit_obj, tag );
}
}
entry2SuitObject[theID] = suit_obj;
QString aName = newStudyName();
_PTR(Study) study;
+ bool showError = !application()->property("open_study_from_command_line").isValid() ||
+ !application()->property("open_study_from_command_line").toBool();
try {
study = _PTR(Study)( SalomeApp_Application::studyMgr()->NewStudy( aName.toUtf8().data() ) );
}
catch(const SALOME_Exception& ex) {
- SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
- tr("ERR_ERROR"), tr(ex.what()));
+ application()->putInfo(tr(ex.what()));
+ if ( showError )
+ SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+ tr("ERR_ERROR"), tr(ex.what()));
return false;
}
catch(...) {
- SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
- tr("ERR_ERROR"), tr("CREATE_DOCUMENT_PROBLEM"));
+ application()->putInfo(tr("CREATE_DOCUMENT_PROBLEM"));
+ if ( showError )
+ SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+ tr("ERR_ERROR"), tr("CREATE_DOCUMENT_PROBLEM"));
return false;
}
// initialize myStudyDS, read HDF file
_PTR(Study) study;
+ bool showError = !application()->property("open_study_from_command_line").isValid() ||
+ !application()->property("open_study_from_command_line").toBool();
try {
study = _PTR(Study) ( SalomeApp_Application::studyMgr()->Open( theFileName.toUtf8().data() ) );
}
catch(const SALOME_Exception& ex) {
- SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
- tr("ERR_ERROR"), tr(ex.what()));
+ application()->putInfo(tr(ex.what()));
+ if ( showError )
+ SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+ tr("ERR_ERROR"), tr(ex.what()));
return false;
}
catch(...) {
- SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
- tr("ERR_ERROR"), tr("OPEN_DOCUMENT_PROBLEM"));
+ application()->putInfo(tr("OPEN_DOCUMENT_PROBLEM"));
+ if ( showError )
+ SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
+ tr("ERR_ERROR"), tr("OPEN_DOCUMENT_PROBLEM"));
return false;
}