LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
- if(study == NULL) return;
+ bool canCopy = false;
+ bool canPaste = false;
- _PTR(Study) stdDS = study->studyDS();
- if(!stdDS) return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ if (study != NULL) {
+ _PTR(Study) stdDS = study->studyDS();
- QAction* qaction;
+ if (stdDS) {
+ SALOME_ListIteratorOfListIO it ( list );
- SALOME_ListIteratorOfListIO it( list );
- if(it.More() && list.Extent() == 1)
- {
- _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
+ if (it.More() && list.Extent() == 1) {
+ _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
- qaction = action(EditCopyId);
- if( so ) {
- SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
- if ( aSO && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
- else qaction->setEnabled(false);
- }
- else qaction->setEnabled(false);
+ if ( so ) {
+ SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
- qaction = action(EditPasteId);
- if( so ) {
- SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
- if( aSO && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
- else qaction->setEnabled(false);
- }
- else qaction->setEnabled(false);
- }
- else {
- qaction = action(EditCopyId);
- qaction->setEnabled(false);
- qaction = action(EditPasteId);
- qaction->setEnabled(false);
+ if ( aSO ) {
+ canCopy = studyMgr()->CanCopy(so);
+ canPaste = studyMgr()->CanPaste(so);
+ }
+ }
+ }
+ }
}
+
+ action(EditCopyId)->setEnabled(canCopy);
+ action(EditPasteId)->setEnabled(canPaste);
}
/*!Delete references.*/