#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "SALOME_NotebookDriver.hxx"
+
#include "Utils_CorbaException.hxx"
#include "Utils_ExceptHandlers.hxx"
#include "Basics_Utils.hxx"
if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" )
else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str()));
- Study->GetNotebook();
+ SALOMEDS::SComponent_ptr aNotebookComponent = Study->FindComponent( "NOTEBOOK" );
+ SALOMEDS::StudyBuilder_var aBuilder = Study->NewBuilder();
+ aBuilder->LoadWith( aNotebookComponent, SALOME_NotebookDriver::getInstance() );
return Study._retn();
}
SALOME_Notebook* aNb = new SALOME_Notebook( _default_POA(), _this() );
myNotebook = aNb->_this();
- //Creation of default component for the Notebook
- SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::StudyBuilder_var aStudyBuilder = NewBuilder();
- SALOMEDS::SComponent_var aNotebookComponent = aStudyBuilder->NewComponent( "NOTEBOOK" );
+ SALOMEDS::SComponent_var aNotebookComponent = FindComponent( "NOTEBOOK" );
+ if( CORBA::is_nil( aNotebookComponent ) )
+ {
+ //Creation of default component for the Notebook
+ SALOMEDS::GenericAttribute_var anAttr;
+ aNotebookComponent = aStudyBuilder->NewComponent( "NOTEBOOK" );
- anAttr = aStudyBuilder->FindOrCreateAttribute( aNotebookComponent, "AttributeName" );
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( anAttr );
- aName->SetValue( "Notebook" );
- aName->Destroy();
+ anAttr = aStudyBuilder->FindOrCreateAttribute( aNotebookComponent, "AttributeName" );
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( anAttr );
+ aName->SetValue( "Notebook" );
+ aName->Destroy();
- anAttr = aStudyBuilder->FindOrCreateAttribute( aNotebookComponent, "AttributePixMap" );
- SALOMEDS::AttributePixMap_var aPixMap = SALOMEDS::AttributePixMap::_narrow( anAttr );
- aPixMap->SetPixMap( "ICON_OBJBROWSER_Notebook" );
- aPixMap->Destroy();
+ anAttr = aStudyBuilder->FindOrCreateAttribute( aNotebookComponent, "AttributePixMap" );
+ SALOMEDS::AttributePixMap_var aPixMap = SALOMEDS::AttributePixMap::_narrow( anAttr );
+ aPixMap->SetPixMap( "ICON_OBJBROWSER_Notebook" );
+ aPixMap->Destroy();
- SALOME_NotebookDriver* aDriver = new SALOME_NotebookDriver();
- SALOMEDS::Driver_var aDriverVar = aDriver->_this();
- aStudyBuilder->DefineComponentInstance( aNotebookComponent, aDriverVar._retn() );
+ aStudyBuilder->DefineComponentInstance( aNotebookComponent, SALOME_NotebookDriver::getInstance() );
+ }
}
return SALOME::Notebook::_duplicate( myNotebook );