analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / internal / tmf / ui / project / handlers / CopyExperimentHandler.java
CommitLineData
12c155f5 1/*******************************************************************************
35a15531 2 * Copyright (c) 2009, 2014 Ericsson
d5210347 3 *
12c155f5
FC
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
d5210347 8 *
12c155f5
FC
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
35a15531 11 * Patrick Tasse - Remove enable check
12c155f5
FC
12 *******************************************************************************/
13
2bdf0193 14package org.eclipse.tracecompass.internal.tmf.ui.project.handlers;
12c155f5
FC
15
16import org.eclipse.core.commands.AbstractHandler;
17import org.eclipse.core.commands.ExecutionEvent;
18import org.eclipse.core.commands.ExecutionException;
19import org.eclipse.jface.viewers.ISelection;
35a15531 20import org.eclipse.jface.viewers.IStructuredSelection;
12c155f5 21import org.eclipse.swt.widgets.Shell;
2bdf0193
AM
22import org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement;
23import org.eclipse.tracecompass.tmf.ui.project.wizards.CopyExperimentDialog;
35a15531 24import org.eclipse.ui.handlers.HandlerUtil;
12c155f5
FC
25
26/**
27 * <b><u>CopyExperimentHandler</u></b>
28 * <p>
12c155f5
FC
29 */
30public class CopyExperimentHandler extends AbstractHandler {
31
12c155f5
FC
32 // ------------------------------------------------------------------------
33 // Execution
34 // ------------------------------------------------------------------------
35
36 @Override
37 public Object execute(ExecutionEvent event) throws ExecutionException {
38
35a15531
PT
39 // Get selection already validated by handler in plugin.xml
40 ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
41 if (!(selection instanceof IStructuredSelection)) {
12c155f5 42 return null;
c8422608 43 }
35a15531 44 TmfExperimentElement experiment = (TmfExperimentElement) ((IStructuredSelection) selection).getFirstElement();
12c155f5
FC
45
46 // Fire the Copy Experiment dialog
35a15531
PT
47 Shell shell = HandlerUtil.getActiveShellChecked(event);
48 CopyExperimentDialog dialog = new CopyExperimentDialog(shell, experiment);
12c155f5
FC
49 dialog.open();
50
51 return null;
52 }
53
54}
This page took 0.092848 seconds and 5 git commands to generate.