Salome HOME
Correction of bug MANTIS23234 CEA1726.
[modules/yacs.git] / src / salomegui / Yacsgui.cxx
index 8a90fca89943f47bf015fc64cca01f14005c0713..9d040d07cbea2538c3420c70e07a73e4adcedecf 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2015  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -112,7 +112,19 @@ void Yacsgui::initialize( CAM_Application* app )
   _genericGui->createTools();
   this->studyActivated();
 
-  if (createSComponent()) updateObjBrowser();
+  // VSR 23/10/2014: note that this is not a good way to create SComponent from this point
+  // as initialize() method can be potentially called when there's no yet open study;
+  // this is better to do in activateModule()
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( aStudy ) {
+    bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->studyDS()->GetProperties()))->IsLocked();
+    if ( aLocked ) {
+      SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
+    }
+    else  {
+      if (createSComponent()) updateObjBrowser();
+    }
+  }
 
   // Load SALOME module catalogs
   QStringList appModules;