srcanaapps/depexplorer/com.nokia.s60tools.appdep/src/com/nokia/s60tools/appdep/ui/actions/FindMainViewAction.java
author noe\swadi
Sat, 09 Jan 2010 10:04:11 +0530
changeset 0 a02c979e8dfd
permissions -rw-r--r--
1. Copyrights changed to EPL 2. Feature updates mentioned in release notes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     1
/*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     3
* All rights reserved.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     4
* This component and the accompanying materials are made available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     6
* which accompanies this distribution, and is available
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     8
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
     9
* Initial Contributors:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    11
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    12
* Contributors:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    13
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    14
* Description:
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    15
*
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    16
*/
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    17
 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    18
 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    19
package com.nokia.s60tools.appdep.ui.actions;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    20
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    21
import org.eclipse.swt.SWT;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    22
import org.eclipse.swt.widgets.Shell;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    23
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    24
import com.nokia.s60tools.appdep.core.AppDepSettings;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    25
import com.nokia.s60tools.appdep.core.data.ComponentNode;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    26
import com.nokia.s60tools.appdep.find.IFindStartNodeProvider;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    27
import com.nokia.s60tools.appdep.plugin.AppDepPlugin;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    28
import com.nokia.s60tools.appdep.resources.ImageKeys;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    29
import com.nokia.s60tools.appdep.resources.ImageResourceManager;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    30
import com.nokia.s60tools.appdep.resources.Messages;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    31
import com.nokia.s60tools.appdep.ui.dialogs.AppDepFindDialog;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    32
import com.nokia.s60tools.appdep.ui.dialogs.AppDepMessageBox;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    33
import com.nokia.s60tools.appdep.ui.views.main.MainView;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    34
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    35
/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    36
 * Action for starting find dialog for component tree.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    37
 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    38
public class FindMainViewAction extends AbstractMainViewAction implements IFindStartNodeProvider {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    39
	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    40
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    41
	 * Action's ID.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    42
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    43
	public static final String ACTION_ID = "com.nokia.s60tools.appdep.ui.actions.FindMainViewAction"; //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    44
			
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    45
	/**
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    46
	 * Constructor.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    47
	 * @param view Reference to the view.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    48
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    49
	public FindMainViewAction(MainView view){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    50
		super(view);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    51
		setText(Messages.getString("FindMainViewAction.FindMainView_Action_Text")); //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    52
		setToolTipText(Messages.getString("FindMainViewAction.FindMainView_Action_Tooltip")); //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    53
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    54
		setId(ACTION_ID);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    55
		setImageDescriptor(ImageResourceManager.
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    56
								getImageDescriptor(ImageKeys.FIND_ACTION));	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    57
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    58
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    59
	
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    60
	/* (non-Javadoc)
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    61
	 * @see org.eclipse.jface.action.IAction#run()
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    62
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    63
	public void run() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    64
				
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    65
		String currentRootComponent = null;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    66
		currentRootComponent =  AppDepSettings.getActiveSettings().getCurrentlyAnalyzedComponentName();		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    67
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    68
		Shell sh = AppDepPlugin.getCurrentlyActiveWbWindowShell();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    69
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    70
		if(currentRootComponent == null){
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    71
			// User has not selected any components for analysis
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    72
			String infoMsg = Messages.getString("GeneralMessages.Select_SDK_First_ErrMsg"); //$NON-NLS-1$
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    73
			AppDepMessageBox msgBox = new AppDepMessageBox(sh, infoMsg, SWT.OK | SWT.ICON_INFORMATION);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    74
			msgBox.open();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    75
			return;
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    76
		 
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    77
		}				
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    78
		
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    79
		// Starting dialog find dialog for the component node
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    80
		AppDepFindDialog dlg = new AppDepFindDialog(sh, this, view);
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    81
		dlg.create();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    82
		dlg.open();					
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    83
				
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    84
		// Remember to always call AbstractMainViewAction
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    85
		// base class implementation
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    86
		super.run();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    87
				
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    88
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    89
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    90
	/* (non-Javadoc)
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    91
	 * @see com.nokia.s60tools.appdep.search.ISearchStartNodeProvider#getSearchStartNode()
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    92
	 */
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    93
	public ComponentNode getSearchStartNode() {
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    94
		return view.getRootComponentNode();
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    95
	}
a02c979e8dfd 1. Copyrights changed to EPL
noe\swadi
parents:
diff changeset
    96
}