Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Spungin2014-04-01 18:27:40 -0400
committerSteven Spungin2014-04-01 18:27:40 -0400
commit9d90472feb963fd7e808cdceed0ed7242940816a (patch)
tree5e1c37ca243606b8aba2c4eff1d67257acaed9e7
parentf003cb3d6fc984f23b4a49f9824bd7d23296b1e6 (diff)
downloadorg.eclipse.e4.tools-9d90472feb963fd7e808cdceed0ed7242940816a.tar.gz
org.eclipse.e4.tools-9d90472feb963fd7e808cdceed0ed7242940816a.tar.xz
org.eclipse.e4.tools-9d90472feb963fd7e808cdceed0ed7242940816a.zip
Bug 431755 - [model editor] deleting multiple items in tree only deletes
the first one Change-Id: I4c942162fbbf252afc13fb65039fc1f8e0e68e68 Signed-off-by: Steven Spungin <steven@spungin.tv>
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
index add2ecfe..0dfccb83 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
@@ -10,6 +10,7 @@
* Wim Jongman <wim.jongman@remainsoftware.com> - Maintenance
* Marco Descher <marco@descher.at> - Bug395982, 426653, 422465
* Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Bug 431755
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common;
@@ -529,16 +530,19 @@ public class ModelEditor {
@Override
public void keyReleased(final KeyEvent e) {
if (e.keyCode == SWT.DEL) {
+ List<EObject> list = new ArrayList<EObject>();
final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.getFirstElement() instanceof EObject) {
- EObject o = (EObject) selection.getFirstElement();
-
- Command cmd = DeleteCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o);
+ for (Object o : ((StructuredSelection) selection).toList()) {
+ if (o instanceof EObject) {
+ list.add((EObject) o);
+ }
+ }
+ if (list.isEmpty() == false) {
+ Command cmd = DeleteCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), list);
if (cmd.canExecute()) {
ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd);
}
}
-
}
}
});

Back to the top