Added some more JUnit tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / control / ControlView.java
index 85570b2f80c5551aab59360f3c572f68b6062170..f99341689415181657cdf8477206407594cdc516 100644 (file)
@@ -83,7 +83,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
     @Override
     public void createPartControl(Composite parent) {
         // Create tree viewer
-        fTreeViewer = new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
+        fTreeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
         ColumnViewerToolTipSupport.enableFor(fTreeViewer);
 
         fTreeViewer.setContentProvider(new TraceControlContentProvider());
@@ -108,13 +108,6 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
     @Override
     public void setFocus() {
         fTreeViewer.getControl().setFocus();
-        final ISelection sel = fTreeViewer.getSelection();
-        if (sel == null) {
-            fTreeViewer.setSelection(new StructuredSelection(fRoot));
-            fTreeViewer.setSelection(null);
-            return;
-        }
-        fTreeViewer.setSelection(sel);
     }
     
     /*
@@ -159,12 +152,34 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
             }
         });
     }
+    
+    /**
+     * Sets the selected component in the tree
+     * @param component - component to select
+     */
+    public void setSelection(ITraceControlComponent component) {
+        StructuredSelection selection = new StructuredSelection(component);
+        fTreeViewer.setSelection(selection);
+    }
+
+    /**
+     * Sets the selected components in the tree
+     * @param component - array of components to select
+     */
+    public void setSelection(ITraceControlComponent[] components) {
+        StructuredSelection selection = new StructuredSelection(components);
+        fTreeViewer.setSelection(selection);
+    }
+    
+//    public ITraceControlComponent getSelection() {
+//        ISelection selection = fTreeViewer.getSelection();
+//        
+//    }
 
     // ------------------------------------------------------------------------
     // Helper methods
     // ------------------------------------------------------------------------
     private void createContextMenu() {
-     // This is new code
         // First we create a menu Manager
         final MenuManager menuManager = new MenuManager();
         final Menu menu = menuManager.createContextMenu(fTreeViewer.getTree());
This page took 0.024107 seconds and 5 git commands to generate.