diff options
Diffstat (limited to 'plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java')
-rw-r--r-- | plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java new file mode 100644 index 0000000..9e18097 --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/Ust2Handler.java | |||
@@ -0,0 +1,59 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.sdk.remotetools.actions; | ||
12 | |||
13 | import org.eclipse.core.commands.AbstractHandler; | ||
14 | import org.eclipse.core.commands.ExecutionEvent; | ||
15 | import org.eclipse.core.commands.ExecutionException; | ||
16 | import org.eclipse.jface.dialogs.MessageDialog; | ||
17 | import org.eclipse.ui.IWorkbenchWindow; | ||
18 | import org.eclipse.ui.PlatformUI; | ||
19 | import org.eclipse.ui.handlers.HandlerUtil; | ||
20 | import org.eclipse.ui.progress.IProgressService; | ||
21 | |||
22 | import org.yocto.sdk.remotetools.Messages; | ||
23 | |||
24 | public class Ust2Handler extends AbstractHandler { | ||
25 | |||
26 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
27 | |||
28 | //if(UstModel.checkAvail()!=true) { | ||
29 | // return null; | ||
30 | //} | ||
31 | |||
32 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
33 | |||
34 | Ust2SettingDialog setting=new Ust2SettingDialog( | ||
35 | window.getShell() | ||
36 | ); | ||
37 | |||
38 | if(setting.open()==BaseSettingDialog.OK) { | ||
39 | IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); | ||
40 | String project = setting.getProject(); | ||
41 | if (project == null) { | ||
42 | MessageDialog.openError(window.getShell(), "Lttng-ust", Messages.ErrorUstProject); | ||
43 | return null; | ||
44 | } | ||
45 | Ust2Model op=new Ust2Model(setting.getHost(),setting.getTrace(), project, window); | ||
46 | try { | ||
47 | progressService.busyCursorWhile(op); | ||
48 | }catch (InterruptedException e) { | ||
49 | //user cancelled | ||
50 | }catch (Exception e) { | ||
51 | e.printStackTrace(); | ||
52 | MessageDialog.openError(window.getShell(), | ||
53 | "Ust", | ||
54 | (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); | ||
55 | } | ||
56 | } | ||
57 | return null; | ||
58 | } | ||
59 | } | ||