]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update Delete operation in pop-up
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 22 May 2014 08:07:13 +0000 (12:07 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 22 May 2014 08:07:13 +0000 (12:07 +0400)
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_DocumentDataModel.cpp
src/XGUI/XGUI_Workshop.cpp

index 461b2dab58195409ae5e75c4bcf1372925cfa58e..a74824431b559a7be3066491d82b2b33fa344597 100644 (file)
@@ -98,7 +98,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
       } else {
         aActions.append(action("EDIT_CMD"));
       }
-       aActions.append(action("DELETE_CMD"));
+      aActions.append(action("DELETE_CMD"));
 
     // Process Root object (document)
     } else { // If feature is 0 the it means that selected root object (document)
index 30d3b9a0fc85be7dc854d794ae1e296df1f14344..8b42208aee3bd78bacc9ab82b704a7228470b928 100644 (file)
@@ -90,8 +90,8 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
 
     if (aDoc == myDocument) {  // If root objects
       if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
-        int aStart = myPartModels.size();
-        removeSubModel(myPartModels.size() - 1);
+        int aStart = myPartModels.size() - 1;
+        removeSubModel(aStart);
         removeRow(aStart, partFolderNode());
       } else { // Update top groups (other except parts
         QModelIndex aIndex = myModel->findGroup(aUpdMsg->group());
index 8504e153177b2c6a40890ef8c50fe3344712619f..a666a25a2b31ff6ec2e3abf87183609543768bde 100644 (file)
@@ -318,8 +318,8 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
   QString aWchName = QString::fromStdString(theMessage->workbenchId());
   QString aNestedFeatures = QString::fromStdString(theMessage->nestedFeatures());
   bool isUsePropPanel = theMessage->isUseInput();
+  QString aId = QString::fromStdString(theMessage->id());
   if (isSalomeMode()) {
-    QString aId = QString::fromStdString(theMessage->id());
     QAction* aAction = salomeConnector()->addFeature(aWchName,
                               aId,
                               QString::fromStdString(theMessage->text()),
@@ -343,7 +343,7 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
       aGroup = aPage->addGroup(aGroupName);
     }
     //Create feature...
-    XGUI_Command* aCommand = aGroup->addFeature(QString::fromStdString(theMessage->id()),
+    XGUI_Command* aCommand = aGroup->addFeature(aId,
                                                 QString::fromStdString(theMessage->text()),
                                                 QString::fromStdString(theMessage->tooltip()),
                                                 QIcon(theMessage->icon().c_str()),
@@ -763,9 +763,18 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList)
                                                           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();
   }
 }
\ No newline at end of file