1 11 package org.eclipse.jdt.internal.ui.search; 12 13 import org.eclipse.core.resources.ResourcesPlugin; 14 import org.eclipse.jdt.core.IJavaModel; 15 import org.eclipse.jdt.core.IJavaProject; 16 import org.eclipse.jdt.core.JavaCore; 17 import org.eclipse.jdt.core.JavaModelException; 18 import org.eclipse.jdt.core.search.IJavaSearchScope; 19 import org.eclipse.jdt.core.search.SearchEngine; 20 21 22 public class ReferenceScopeFactory { 23 24 private ReferenceScopeFactory() { 25 } 27 28 public static IJavaSearchScope createWorkspaceScope(boolean includeJRE) { 29 try { 30 return SearchEngine.createJavaSearchScope(getAllProjects(), JavaSearchScopeFactory.getSearchFlags(includeJRE)); 31 } catch (JavaModelException e) { 32 return SearchEngine.createWorkspaceScope(); 33 } 34 } 35 36 private static IJavaProject[] getAllProjects() throws JavaModelException { 37 IJavaModel model= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); 38 return model.getJavaProjects(); 39 } 40 } 41 | Popular Tags |