| newTypeHierarchy really slow [message #335014] | 
Mon, 16 March 2009 13:03  | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: talon.karrde.sw.gmail.com 
 
Hi, 
 
I'm currently working on a plugin that requires to perform a search for  
types on the whole workspace using  
org.eclipse.jdt.core.IJavaProject.newTypeHierarchy which is very slow  
(nearly 20 sec in my case). Here is a sample code: 
 
IRegion region = JavaCore.newRegion(); 
IProject[] projects =  
ResourcesPlugin.getWorkspace().getRoot().getProjects(); 
for (IProject proj : projects) 
{ 
    IJavaProject jproj = JavaCore.create(proj); 
    for (IJavaElement i : jproj.getPackageFragmentRoots()) 
    { 
        if (i.getElementName().equals("generated")) 
        { 
            region.add(i); 
        } 
    } 
} 
region.add(jproject); 
ITypeHierarchy typeHyerarchy = jproject.newTypeHierarchy(port, region,  
null); 
 
I have several questions: 
 
1-Is there anyway to optimise this code? 
2-If there's not, I want to execute this code at eclipse startup, I'm  
wondering if IStartup.earlyStartup executes after projects inside the  
workspace are loaded or not. 
 
Thanks, 
 
Fran
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.68182 seconds