Move alltests plugin to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / handlers / BatchImportTraceHandler.java
1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Matthew Khouzam - Initial API and implementation
11 * Bernd Hufmann - Simplify selection logic
12 *******************************************************************************/
13
14 package org.eclipse.linuxtools.internal.tmf.ui.project.handlers;
15
16 import org.eclipse.core.commands.AbstractHandler;
17 import org.eclipse.core.commands.ExecutionEvent;
18 import org.eclipse.core.commands.ExecutionException;
19 import org.eclipse.jface.viewers.ISelection;
20 import org.eclipse.jface.viewers.IStructuredSelection;
21 import org.eclipse.jface.viewers.StructuredSelection;
22 import org.eclipse.jface.wizard.WizardDialog;
23 import org.eclipse.linuxtools.internal.tmf.ui.project.wizards.importtrace.BatchImportTraceWizard;
24 import org.eclipse.ui.IWorkbenchWindow;
25 import org.eclipse.ui.PlatformUI;
26 import org.eclipse.ui.handlers.HandlerUtil;
27
28 /**
29 * Batch import handler, spawn a wizard
30 *
31 * @author Matthew Khouzam
32 * @since 2.0
33 */
34 public class BatchImportTraceHandler extends AbstractHandler {
35
36 @Override
37 public Object execute(ExecutionEvent event) throws ExecutionException {
38
39 BatchImportTraceWizard w = new BatchImportTraceWizard();
40 IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
41
42 if (window == null) {
43 return false;
44 }
45
46 ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
47
48 IStructuredSelection sec = StructuredSelection.EMPTY;
49 if (currentSelection instanceof IStructuredSelection) {
50 sec = (IStructuredSelection) currentSelection;
51 }
52
53 w.init(PlatformUI.getWorkbench(), sec);
54 WizardDialog dialog = new WizardDialog(window.getShell(), w);
55 dialog.open();
56
57 return null;
58 }
59
60 }
This page took 0.034408 seconds and 5 git commands to generate.