X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=lttng%2Forg.eclipse.tracecompass.lttng2.control.ui%2Fsrc%2Forg%2Feclipse%2Ftracecompass%2Finternal%2Flttng2%2Fcontrol%2Fui%2Fviews%2Fhandlers%2FNewConnectionHandler.java;h=3786c172bdafbab1cf3a3f77061a87841fbe65e5;hb=ad9972cc6227f3f6297d40154afd5c37be001b39;hp=368e86fc99b2ff875223c15b9f6c8be2ec404779;hpb=a103fe6727220fa3b8d73615bc5a269bcc9b7204;p=deliverable%2Ftracecompass.git diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java index 368e86fc99..3786c172bd 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/handlers/NewConnectionHandler.java @@ -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; /** *
@@ -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; }