https://bugs.eclipse.org/bugs/show_bug.cgi?id=488221
Only search for WIDs in src/main/resources/META-INF and icons in
src/main/resources/icons
diff --git a/plugins/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/wid/WIDLoader.java b/plugins/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/wid/WIDLoader.java
index cf315ac..852ed76 100644
--- a/plugins/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/wid/WIDLoader.java
+++ b/plugins/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/wid/WIDLoader.java
@@ -7,7 +7,6 @@
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -17,6 +16,7 @@
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -35,6 +35,8 @@
public class WIDLoader {
private static final int BUFFER_SIZE = 1024;
+ private static final String WID_FOLDER = "/src/main/resources/META-INF";
+ private static final String ICONS_FOLDER = "/src/main/resources/icons";
private HashMap<String, WorkItemDefinition> projectWIDs = new HashMap<String, WorkItemDefinition>();
private HashMap<String, ImageDescriptor> projectIcons = new HashMap<String, ImageDescriptor>();
@@ -47,9 +49,13 @@
public boolean visit (IResource resource) throws CoreException {
try {
if (resource.getType() == IResource.FILE) {
- if ("conf".equalsIgnoreCase(((IFile)resource).getFileExtension()) || //$NON-NLS-1$
- "wid".equalsIgnoreCase(((IFile)resource).getFileExtension())) { //$NON-NLS-1$
- getProjectFileWIDs((IFile)resource);
+ // only check the folder src/main/resources/META-INF for WID files
+ if ("wid".equalsIgnoreCase(((IFile)resource).getFileExtension())) { //$NON-NLS-1$
+ String folder = resource.getParent().getFullPath().toString();
+ IProject project = resource.getProject();
+ if ((project.getFullPath().toString() + WID_FOLDER).equals(folder)) {
+ getProjectFileWIDs((IFile)resource);
+ }
return true;
}
}
@@ -127,11 +133,9 @@
private void getProjectFileIcon(IFile file, String icon) throws CoreException, IOException {
IProject project = file.getProject();
- IFile iconFile = project.getFile(icon);
- if (!iconFile.exists()) {
- IPath path = file.getParent().getFullPath().removeFirstSegments(1).append(icon);
- iconFile = project.getFile(path);
- }
+
+ // search for icon file in /src/main/resources/icons
+ IFile iconFile = project.getFile(new Path(ICONS_FOLDER + "/" + icon));
InputStream is = null;
try {
@@ -163,7 +167,7 @@
JarEntry entry = enumEntries.nextElement();
if (!entry.isDirectory()) {
String name = entry.getName();
- if (name.endsWith(".wid") || name.endsWith(".conf")) {
+ if (name.endsWith(".wid")) {
is = jar.getInputStream(entry);
if (is!=null) {
String content = inputStreamToString(is,null);