}
//**************************************************************
- void XGUI_Workshop::activatePart(bool toActivate)
+ void XGUI_Workshop::activateLastPart()
{
- if (toActivate) {
- QFeatureList aFeatures = mySelector->selectedFeatures();
- if (aFeatures.size() > 0) {
- changeCurrentDocument(aFeatures.first());
- myObjectBrowser->activateCurrentPart(true);
+ PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+ DocumentPtr aDoc = aMgr->rootDocument();
+ FeaturePtr aLastPart = aDoc->feature(PARTS_GROUP, aDoc->size(PARTS_GROUP) - 1, true);
+ activatePart(aLastPart);
+ }
+
+ //**************************************************************
+ void XGUI_Workshop::deleteFeatures(QFeatureList theList)
+ {
+ QMainWindow* aDesktop = isSalomeMode()? salomeConnector()->desktop() : myMainWindow;
+ QMessageBox::StandardButton aRes = QMessageBox::warning(aDesktop, tr("Delete features"),
+ tr("Seleted features will be deleted. Continue?"),
+ QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
+ if (aRes == QMessageBox::Yes) {
+ foreach (FeaturePtr aFeature, theList) {
+ DocumentPtr aDoc = aFeature->data()->docRef("PartDocument")->value();
+ aDoc->removeFeature(aFeature);
}
- } else {
- changeCurrentDocument(FeaturePtr());
- myObjectBrowser->activateCurrentPart(false);
}
-}
+}
-