#include "HYDROGUI_DeleteOp.h"
-#include "HYDROGUI_DataModel.h"
#include "HYDROGUI_Module.h"
-#include "HYDROGUI_Operations.h"
+#include "HYDROGUI_Tool.h"
#include "HYDROGUI_UpdateFlags.h"
-#include <HYDROData_Iterator.h>
#include <HYDROData_Object.h>
#include <LightApp_Application.h>
-#include <LightApp_DataOwner.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
-#include <SUIT_SelectionMgr.h>
HYDROGUI_DeleteOp::HYDROGUI_DeleteOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule )
{
HYDROGUI_Operation::startOperation();
- HYDROGUI_DataModel* aModel = module()->getDataModel();
-
- SUIT_SelectionMgr* aSelectionMgr = selectionMgr();
- SUIT_DataOwnerPtrList anOwners;
- aSelectionMgr->selected( anOwners );
-
- if( !anOwners.isEmpty() )
+ HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
+ if( !aSeq.IsEmpty() )
{
int anAnswer = SUIT_MessageBox::question( module()->getApp()->desktop(),
tr( "DELETE_OBJECTS" ),
}
}
- foreach( SUIT_DataOwner* aSUITOwner, anOwners )
+ for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
{
- if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
- {
- Handle(HYDROData_Object) anObject = aModel->objectByEntry( anOwner->entry() );
- if( !anObject.IsNull() )
- anObject->Remove();
- }
+ Handle(HYDROData_Object) anObject = aSeq.Value( anIndex );
+ if( !anObject.IsNull() )
+ anObject->Remove();
}
module()->update( UF_Model | UF_Viewer );