+
+ if (!aRefFeatures.empty()) {
+ QStringList aRefNames;
+ std::set<FeaturePtr>::const_iterator anIt = aRefFeatures.begin(),
+ aLast = aRefFeatures.end();
+ for (; anIt != aLast; anIt++) {
+ FeaturePtr aFeature = (*anIt);
+ std::string aFName = aFeature->data()->name().c_str();
+ std::string aName = (*anIt)->name().c_str();
+ aRefNames.append((*anIt)->name().c_str());
+ }
+ QString aNames = aRefNames.join(", ");
+
+ QMessageBox::StandardButton aRes = QMessageBox::warning(
+ aDesktop, tr("Delete features"),
+ QString(tr("Selected features are used in the following features: %1.\
+These features will be deleted also. Would you like to continue?")).arg(aNames),
+ QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
+ if (aRes != QMessageBox::Yes)
+ return;
+ }
+
+ SessionPtr aMgr = ModelAPI_Session::get();
+ aMgr->startOperation();
+ foreach (ObjectPtr aObj, theList)
+ {
+ DocumentPtr aDoc = aObj->document();
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+ if (aPart) {
+ if (aDoc == aMgr->activeDocument()) {
+ aDoc->close();
+ }
+ } else {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature) {
+ aDoc->removeFeature(aFeature);
+ }
+ }
+ }
+ myDisplayer->updateViewer();
+ aMgr->finishOperation();