control: Base code for profile dialog window
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / handlers / NewConnectionHandler.java
index 368e86fc99b2ff875223c15b9f6c8be2ec404779..3786c172bdafbab1cf3a3f77061a87841fbe65e5 100644 (file)
@@ -17,6 +17,7 @@ import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
 import java.util.Map;
 
+import org.eclipse.core.commands.Command;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.window.Window;
@@ -32,6 +33,8 @@ import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.services.IServiceLocator;
 
 /**
  * <p>
@@ -98,6 +101,28 @@ public class NewConnectionHandler extends BaseControlViewHandler {
                 fLock.unlock();
             }
         }
+
+        // Obtain IServiceLocator implementer, e.g. from PlatformUI.getWorkbench():
+        IServiceLocator serviceLocator = PlatformUI.getWorkbench();
+        // or a site from within a editor or view:
+        // IServiceLocator serviceLocator = getSite();
+
+        ICommandService commandService = serviceLocator.getService(ICommandService.class);
+
+
+            // Lookup commmand with its ID
+            Command command = commandService.getCommand("org.eclipse.linuxtools.internal.lttng2.ui.commands.control.createSession"); //$NON-NLS-1$
+
+            // Optionally pass a ExecutionEvent instance, default no-param arg creates blank event
+            try {
+                // execute new connection command directly
+                command.executeWithChecks(new ExecutionEvent());
+              // FIX THIS OH GOD THE INHUMANITY
+            } catch (Exception e) {
+
+                e.printStackTrace();
+            }
+
         return null;
     }
 
This page took 0.024785 seconds and 5 git commands to generate.