else if (hasFeature && myWorkshop->canMoveFeature())
action("MOVE_CMD")->setEnabled(true);
- else if (hasFeature)
+ else if (hasFeature || hasParameter)
action("CLEAN_HISTORY_CMD")->setEnabled(true);
if( aMgr->activeDocument() == aObject->document() )
if (hasFeature || hasParameter)
action("DELETE_CMD")->setEnabled(true);
}
- if (allActive && hasFeature)
+ if (allActive && (hasFeature|| hasParameter))
action("CLEAN_HISTORY_CMD")->setEnabled(true);
}
aList.clear();
aList.append(action("DELETE_CMD"));
+ aList.append(action("CLEAN_HISTORY_CMD"));
aList.append(mySeparator);
aList.append(action("RENAME_CMD"));
myObjBrowserMenus[ModelAPI_ResultParameter::group()] = aList;
QString XGUI_Workshop::MOVE_TO_END_COMMAND = QObject::tr("Move to the end");
//#define DEBUG_DELETE
+//#define DEBUG_FEATURE_NAME
XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
: QObject(),
myModule->propertyPanelDefined(theOperation);
+#ifndef DEBUG_FEATURE_NAME
myPropertyPanel->setWindowTitle(theOperation->getDescription()->description());
+#else
+ std::string aFeatureName = aFeature->name();
+ myPropertyPanel->setWindowTitle(QString("%1: %2").arg(theOperation->getDescription()->description())
+ .arg(aFeatureName.c_str()));
+#endif
myErrorMgr->setPropertyPanel(myPropertyPanel);
}
QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
// 1. find all referenced features
- std::set<FeaturePtr> anUnusedFeatures;
+ QList<ObjectPtr> anUnusedObjects;
std::set<FeaturePtr> aDirectRefFeatures;
foreach (ObjectPtr anObject, anObjects) {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
+ // for parameter result, use the corresponded reature to be removed
+ if (!aFeature.get() && anObject->groupName() == ModelAPI_ResultParameter::group()) {
+ aFeature = ModelAPI_Feature::feature(anObject);
+ }
if (aFeature.get()) {
std::set<FeaturePtr> alreadyProcessed;
aDirectRefFeatures.clear();
- XGUI_Tools::refsDirectToFeatureInAllDocuments(anObject, anObject, anObjects,
+ XGUI_Tools::refsDirectToFeatureInAllDocuments(aFeature, aFeature, anObjects,
aDirectRefFeatures, alreadyProcessed);
- if (aDirectRefFeatures.empty() && anUnusedFeatures.find(aFeature) == anUnusedFeatures.end())
- anUnusedFeatures.insert(aFeature);
+ if (aDirectRefFeatures.empty() && !anUnusedObjects.contains(aFeature))
+ anUnusedObjects.append(aFeature);
}
}
// 2. warn about the references remove, break the delete operation if the user chose it
- if (!anUnusedFeatures.empty()) {
+ if (!anUnusedObjects.empty()) {
QStringList aNames;
- foreach (const FeaturePtr& aFeature, anUnusedFeatures)
+ foreach (const ObjectPtr& anObject, anUnusedObjects) {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
aNames.append(aFeature->name().c_str());
+ }
QString anUnusedNames = aNames.join(", ");
QString anActionId = "CLEAN_HISTORY_CMD";
- QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text();
+ QString aDescription = contextMenuMgr()->action(anActionId)->text();
QMessageBox aMessageBox(desktop());
aMessageBox.setWindowTitle(aDescription);
operationMgr()->startOperation(anOpAction);
std::set<FeaturePtr> anIgnoredFeatures;
- if (removeFeatures(anObjects, anIgnoredFeatures, anActionId)) {
+ if (removeFeatures(anUnusedObjects, anIgnoredFeatures, anActionId)) {
operationMgr()->commitOperation();
}
else {