tmf: Fix most Number unboxing problems
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / wizards / tracepkg / importexport / ImportTracePackageHandler.java
1 /*******************************************************************************
2 * Copyright (c) 2013 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 * Marc-Andre Laperle - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.tmf.ui.project.wizards.tracepkg.importexport;
14
15 import org.eclipse.core.commands.AbstractHandler;
16 import org.eclipse.core.commands.ExecutionEvent;
17 import org.eclipse.core.commands.ExecutionException;
18 import org.eclipse.jface.viewers.ISelection;
19 import org.eclipse.jface.viewers.IStructuredSelection;
20 import org.eclipse.jface.viewers.StructuredSelection;
21 import org.eclipse.jface.wizard.WizardDialog;
22 import org.eclipse.ui.IWorkbenchWindow;
23 import org.eclipse.ui.PlatformUI;
24 import org.eclipse.ui.handlers.HandlerUtil;
25
26 /**
27 * Handler for importing a trace package
28 *
29 * @author Marc-Andre Laperle
30 */
31 public 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) {
39 return Boolean.FALSE;
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.037334 seconds and 5 git commands to generate.