From: vsv Date: Fri, 23 May 2014 09:05:45 +0000 (+0400) Subject: Document selection on activation of Parts X-Git-Tag: V_0.2~16^2^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=80a8cb2f2459425af7e99a86b4593cb6b865cc15;p=modules%2Fshaper.git Document selection on activation of Parts --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 40a31159a..df5f2e75e 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -740,9 +740,15 @@ void XGUI_Workshop::changeCurrentDocument(FeaturePtr thePart) { PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); if (thePart) { - boost::shared_ptr aDocRef = thePart->data()->docRef("PartDocument"); - if (aDocRef) - aMgr->setCurrentDocument(aDocRef->value()); + DocumentPtr aFeaDoc; + if (thePart->data()) { + aFeaDoc = thePart->data()->docRef("PartDocument")->value(); + } else { + ObjectPtr aObject = boost::dynamic_pointer_cast(thePart); + aFeaDoc = aObject->featureRef()->data()->docRef("PartDocument")->value(); + } + if (aFeaDoc) + aMgr->setCurrentDocument(aFeaDoc); } else { aMgr->setCurrentDocument(aMgr->rootDocument()); } @@ -801,7 +807,13 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList) aMgr->rootDocument()->startOperation(); foreach (FeaturePtr aFeature, theList) { if (aFeature->getKind() == "Part") { - DocumentPtr aDoc = aFeature->data()->docRef("PartDocument")->value(); + DocumentPtr aDoc; + if (aFeature->data()) { + aDoc = aFeature->data()->docRef("PartDocument")->value(); + } else { + ObjectPtr aObject = boost::dynamic_pointer_cast(aFeature); + aDoc = aObject->featureRef()->data()->docRef("PartDocument")->value(); + } if (aDoc == aMgr->currentDocument()) { aDoc->close(); }