+void XGUI_ActionsMgr::addCommand(QAction* theCmd)
+{
+ QString aId = theCmd->data().toString();
+ if (aId.isEmpty()) {
+ return;
+ }
+ myActions.insert(aId, theCmd);
+ 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();
+ if (myOperationMgr->hasOperation()) {
+ ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
+ anActiveFeature = anOperation->feature();
+ if(anActiveFeature.get()) {
+ setAllEnabled(false);
+ QString aFeatureId = QString::fromStdString(anActiveFeature->getKind());
+ setActionEnabled(aFeatureId, true);
+ }
+ setNestedStackEnabled(anOperation);
+ } else {
+ setAllEnabled(true);
+ setNestedCommandsEnabled(false);
+ }
+ // TODO(SBH): Get defaults state of actions from XML and remove the following method
+ updateByDocumentKind();
+ updateCheckState();
+ updateByPlugins(anActiveFeature);
+}