+
+//**************************************************************
+void XGUI_Workshop::updateCommandsOnViewSelection()
+{
+ PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+ ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+ Handle(AIS_InteractiveContext) aContext = viewer()->AISContext();
+
+ QList<QAction*> aActions = getModuleCommands();
+ foreach(QAction* aAction, aActions) {
+ QString aId = aAction->data().toString();
+ const ModelAPI_Validator* aValidator = aFactory->validator(aId.toStdString());
+ if (aValidator) {
+ const ModuleBase_ViewSelectionValidator* aSelValidator =
+ dynamic_cast<const ModuleBase_ViewSelectionValidator*>(aValidator);
+ if (aSelValidator) {
+ aAction->setEnabled(aSelValidator->isValid(aContext));
+ }
+ }
+ }
+}