|
1 /* |
|
2 * Copyright (c) 2006 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 package com.nokia.s60tools.appdep.ui.actions; |
|
20 |
|
21 import org.eclipse.swt.SWT; |
|
22 import org.eclipse.swt.widgets.Shell; |
|
23 |
|
24 import com.nokia.s60tools.appdep.core.AppDepSettings; |
|
25 import com.nokia.s60tools.appdep.core.data.ComponentNode; |
|
26 import com.nokia.s60tools.appdep.find.IFindStartNodeProvider; |
|
27 import com.nokia.s60tools.appdep.plugin.AppDepPlugin; |
|
28 import com.nokia.s60tools.appdep.resources.ImageKeys; |
|
29 import com.nokia.s60tools.appdep.resources.ImageResourceManager; |
|
30 import com.nokia.s60tools.appdep.resources.Messages; |
|
31 import com.nokia.s60tools.appdep.ui.dialogs.AppDepFindDialog; |
|
32 import com.nokia.s60tools.appdep.ui.dialogs.AppDepMessageBox; |
|
33 import com.nokia.s60tools.appdep.ui.views.main.MainView; |
|
34 |
|
35 /** |
|
36 * Action for starting find dialog for component tree. |
|
37 */ |
|
38 public class FindMainViewAction extends AbstractMainViewAction implements IFindStartNodeProvider { |
|
39 |
|
40 /** |
|
41 * Action's ID. |
|
42 */ |
|
43 public static final String ACTION_ID = "com.nokia.s60tools.appdep.ui.actions.FindMainViewAction"; //$NON-NLS-1$ |
|
44 |
|
45 /** |
|
46 * Constructor. |
|
47 * @param view Reference to the view. |
|
48 */ |
|
49 public FindMainViewAction(MainView view){ |
|
50 super(view); |
|
51 setText(Messages.getString("FindMainViewAction.FindMainView_Action_Text")); //$NON-NLS-1$ |
|
52 setToolTipText(Messages.getString("FindMainViewAction.FindMainView_Action_Tooltip")); //$NON-NLS-1$ |
|
53 |
|
54 setId(ACTION_ID); |
|
55 setImageDescriptor(ImageResourceManager. |
|
56 getImageDescriptor(ImageKeys.FIND_ACTION)); |
|
57 |
|
58 } |
|
59 |
|
60 /* (non-Javadoc) |
|
61 * @see org.eclipse.jface.action.IAction#run() |
|
62 */ |
|
63 public void run() { |
|
64 |
|
65 String currentRootComponent = null; |
|
66 currentRootComponent = AppDepSettings.getActiveSettings().getCurrentlyAnalyzedComponentName(); |
|
67 |
|
68 Shell sh = AppDepPlugin.getCurrentlyActiveWbWindowShell(); |
|
69 |
|
70 if(currentRootComponent == null){ |
|
71 // User has not selected any components for analysis |
|
72 String infoMsg = Messages.getString("GeneralMessages.Select_SDK_First_ErrMsg"); //$NON-NLS-1$ |
|
73 AppDepMessageBox msgBox = new AppDepMessageBox(sh, infoMsg, SWT.OK | SWT.ICON_INFORMATION); |
|
74 msgBox.open(); |
|
75 return; |
|
76 |
|
77 } |
|
78 |
|
79 // Starting dialog find dialog for the component node |
|
80 AppDepFindDialog dlg = new AppDepFindDialog(sh, this, view); |
|
81 dlg.create(); |
|
82 dlg.open(); |
|
83 |
|
84 // Remember to always call AbstractMainViewAction |
|
85 // base class implementation |
|
86 super.run(); |
|
87 |
|
88 } |
|
89 |
|
90 /* (non-Javadoc) |
|
91 * @see com.nokia.s60tools.appdep.search.ISearchStartNodeProvider#getSearchStartNode() |
|
92 */ |
|
93 public ComponentNode getSearchStartNode() { |
|
94 return view.getRootComponentNode(); |
|
95 } |
|
96 } |