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
CommitLineData
d04ec5a7 1/*******************************************************************************
ceb60136 2 * Copyright (c) 2013, 2014 Ericsson
d04ec5a7
MK
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
ceb60136 11 * Bernd Hufmann - Simplify selection logic
d04ec5a7
MK
12 *******************************************************************************/
13
14package org.eclipse.linuxtools.internal.tmf.ui.project.handlers;
15
ceb60136 16import org.eclipse.core.commands.AbstractHandler;
d04ec5a7
MK
17import org.eclipse.core.commands.ExecutionEvent;
18import org.eclipse.core.commands.ExecutionException;
ceb60136 19import org.eclipse.jface.viewers.ISelection;
f537c959 20import org.eclipse.jface.viewers.IStructuredSelection;
d04ec5a7
MK
21import org.eclipse.jface.viewers.StructuredSelection;
22import org.eclipse.jface.wizard.WizardDialog;
1de10308 23import org.eclipse.linuxtools.internal.tmf.ui.project.wizards.importtrace.BatchImportTraceWizard;
d04ec5a7
MK
24import org.eclipse.ui.IWorkbenchWindow;
25import org.eclipse.ui.PlatformUI;
fe13246f 26import org.eclipse.ui.handlers.HandlerUtil;
d04ec5a7
MK
27
28/**
29 * Batch import handler, spawn a wizard
30 *
31 * @author Matthew Khouzam
32 * @since 2.0
33 */
ceb60136 34public class BatchImportTraceHandler extends AbstractHandler {
d04ec5a7
MK
35
36 @Override
37 public Object execute(ExecutionEvent event) throws ExecutionException {
d04ec5a7 38
ceb60136
BH
39 BatchImportTraceWizard w = new BatchImportTraceWizard();
40 IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
41
42 if (window == null) {
43 return false;
d04ec5a7 44 }
fe13246f 45
ceb60136
BH
46 ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
47
48 IStructuredSelection sec = StructuredSelection.EMPTY;
49 if (currentSelection instanceof IStructuredSelection) {
50 sec = (IStructuredSelection) currentSelection;
fe13246f
MAL
51 }
52
ceb60136
BH
53 w.init(PlatformUI.getWorkbench(), sec);
54 WizardDialog dialog = new WizardDialog(window.getShell(), w);
fe13246f
MAL
55 dialog.open();
56
d04ec5a7
MK
57 return null;
58 }
59
60}
This page took 0.048157 seconds and 5 git commands to generate.