1 /*******************************************************************************
2 * Copyright (c) 2014 Ericsson
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
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tmf
.ui
.project
.handlers
;
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
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceFolder
;
21 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.wizards
.NewFolderDialog
;
22 import org
.eclipse
.swt
.widgets
.Shell
;
23 import org
.eclipse
.ui
.IWorkbenchWindow
;
24 import org
.eclipse
.ui
.PlatformUI
;
25 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
28 * Handler for the New Folder command.
30 public class NewFolderHandler
extends AbstractHandler
{
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
37 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
39 // Check if we are closing down
40 IWorkbenchWindow window
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow();
45 ISelection selection
= HandlerUtil
.getCurrentSelection(event
);
46 if (!(selection
instanceof IStructuredSelection
)) {
49 final Object element
= ((IStructuredSelection
) selection
).getFirstElement();
50 if (!(element
instanceof TmfTraceFolder
)) {
53 TmfTraceFolder parent
= (TmfTraceFolder
) element
;
55 // Fire the New Folder dialog
56 Shell shell
= window
.getShell();
57 NewFolderDialog dialog
= new NewFolderDialog(shell
, parent
);
This page took 0.037961 seconds and 5 git commands to generate.