tmf/lttng: Update 2014 copyrights
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / wizards / tracepkg / importexport / ImportTracePackageHandler.java
CommitLineData
6e651d8b 1/*******************************************************************************
60ae41e1 2 * Copyright (c) 2013, 2014 Ericsson
6e651d8b
MAL
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 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg.importexport;
14
15import org.eclipse.core.commands.AbstractHandler;
16import org.eclipse.core.commands.ExecutionEvent;
17import org.eclipse.core.commands.ExecutionException;
18import org.eclipse.jface.viewers.ISelection;
19import org.eclipse.jface.viewers.IStructuredSelection;
20import org.eclipse.jface.viewers.StructuredSelection;
21import org.eclipse.jface.wizard.WizardDialog;
22import org.eclipse.ui.IWorkbenchWindow;
23import org.eclipse.ui.PlatformUI;
24import org.eclipse.ui.handlers.HandlerUtil;
25
26/**
27 * Handler for importing a trace package
28 *
29 * @author Marc-Andre Laperle
30 */
31public class ImportTracePackageHandler extends AbstractHandler {
32
33 @Override
34 public Object execute(ExecutionEvent event) throws ExecutionException {
35 ImportTracePackageWizard w = new ImportTracePackageWizard();
36 IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
37
38 if (window == null) {
0126a8ca 39 return Boolean.FALSE;
6e651d8b
MAL
40 }
41
42 ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
43 IStructuredSelection sec = StructuredSelection.EMPTY;
44 if (currentSelection instanceof IStructuredSelection) {
45 sec = (IStructuredSelection) currentSelection;
46 }
47
48 w.init(PlatformUI.getWorkbench(), sec);
49 WizardDialog dialog = new WizardDialog(window.getShell(), w);
50 dialog.open();
51 return null;
52 }
53}
This page took 0.029872 seconds and 5 git commands to generate.