+ AppElements_Command* aXCmd = dynamic_cast<AppElements_Command*>(theCmd);
+ if (aXCmd) {
+ myNestedActions[aId] = aXCmd->nestedCommands();
+ } else {
+ XGUI_Workshop* aWorkshop = static_cast<XGUI_Workshop*>(parent());
+ myNestedActions[aId] = aWorkshop->salomeConnector()->nestedActions(aId);
+ }
+}
+
+void XGUI_ActionsMgr::addNestedCommands(const QString& theId, const QStringList& theCommands)
+{
+ myNestedActions[theId] = theCommands;
+}
+
+QStringList XGUI_ActionsMgr::nestedCommands(const QString& theId) const
+{
+ if (myNestedActions.contains(theId))
+ return myNestedActions[theId];
+ return QStringList();
+}
+
+bool XGUI_ActionsMgr::isNested(const QString& theId) const
+{
+ foreach(QString aId, myNestedActions.keys())
+ {
+ QStringList aList = myNestedActions[aId];
+ if (aList.contains(theId))
+ return true;
+ }
+ return false;
+}
+
+void XGUI_ActionsMgr::update()
+{
+ FeaturePtr anActiveFeature = FeaturePtr();
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (myOperationMgr->currentOperation());
+ if (aFOperation) {
+ anActiveFeature = aFOperation->feature();
+ if(anActiveFeature.get()) {
+ setAllEnabled(false);
+ QString aFeatureId = QString::fromStdString(anActiveFeature->getKind());
+ setActionEnabled(aFeatureId, true);
+ }
+ setNestedStackEnabled(aFOperation);
+ } else {
+ setAllEnabled(true);
+ setNestedCommandsEnabled(false);
+ }
+ // TODO(SBH): Get defaults state of actions from XML and remove the following method
+ updateByDocumentKind();
+ updateCheckState();
+ updateByPlugins(anActiveFeature);
+}
+
+void XGUI_ActionsMgr::updateCheckState()
+{
+ QString eachCommand = QString();
+ foreach(eachCommand, myActions.keys()) {
+ setActionChecked(eachCommand, false);
+ }
+ QStringList ltActiveCommands = myOperationMgr->operationList();
+ foreach(eachCommand, ltActiveCommands) {
+ setActionChecked(eachCommand, true);
+ }