Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2012-09-02 15:54:35 -0400
committerLars Vogel2012-09-02 15:54:35 -0400
commit58d5ddab3db883c3bb58824063612299c7b9666c (patch)
tree6edf40cde844aea4de70eff0e25b8aa274f79b86
parentf7c02c34e4bdc1e310a98b0edab0a62f6e80f1f5 (diff)
downloadorg.eclipse.e4.tools-58d5ddab3db883c3bb58824063612299c7b9666c.tar.gz
org.eclipse.e4.tools-58d5ddab3db883c3bb58824063612299c7b9666c.tar.xz
org.eclipse.e4.tools-58d5ddab3db883c3bb58824063612299c7b9666c.zip
Bug 365195 - [Tooling] Double-click on editor tree element should
open the tree
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java11
1 files changed, 11 insertions, 0 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 c44a0789..02f1430c 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
@@ -181,6 +181,8 @@ import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jface.text.source.VerticalRuler;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -830,6 +832,15 @@ public class ModelEditor {
viewer.setInput(modelProvider.getRoot());
viewer.expandToLevel(2);
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ TreeViewer viewer = (TreeViewer) event.getViewer();
+ IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
+ Object selectedNode = thisSelection.getFirstElement();
+ viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode));
+ }
+ });
// ViewerDropAdapter adapter = new ViewerDropAdapter(viewer) {
//
// @Override

Back to the top