]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Activate/Deactivate command in Part pop-up menu (issue #23)
authorvsv <vitaly.smetannikov@opencascade.com>
Mon, 19 May 2014 07:37:06 +0000 (11:37 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Mon, 19 May 2014 07:37:06 +0000 (11:37 +0400)
src/XGUI/XGUI_ContextMenuMgr.cpp

index 2a8fe108b3e4a5b23ff8e4515ebe37a5128a2f21..753027907a5a02784ae85c35dc299e37a55d3fa4 100644 (file)
@@ -4,6 +4,9 @@
 #include "XGUI_ObjectsBrowser.h"
 #include "XGUI_SelectionMgr.h"
 
+#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeDocRef.h>
+
 #include <QAction>
 #include <QContextMenuEvent>
 #include <QMenu>
@@ -81,8 +84,12 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
     FeaturePtr aFeature = aFeatures.first();
     QMenu* aMenu = new QMenu();
     if (aFeature->getKind() == "Part") {
-      //TODO: Check that feature is active
-      aMenu->addAction(action("ACTIVATE_PART_CMD"));
+      boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+      boost::shared_ptr<ModelAPI_Document> aFeaDoc = aFeature->data()->docRef("PartDocument")->value();
+      if (aMgr->currentDocument() == aFeaDoc)
+        aMenu->addAction(action("DEACTIVATE_PART_CMD"));
+      else 
+        aMenu->addAction(action("ACTIVATE_PART_CMD"));
     } else {
       aMenu->addAction(action("EDIT_CMD"));
     }