tmf: Remove legacy import wizard
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tracing.rcp.ui / src / org / eclipse / linuxtools / internal / tracing / rcp / ui / commands / OpenDirHandler.java
CommitLineData
76fccfb0
MK
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 * Matthew Khouzam - Initial API and implementation
11 **********************************************************************/
12
13package org.eclipse.linuxtools.internal.tracing.rcp.ui.commands;
14
15import org.eclipse.core.commands.AbstractHandler;
16import org.eclipse.core.commands.ExecutionEvent;
17import org.eclipse.core.runtime.CoreException;
18import org.eclipse.linuxtools.internal.tracing.rcp.ui.TracingRcpPlugin;
19import org.eclipse.linuxtools.internal.tracing.rcp.ui.messages.Messages;
b5a80fe7 20import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
76fccfb0
MK
21import org.eclipse.linuxtools.tmf.ui.project.model.TmfOpenTraceHelper;
22import org.eclipse.swt.widgets.DirectoryDialog;
23import org.eclipse.swt.widgets.Shell;
24import org.eclipse.ui.PlatformUI;
25
26/**
27 * Open a directory, not a file
28 *
29 * @author Matthew Khouzam
30 */
31public class OpenDirHandler extends AbstractHandler{
32
33 @Override
34 public Object execute(ExecutionEvent event) {
35 // Open a directory
36 final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
37 DirectoryDialog dd = new DirectoryDialog(shell);
38 dd.setText(Messages.OpenDirHandler_SelectTraceType);
39 String dir = dd.open();
40 if (dir == null) {
41 return null;
42 }
43 TmfOpenTraceHelper oth = new TmfOpenTraceHelper();
44 try {
b5a80fe7 45 oth.openTraceFromPath(TmfCommonConstants.DEFAULT_TRACE_PROJECT_NAME, dir, shell);
76fccfb0
MK
46 } catch (CoreException e) {
47 TracingRcpPlugin.getDefault().logError(e.getMessage(), e);
48 }
49 return null;
50 }
51}
This page took 0.068478 seconds and 5 git commands to generate.