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 39 public class FindWriteReferencesInProjectAction extends FindWriteReferencesAction { 40 41 48 public FindWriteReferencesInProjectAction(IWorkbenchSite site) { 49 super(site); 50 } 51 52 56 public FindWriteReferencesInProjectAction(JavaEditor editor) { 57 super(editor); 58 } 59 60 void init() { 61 setText(SearchMessages.Search_FindWriteReferencesInProjectAction_label); 62 setToolTipText(SearchMessages.Search_FindWriteReferencesInProjectAction_tooltip); 63 setImageDescriptor(JavaPluginImages.DESC_OBJS_SEARCH_REF); 64 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.FIND_WRITE_REFERENCES_IN_PROJECT_ACTION); 65 } 66 67 QuerySpecification createQuery(IJavaElement element) throws JavaModelException { 68 JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance(); 69 JavaEditor editor= getEditor(); 70 71 IJavaSearchScope scope; 72 String description; 73 boolean isInsideJRE= factory.isInsideJRE(element); 74 if (editor != null) { 75 scope= factory.createJavaProjectSearchScope(editor.getEditorInput(), isInsideJRE); 76 description= factory.getProjectScopeDescription(editor.getEditorInput(), isInsideJRE); 77 } else { 78 scope= factory.createJavaProjectSearchScope(element.getJavaProject(), isInsideJRE); 79 description= factory.getProjectScopeDescription(element.getJavaProject(), isInsideJRE); 80 } 81 return new ElementQuerySpecification(element, getLimitTo(), scope, description); 82 } 83 84 } 85 | Popular Tags |