Lines 29-72
Link Here
|
29 |
} |
29 |
} |
30 |
|
30 |
|
31 |
@Override |
31 |
@Override |
32 |
protected boolean populateCache(IProgressMonitor monitor) { |
32 |
protected boolean populateCache(final IProgressMonitor monitor) { |
33 |
if (fProjects == null) |
33 |
if (fProjects == null) |
34 |
initialize(monitor); |
34 |
initialize(monitor); |
35 |
|
35 |
|
36 |
if (!fProjects.isEmpty()) { |
36 |
if (!fProjects.isEmpty()) { |
37 |
IProject project = fProjects.get(fProjects.size() - 1); |
37 |
|
|
|
38 |
final IProject project = fProjects.remove(0); |
38 |
|
39 |
|
39 |
// look for a manifest |
40 |
// look for a manifest |
40 |
IFile manifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ |
41 |
IFile manifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ |
|
|
42 |
|
41 |
if (manifest.exists()) { |
43 |
if (manifest.exists()) { |
42 |
try { |
44 |
try { |
43 |
// extract plugin name |
45 |
// extract plugin name |
44 |
String pluginName = getPluginName(manifest.getContents()); |
46 |
final String pluginName = getPluginName(manifest.getContents()); |
45 |
|
47 |
|
46 |
// parse all folders |
48 |
// parse all folders |
47 |
Collection<IContainer> locations = new HashSet<IContainer>(); |
49 |
project.accept(new IResourceProxyVisitor() { |
48 |
locations.add(project); |
|
|
49 |
do { |
50 |
IContainer next = locations.iterator().next(); |
51 |
locations.remove(next); |
52 |
|
50 |
|
53 |
for (IResource resource : next.members()) { |
51 |
private boolean fIsCanceled = false; |
54 |
if (monitor.isCanceled()) |
|
|
55 |
return true; |
56 |
|
52 |
|
57 |
if (resource instanceof IFile) { |
53 |
public boolean visit(IResourceProxy proxy) throws CoreException { |
58 |
try { |
54 |
if (fIsCanceled) |
59 |
if (isImageName(resource.getName().toLowerCase())) |
55 |
return false; |
60 |
addImageElement(new ImageElement(createImageData((IFile) resource), pluginName, resource.getProjectRelativePath().toPortableString())); |
|
|
61 |
|
56 |
|
62 |
} catch (Exception e) { |
57 |
switch (proxy.getType()) { |
63 |
// could not create image for location |
58 |
case IResource.PROJECT : |
64 |
} |
59 |
// fall through |
65 |
} else if (resource instanceof IContainer) |
60 |
case IResource.FOLDER : |
66 |
locations.add((IContainer) resource); |
61 |
// parse subfolders |
|
|
62 |
return true; |
63 |
|
64 |
case IResource.FILE : |
65 |
// look for image files |
66 |
try { |
67 |
if (isImageName(proxy.getName())) { |
68 |
addImageElement(new ImageElement(createImageData((IFile) proxy.requestResource()), pluginName, project.getProjectRelativePath().toPortableString())); |
69 |
if (monitor.isCanceled()) |
70 |
fIsCanceled = true; |
71 |
} |
72 |
|
73 |
} catch (Exception e) { |
74 |
// could not create image for location |
75 |
} |
76 |
break; |
77 |
} |
78 |
|
79 |
return false; |
67 |
} |
80 |
} |
68 |
|
81 |
}, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); |
69 |
} while ((!locations.isEmpty()) && (!monitor.isCanceled())); |
|
|
70 |
} catch (CoreException e) { |
82 |
} catch (CoreException e) { |
71 |
PDEPlugin.log(e); |
83 |
PDEPlugin.log(e); |
72 |
} catch (IOException e) { |
84 |
} catch (IOException e) { |