diff options
Diffstat (limited to 'plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java')
-rw-r--r-- | plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java new file mode 100644 index 0000000..980737f --- /dev/null +++ b/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileHandler.java | |||
@@ -0,0 +1,55 @@ | |||
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 | public class OprofileHandler extends AbstractHandler { | ||
23 | |||
24 | public Object execute(ExecutionEvent event) throws ExecutionException { | ||
25 | |||
26 | if(OprofileModel.checkAvail()!=true) { | ||
27 | return null; | ||
28 | } | ||
29 | |||
30 | IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); | ||
31 | |||
32 | SimpleSettingDialog setting=new SimpleSettingDialog( | ||
33 | window.getShell(), | ||
34 | "Oprofile", | ||
35 | IBaseConstants.CONNECTION_NAME_OPROFILE | ||
36 | ); | ||
37 | |||
38 | if(setting.open()==BaseSettingDialog.OK) { | ||
39 | IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); | ||
40 | OprofileModel op=new OprofileModel(setting.getHost(),window); | ||
41 | try { | ||
42 | progressService.busyCursorWhile(op); | ||
43 | }catch (InterruptedException e) { | ||
44 | //user cancelled | ||
45 | }catch (Exception e) { | ||
46 | e.printStackTrace(); | ||
47 | MessageDialog.openError(window.getShell(), | ||
48 | "Oprofile", | ||
49 | (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); | ||
50 | } | ||
51 | } | ||
52 | return null; | ||
53 | } | ||
54 | |||
55 | } | ||