|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 package com.nokia.s60tools.memspy.ui.actions; |
|
21 |
|
22 import org.eclipse.jface.action.IAction; |
|
23 import org.eclipse.jface.viewers.ISelection; |
|
24 import org.eclipse.ui.IWorkbenchWindow; |
|
25 import org.eclipse.ui.IWorkbenchWindowActionDelegate; |
|
26 |
|
27 import com.nokia.s60tools.memspy.ui.views.MemSpyMainView; |
|
28 import com.nokia.s60tools.memspy.ui.wizards.MemSpyWizard.MemSpyWizardType; |
|
29 import com.nokia.s60tools.util.debug.DbgUtility; |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 /** |
|
36 * Action for toolbar and import shortcuts that launch MemSpy |
|
37 * @see IWorkbenchWindowActionDelegate |
|
38 */ |
|
39 public class ToolbarShortcutAction implements IWorkbenchWindowActionDelegate { |
|
40 |
|
41 /** |
|
42 * The action has been activated. The argument of the |
|
43 * method represents the 'real' action sitting |
|
44 * in the workbench UI. |
|
45 * @see IWorkbenchWindowActionDelegate#run |
|
46 */ |
|
47 public void run(IAction action) { |
|
48 // Open MemSpy's Main View |
|
49 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "Show main view"); |
|
50 MemSpyMainView mainView = MemSpyMainView.showAndReturnYourself(); |
|
51 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "Run wizard"); |
|
52 mainView.runWizard( MemSpyWizardType.FULL, null ); |
|
53 |
|
54 } |
|
55 |
|
56 /** |
|
57 * Selection in the workbench has been changed. We |
|
58 * can change the state of the 'real' action here |
|
59 * if we want, but this can only happen after |
|
60 * the delegate has been created. |
|
61 * @see IWorkbenchWindowActionDelegate#selectionChanged |
|
62 */ |
|
63 public void selectionChanged(IAction action, ISelection selection) { |
|
64 // Not needed |
|
65 } |
|
66 |
|
67 /** |
|
68 * We can use this method to dispose of any system |
|
69 * resources we previously allocated. |
|
70 * @see IWorkbenchWindowActionDelegate#dispose |
|
71 */ |
|
72 public void dispose() { |
|
73 // Not needed |
|
74 } |
|
75 |
|
76 /** |
|
77 * We will cache window object in order to |
|
78 * be able to provide parent shell for the message dialog. |
|
79 * @see IWorkbenchWindowActionDelegate#init |
|
80 */ |
|
81 public void init(IWorkbenchWindow window) { |
|
82 // Not needed |
|
83 } |
|
84 } |