X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.lttng.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Flttng%2Fui%2Fviews%2Fcontrol%2Fhandlers%2FAssignEventHandler.java;h=f2412bff04b4eb7deba4f238dde1b86c86091273;hb=d132bcc71fa0ff07cf2a3f0b6258f38abb546fb7;hp=c169e4259cf02920e9cfac076af74c851ee466d9;hpb=f1e23c542e9b00f6dab15b7aa2960315a22d9bc4;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/AssignEventHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/AssignEventHandler.java index c169e4259c..f2412bff04 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/AssignEventHandler.java +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/AssignEventHandler.java @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IProgressMonitor; @@ -28,8 +27,8 @@ import org.eclipse.jface.window.Window; import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin; import org.eclipse.linuxtools.lttng.ui.views.control.ControlView; import org.eclipse.linuxtools.lttng.ui.views.control.Messages; -import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.GetEventInfoDialog; import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IGetEventInfoDialog; +import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory; import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent; import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventComponent; import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.KernelProviderComponent; @@ -38,9 +37,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComp import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent; import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderComponent; import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; /** * EnableEventHandler @@ -49,7 +45,7 @@ import org.eclipse.ui.PlatformUI; * This is done on the trace provider level. *

*/ -public class AssignEventHandler extends AbstractHandler { +public class AssignEventHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Attributes @@ -80,14 +76,10 @@ public class AssignEventHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - - if (window == null) { - return false; - } - // Open dialog box to retrieve the session and channel where the events should be enabled in. - final IGetEventInfoDialog dialog = new GetEventInfoDialog(window.getShell(), fIsKernel, fSessions); + final IGetEventInfoDialog dialog = TraceControlDialogFactory.getInstance().getGetEventInfoDialog(); + dialog.setIsKernel(fIsKernel); + dialog.setSessions(fSessions); if (dialog.open() != Window.OK) { return null; @@ -149,23 +141,12 @@ public class AssignEventHandler extends AbstractHandler { fSessions = null; fIsKernel = null; - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) { - return false; - } - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); + // Get workbench page for the Control View + IWorkbenchPage page = getWorkbenchPage(); if (page == null) { return false; } - IWorkbenchPart part = page.getActivePart(); - if (!(part instanceof ControlView)) { - return false; - } - // Check if one or more session are selected ISelection selection = page.getSelection(ControlView.ID); if (selection instanceof StructuredSelection) {