Salome HOME
1) Export Image operation.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ObjSelector.cxx
index 737b19f3702e83acd49d40a45126fd30efc8ff42..3b7e1e5939c0787fdcaeaf12d2e8647b84d7f221 100644 (file)
 
 #include "HYDROGUI_DataModel.h"
 #include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
 
 #include <GraphicsView_Object.h>
 
 #include <LightApp_Application.h>
-#include <LightApp_DataOwner.h>
 #include <LightApp_GVSelector.h>
 #include <LightApp_SelectionMgr.h>
 
@@ -94,27 +94,11 @@ void HYDROGUI_ObjSelector::OnSelectionChanged()
   if( !myBtn->isChecked() )
     return;
 
-  SUIT_SelectionMgr* aSelMgr = myModule->getApp()->selectionMgr();
-  SUIT_DataOwnerPtrList anOwners;
-  aSelMgr->selected( anOwners );
-
-  HYDROGUI_DataModel* aModel = myModule->getDataModel();
-
   QString anObjName;
-  foreach( SUIT_DataOwner* anOwner, anOwners )
-  {
-    LightApp_DataOwner* aGrDOwner = dynamic_cast<LightApp_DataOwner*>( anOwner );
-    if( aGrDOwner )
-    {
-      QString anEntry = aGrDOwner->entry();
-      Handle(HYDROData_Object) anObject = aModel->objectByEntry( anEntry, KIND_IMAGE );
-      if( !anObject.IsNull() )
-      {
-        anObjName = anObject->GetName();
-        break;
-      }
-    }
-  }
+  Handle(HYDROData_Object) anObject = HYDROGUI_Tool::GetSelectedObject( myModule );
+  if( !anObject.IsNull() )
+    anObjName = anObject->GetName();
+
   myObjName->setText( anObjName );
 }