Salome HOME
Implementation of 0021855: EDF 2321 GEOM : Add folders to group objects in the object...
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_1.cxx
index f2ede26792947a88385f3c86328b2e656c7f638d..5d158445fe3051b29e15ddbf0752175257e30fc8 100644 (file)
@@ -51,6 +51,8 @@
 #include <SALOME_ListIO.hxx>
 #include <SALOME_ListIteratorOfListIO.hxx>
 
+#include <SALOMEDS_SObject.hxx>
+
 #include <SOCC_Prs.h>
 
 #include <SVTK_Prs.h>
@@ -806,3 +808,30 @@ void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
   }
   displayer.UpdateViewer();
 }
+
+void GEOMToolsGUI::OnCreateFolder()
+{
+  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  if ( !app ) return;
+
+  SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+  if ( !appStudy ) return;
+
+  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+  if ( !aSelMgr ) return;
+
+  SALOME_ListIO selected;
+  aSelMgr->selectedObjects( selected );
+  if ( selected.IsEmpty() ) return;
+
+  Handle(SALOME_InteractiveObject) anIObject = selected.First();
+
+  _PTR(Study) aStudy = appStudy->studyDS();
+  if( !aStudy ) return;
+  _PTR(SObject) aFatherSO(aStudy->FindObjectID(anIObject->getEntry()));
+  if ( !aFatherSO ) return;
+
+  GeometryGUI::GetGeomGen()->CreateFolder( tr("NEW_FOLDER_NAME").toLatin1().constData(), 
+                                          _CAST(SObject, aFatherSO)->GetSObject() );
+  app->updateObjectBrowser( false );
+}