search for missing imports in contrib libs

This commit is contained in:
Manindra Moharana
2013-09-17 05:30:06 +05:30
parent 7d1ee09a4e
commit fc2633306b
2 changed files with 22 additions and 8 deletions

View File

@@ -94,6 +94,7 @@ import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import processing.app.Base;
import processing.app.Library;
import processing.app.SketchCode;
import processing.app.Toolkit;
import processing.mode.java.preproc.PdePreprocessor;
@@ -3048,13 +3049,26 @@ public class ASTGenerator {
Pattern.CASE_INSENSITIVE));
String[] resources = classPath
.findResources("", regf);
if(resources.length == 0){
log("Couldn't find import for class " + className);
return;
ArrayList<String> candidates = new ArrayList<String>();
for (String res : resources) {
candidates.add(res);
}
// log("Couldn't find import for class " + className);
for (Library lib : editor.dmode.contribLibraries) {
ClassPath cp = factory.createFromPath(lib.getClassPath());
resources = cp.findResources("", regf);
for (String res : resources) {
candidates.add(res);
log("Res: " + res);
}
}
resources = new String[candidates.size()];
for (int i = 0; i < resources.length; i++) {
resources[i] = resources[i].replace('/', '.')
.substring(0, resources[i].length() - 6);
resources[i] = candidates.get(i).replace('/', '.')
.substring(0, candidates.get(i).length() - 6);
}
if (resources.length >= 1) {
final JList classList = new JList(resources);