From: nds Date: Wed, 25 Dec 2013 11:57:33 +0000 (+0000) Subject: Refs #90 - prohibit deletion of child objects X-Git-Tag: BR_hydro_v_0_7~63 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=717efb4a3b5facc2488441c1ac3c04e4eb6133ed;p=modules%2Fhydro.git Refs #90 - prohibit deletion of child objects --- diff --git a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx index da2cd373..8d55ce79 100644 --- a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx @@ -87,10 +87,29 @@ void HYDROGUI_DeleteOp::startOperation() QMap aBackObjects = HYDROGUI_Tool::GetObjectsBackReferences( module(), anObjNames ); + QMap::const_iterator anIt = aBackObjects.begin(), + aLast = aBackObjects.end(); + QStringList aRefList; + for ( ; anIt != aLast; anIt++ ) { + QStringList aSeqList; + HYDROData_SequenceOfObjects::Iterator anIter( anIt.value() ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Entity) anEntity = anIter.Value(); + if ( anEntity.IsNull() ) + continue; + aSeqList.append( QString( tr( "DELETE_OBJECT_NAME" ) ).arg( anEntity->GetName() ) ); + } + aRefList.append( QString( tr( "DELETE_OBJECT_IS_USED_FOR" ) ).arg( anIt.key() ) + .arg( aSeqList.join( ", " ) ) ); + } + + //QString aNamesList = anObjNames.join( "\n" ); if ( !aBackObjects.isEmpty() ) { SUIT_MessageBox::critical( module()->getApp()->desktop(), - tr( "DELETE_OBJECTS" ), tr( "DELETED_OBJECTS_HAS_BACKREFERENCES" ) ); + tr( "DELETE_OBJECTS" ), + tr( "DELETED_OBJECTS_HAS_BACKREFERENCES" ).arg( aRefList.join( "\n" ) ) ); abort(); return; } diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 66f5699b..36645c56 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -337,7 +337,17 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) DELETED_OBJECTS_HAS_BACKREFERENCES One or more selected objects are used to create another ones. -First remove objects which are created on their basis. +First remove objects which are created on their basis. + +%1 + + + DELETE_OBJECT_NAME + "%1" + + + DELETE_OBJECT_IS_USED_FOR + Object "%1" is used for %2