1 11 package org.eclipse.jdt.ui.actions; 12 13 import org.eclipse.ui.IWorkbenchSite; 14 import org.eclipse.ui.PlatformUI; 15 16 import org.eclipse.jdt.core.IJavaElement; 17 import org.eclipse.jdt.core.JavaModelException; 18 import org.eclipse.jdt.core.search.IJavaSearchScope; 19 20 import org.eclipse.jdt.ui.search.ElementQuerySpecification; 21 import org.eclipse.jdt.ui.search.QuerySpecification; 22 23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 24 import org.eclipse.jdt.internal.ui.JavaPluginImages; 25 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; 26 import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory; 27 import org.eclipse.jdt.internal.ui.search.SearchMessages; 28 29 40 public class FindDeclarationsInProjectAction extends FindDeclarationsAction { 41 42 49 public FindDeclarationsInProjectAction(IWorkbenchSite site) { 50 super(site); 51 } 52 53 57 public FindDeclarationsInProjectAction(JavaEditor editor) { 58 super(editor); 59 } 60 61 void init() { 62 setText(SearchMessages.Search_FindDeclarationsInProjectAction_label); 63 setToolTipText(SearchMessages.Search_FindDeclarationsInProjectAction_tooltip); 64 setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_DECL); 65 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_DECLARATIONS_IN_PROJECT_ACTION); 66 } 67 68 QuerySpecification createQuery(IJavaElement element) throws JavaModelException { 69 JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance(); 70 JavaEditor editor= getEditor(); 71 72 IJavaSearchScope scope; 73 String description; 74 boolean isInsideJRE= true; 75 if (editor != null) { 76 scope= factory.createJavaProjectSearchScope(editor.getEditorInput(), isInsideJRE); 77 description= factory.getProjectScopeDescription(editor.getEditorInput(), isInsideJRE); 78 } else { 79 scope= factory.createJavaProjectSearchScope(element.getJavaProject(), isInsideJRE); 80 description= factory.getProjectScopeDescription(element.getJavaProject(), isInsideJRE); 81 } 82 return new ElementQuerySpecification(element, getLimitTo(), scope, description); 83 } 84 } 85 | Popular Tags |