Lines 34-72
Link Here
|
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 |
public boolean visit(IResourceProxy proxy) throws CoreException { |
54 |
if (monitor.isCanceled()) |
52 |
switch (proxy.getType()) { |
55 |
return true; |
53 |
case IResource.PROJECT : |
|
|
54 |
// fall through |
55 |
case IResource.FOLDER : |
56 |
// parse subfolders |
57 |
return true; |
56 |
|
58 |
|
57 |
if (resource instanceof IFile) { |
59 |
case IResource.FILE : |
58 |
try { |
60 |
// look for image files |
59 |
if (isImageName(resource.getName().toLowerCase())) |
61 |
try { |
60 |
addImageElement(new ImageElement(createImageData((IFile) resource), pluginName, resource.getProjectRelativePath().toPortableString())); |
62 |
if (isImageName(proxy.getName().toLowerCase())) |
|
|
63 |
addImageElement(new ImageElement(createImageData((IFile) proxy.requestResource()), pluginName, project.getProjectRelativePath().toPortableString())); |
61 |
|
64 |
|
62 |
} catch (Exception e) { |
65 |
} catch (Exception e) { |
63 |
// could not create image for location |
66 |
// could not create image for location |
64 |
} |
67 |
} |
65 |
} else if (resource instanceof IContainer) |
68 |
break; |
66 |
locations.add((IContainer) resource); |
69 |
} |
|
|
70 |
|
71 |
return false; |
67 |
} |
72 |
} |
68 |
|
73 |
}, IResource.DEPTH_INFINITE, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS | IContainer.INCLUDE_HIDDEN); |
69 |
} while ((!locations.isEmpty()) && (!monitor.isCanceled())); |
|
|
70 |
} catch (CoreException e) { |
74 |
} catch (CoreException e) { |
71 |
PDEPlugin.log(e); |
75 |
PDEPlugin.log(e); |
72 |
} catch (IOException e) { |
76 |
} catch (IOException e) { |