KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > callhierarchy > SearchScopeProjectAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
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  * Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation
10  * (report 36180: Callers/Callees view)
11  * Michael Fraenkel (fraenkel@us.ibm.com) - patch
12  * (report 60714: Call Hierarchy: display search scope in view title)
13  *******************************************************************************/

14 package org.eclipse.jdt.internal.ui.callhierarchy;
15
16 import org.eclipse.ui.PlatformUI;
17
18 import org.eclipse.jdt.core.IMethod;
19 import org.eclipse.jdt.core.search.IJavaSearchScope;
20
21 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
22 import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
23
24
25 class SearchScopeProjectAction extends SearchScopeAction {
26     private final SearchScopeActionGroup fGroup;
27     
28     public SearchScopeProjectAction(SearchScopeActionGroup group) {
29         super(group, CallHierarchyMessages.SearchScopeActionGroup_project_text);
30         this.fGroup = group;
31         setToolTipText(CallHierarchyMessages.SearchScopeActionGroup_project_tooltip);
32         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_SEARCH_SCOPE_ACTION);
33     }
34     
35     public IJavaSearchScope getSearchScope() {
36         IMethod method = this.fGroup.getView().getMethod();
37         if (method == null) {
38             return null;
39         }
40         
41         JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
42         return factory.createJavaProjectSearchScope(method.getJavaProject(), true);
43     }
44     
45     /* (non-Javadoc)
46      * @see org.eclipse.jdt.internal.ui.callhierarchy.SearchScopeActionGroup.SearchScopeAction#getSearchScopeType()
47      */

48     public int getSearchScopeType() {
49         return SearchScopeActionGroup.SEARCH_SCOPE_TYPE_PROJECT;
50     }
51
52     /* (non-Javadoc)
53      * @see org.eclipse.jdt.internal.ui.callhierarchy.SearchScopeAction#getFullDescription()
54      */

55     public String JavaDoc getFullDescription() {
56         IMethod method = this.fGroup.getView().getMethod();
57         if (method != null) {
58             JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();
59             return factory.getProjectScopeDescription(method.getJavaProject(), true);
60         }
61         return ""; //$NON-NLS-1$
62
}
63 }
64
Popular Tags