tr("Seleted features will be deleted. Continue?"),
QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
if (aRes == QMessageBox::Yes) {
+ PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+ aMgr->rootDocument()->startOperation();
foreach (FeaturePtr aFeature, theList) {
- DocumentPtr aDoc = aFeature->data()->docRef("PartDocument")->value();
- aDoc->removeFeature(aFeature);
+ if (aFeature->getKind() == "Part") {
+ DocumentPtr aDoc = aFeature->data()->docRef("PartDocument")->value();
+ if (aDoc == aMgr->currentDocument()) {
+ aDoc->close();
+ }
+ } //else
+ //aDoc = aFeature->document();
+ aMgr->rootDocument()->removeFeature(aFeature);
}
+ aMgr->rootDocument()->finishOperation();
}
- }
+ }