void HYDROGUI_DataBrowser::createPopupMenu( QMenu* theMenu )
{
theMenu->clear();
- theMenu->addAction( tr( "ZONE_TO_NEW_REGION" ), this, SIGNAL( newRegion() ) );
+ DataObjectList aSelection = getSelected();
+ bool isOnlyZones = aSelection.size() > 0;
+ foreach( SUIT_DataObject* anObj, aSelection )
+ {
+ HYDROGUI_DataObject* aHydroObj = dynamic_cast<HYDROGUI_DataObject*>( anObj );
+ if( aHydroObj )
+ {
+ Handle(HYDROData_Entity) aModelObj = aHydroObj->modelObject();
+ if( !aModelObj.IsNull() )
+ {
+ isOnlyZones = aModelObj->GetKind()==KIND_ZONE;
+ if( !isOnlyZones )
+ break;
+ }
+ else
+ {
+ isOnlyZones = false;
+ break;
+ }
+ }
+ else
+ {
+ isOnlyZones = false;
+ break;
+ }
+ }
+
+ if( isOnlyZones )
+ theMenu->addAction( tr( "ZONE_TO_NEW_REGION" ), this, SIGNAL( newRegion() ) );
}