]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
NRI : Use component username from Catalog.
authornri <nri@opencascade.com>
Mon, 19 May 2003 08:01:46 +0000 (08:01 +0000)
committernri <nri@opencascade.com>
Mon, 19 May 2003 08:01:46 +0000 (08:01 +0000)
src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERVGUI_Def.h
src/SUPERVGUI/SUPERVGUI_Main.cxx
src/Supervision/SuperV_Impl.cxx

index 16526a35ffb178ca12eb17380af594b30f4d7507..ecc765b86fbebba0cee52d457fe705c6561724ee 100644 (file)
@@ -474,7 +474,8 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b
       if (comp->FindAttribute(anAttr, "AttributeName")) {
        aName = SALOMEDS::AttributeName::_narrow(anAttr);
        QString compName(aName->Value());
-       if (compName.compare(STUDY_SUPERVISION) == 0) {
+       //      if (compName.compare(STUDY_SUPERVISION) == 0) {
+       if (compName.compare( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) == 0) {
          SALOMEDS::GenericAttribute_var anAttr;
          if (obj->FindAttribute(anAttr, "AttributeIOR")) {
            SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
index 64ae50cc1a6944ca648f65e0d546af5bb4edcbf4..f202f595d54a9eb7c3c05d603e4d52513e881b88 100644 (file)
@@ -12,7 +12,7 @@
 // Nom du noeud de supervision dans l'etude
 // ----------------------------------------
 
-#define STUDY_SUPERVISION "Supervision"
+#define STUDY_SUPERVISION "SUPERV"
 
 #define STUDY_PORT_IN  "In"
 #define STUDY_PORT_OUT "Out"
index f1567495687873e0ccdb9a0b062ae2753d129522..74595fb33779821d754c797e8a96111f08197e5e 100644 (file)
@@ -713,7 +713,8 @@ void SUPERVGUI_Main::showPopup(QPopupMenu* p, QMouseEvent* e) {
   // To check is Supervision active?
   if (myIsLocked) return;
 
-  if (QAD_Application::getDesktop()->getActiveComponent().compare(STUDY_SUPERVISION) !=0) return;
+  //  if (QAD_Application::getDesktop()->getActiveComponent().compare(STUDY_SUPERVISION) !=0) return;
+  if (QAD_Application::getDesktop()->getActiveComponent().compare( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) !=0) return;
 
   checkIsInStudy();
   if (e->button() == RightButton) {
@@ -884,7 +885,7 @@ bool SUPERVGUI_Main::putDataStudy(SUPERV_Port p, const char* inout) {
       aComponent = aBuilder->NewComponent(STUDY_SUPERVISION);
       anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName");
       aName = SALOMEDS::AttributeName::_narrow(anAttr);
-      aName->SetValue(STUDY_SUPERVISION);
+      aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) );
        
       anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
       aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
index 7f656a0fef3d7eb128b6697e64a4f574a0aedc3b..92cd32578185505c55ff5c6031c1967c224f5b72 100644 (file)
@@ -30,7 +30,7 @@ using namespace std;
 
 #include "Utils_CorbaException.hxx"
 
-#define STUDY_SUPERVISION "Supervision"
+#define STUDY_SUPERVISION "SUPERV"
 
 SuperV_Impl::SuperV_Impl( CORBA::ORB_ptr orb ,
                          PortableServer::POA_ptr poa ,
@@ -162,7 +162,7 @@ void SuperV_Impl::Close(SALOMEDS::SComponent_ptr theComponent) {
 }
 
 char* SuperV_Impl::ComponentDataType() {
-    return(strdup("Supervision"));
+    return(strdup("SUPERV"));
 }
 
 char* SuperV_Impl::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
@@ -239,8 +239,16 @@ SALOMEDS::SObject_ptr SuperV_Impl::PublishInStudy(SALOMEDS::Study_ptr theStudy,
     aFather = aBuilder->NewComponent(STUDY_SUPERVISION);
     anAttr = aBuilder->FindOrCreateAttribute(aFather, "AttributeName");
     aName = SALOMEDS::AttributeName::_narrow(anAttr);
-    aName->SetValue(STUDY_SUPERVISION);
-       
+    //NRI    aName->SetValue(STUDY_SUPERVISION);
+    
+    SALOME_NamingService *NamingService = new SALOME_NamingService(_Orb);
+    CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog");
+    SALOME_ModuleCatalog::ModuleCatalog_var Catalogue  = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN);
+    SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( STUDY_SUPERVISION );
+    if ( !Comp->_is_nil() ) {
+      aName->SetValue( Comp->componentusername() );
+    }
+
     anAttr = aBuilder->FindOrCreateAttribute(aFather, "AttributePixMap");
     aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );