Salome HOME
NRI : Remove dependence with VISU.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_GenericAttribute_i.cxx
1 using namespace std;
2 //  File      : SALOMEDS_GenericAttribute_i.cxx
3 //  Created   : Fri Jul 05 15:49:37 2002
4 //  Author    : Mikhail PONIKAROV
5
6 //  Project   : SALOME
7 //  Module    : SALOMEDS
8 //  Copyright : Open CASCADE 2002
9 //  $Header$
10
11 #include "SALOMEDS_StudyBuilder_i.hxx"
12
13 void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) {
14   if (!_myAttr.IsNull() && _myAttr->IsValid() && !CORBA::is_nil(_myOrb)) {
15     Handle(SALOMEDS_IORAttribute) Att;
16     if (_myAttr->Label().Root().FindAttribute(SALOMEDS_IORAttribute::GetID(),Att)){
17       TCollection_AsciiString ch(Att->Get());
18       char* IOR = CORBA::string_dup(ch.ToCString());
19       CORBA::Object_var obj = _myOrb->string_to_object(IOR);
20       SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj);
21       //        ASSERT(!CORBA::is_nil(aStudy));
22       if (aStudy->NewBuilder()->HasOpenCommand()) return;
23       if (aStudy->GetProperties()->IsLocked()) {
24         //        INFOS("Locked document modification !!!");
25         throw SALOMEDS::GenericAttribute::LockProtection();
26       }
27     }
28   }
29 }