]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #315: Disable "Remove" and "Duplicate" if no part created
authorsbh <sergey.belash@opencascade.com>
Mon, 8 Dec 2014 15:29:21 +0000 (18:29 +0300)
committersbh <sergey.belash@opencascade.com>
Mon, 8 Dec 2014 15:29:21 +0000 (18:29 +0300)
src/Config/Config_FeatureReader.cpp
src/PartSetPlugin/CMakeLists.txt
src/PartSetPlugin/plugin-PartSet.xml

index 9ebc93f78f821c399ec5106c85bb5844db09e5d5..bf780f3301c0442b94aa05988f351dd8e44dbad3 100644 (file)
@@ -102,7 +102,12 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theNode,
   outFeatureMessage->setKeysequence(getProperty(theNode, FEATURE_KEYSEQUENCE));
   outFeatureMessage->setGroupId(restoreAttribute(NODE_GROUP, _ID));
   outFeatureMessage->setWorkbenchId(restoreAttribute(NODE_WORKBENCH, _ID));
-  outFeatureMessage->setDocumentKind(restoreAttribute(NODE_WORKBENCH, WORKBENCH_DOC));
+  // Get document kind of a feature, if empty set workbench's kind (might be empty too)
+  std::string aDocKind = getProperty(theNode, WORKBENCH_DOC);
+  if(aDocKind.empty()) {
+    aDocKind = restoreAttribute(NODE_WORKBENCH, WORKBENCH_DOC);
+  }
+  outFeatureMessage->setDocumentKind(aDocKind);
 }
 
 void Config_FeatureReader::storeAttribute(xmlNodePtr theNode,
index e115ab9db5433d23f261f48b55a0d7a0b81badbe..1f249f9b622dfe78bbbb71945dcd6a812468c498 100644 (file)
@@ -15,8 +15,12 @@ SET(PROJECT_SOURCES
     PartSetPlugin_Remove.cpp
 )
 
+SET(XML_RESOURCES
+  plugin-PartSet.xml
+)
+
 ADD_DEFINITIONS(-DPARTSETPLUGIN_EXPORTS)
-ADD_LIBRARY(PartSetPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+ADD_LIBRARY(PartSetPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES})
 TARGET_LINK_LIBRARIES(PartSetPlugin ${PROJECT_LIBRARIES} ModelAPI)
 
 INCLUDE_DIRECTORIES(
@@ -24,9 +28,5 @@ INCLUDE_DIRECTORIES(
   ../GeomAPI
 )
 
-SET(XML_RESOURCES
-  plugin-PartSet.xml
-)
-
 INSTALL(TARGETS PartSetPlugin DESTINATION plugins)
 INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
index 4a846cc42a98088901b5d05ae21d98a8f31b1b77..db6893e509f1ccf5de3c6711d8d49bb85a4d4e0c 100644 (file)
@@ -2,8 +2,15 @@
   <workbench id="Part">
     <group id="Operations">
       <feature id="Part" title="New part" tooltip="Create a new part" icon=":pictures/part_ico.png"/>
-      <feature id="Duplicate" title="Duplicate" tooltip="Duplicate selected part" icon=":icons/duplicate.png"/>
-      <feature id="Remove" title="Remove part"  tooltip="Remove active part" icon=":icons/remove.png"/>
+      <feature id="Duplicate" title="Duplicate"
+               tooltip="Duplicate selected part"
+               icon=":icons/duplicate.png"
+               document="Part"/>
+      <feature id="Remove"
+               title="Remove part"
+               tooltip="Remove active part"
+               icon=":icons/remove.png"
+               document="Part"/>
     </group>
   </workbench>
 </plugin>