if (aObject) {
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
if (aPart) {
- DocumentPtr aFeaDoc = aPart->partDoc();
- if (aMgr->currentDocument() == aFeaDoc)
+ if (aMgr->currentDocument() == aPart->partDoc())
aMenu->addAction(action("DEACTIVATE_PART_CMD"));
else
aMenu->addAction(action("ACTIVATE_PART_CMD"));
} else {
ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
if (aResult) {
- aMenu->addAction(action("EDIT_CMD"));
-
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
if (aDisplayer->isVisible(aResult))
aMenu->addAction(action("HIDE_CMD"));
else
aMenu->addAction(action("SHOW_CMD"));
} else {
- FeaturePtr aResult = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
- if (aResult) {
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ if (aFeature) {
+ aMenu->addAction(action("EDIT_CMD"));
aMenu->addAction(action("DELETE_CMD"));
}
}
{
DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
- return aObject->document();
+ ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+ return aPart->partDoc();
}
ObjectPtr XGUI_PartDataModel::object(const QModelIndex& theIndex) const
{
PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
if (theObj) {
- DocumentPtr aPartDoc = theObj->document();
- if (aPartDoc)
- aMgr->setCurrentDocument(aPartDoc);
- } else {
- aMgr->setCurrentDocument(aMgr->rootDocument());
- }
+ ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
+ if (aPart) {
+ DocumentPtr aPartDoc = aPart->partDoc();
+ if (aPartDoc) {
+ aMgr->setCurrentDocument(aPartDoc);
+ return;
+ }
+ }
+ }
+ aMgr->setCurrentDocument(aMgr->rootDocument());
}
//******************************************************