diff --git a/pdex/.project b/pdex/.project
index 1be6ebc0c..85716855e 100644
--- a/pdex/.project
+++ b/pdex/.project
@@ -10,6 +10,16 @@
+
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ auto,full,incremental,
+
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/Auto_Builder.launch
+
+
+
org.eclipse.jdt.core.javanature
diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java
index 6d7b8096e..6cfeb56b5 100644
--- a/pdex/src/processing/mode/experimental/ASTGenerator.java
+++ b/pdex/src/processing/mode/experimental/ASTGenerator.java
@@ -176,7 +176,7 @@ public class ASTGenerator {
}
}
- private DefaultMutableTreeNode buildAST2(String source, CompilationUnit cu) {
+ private DefaultMutableTreeNode buildAST(String source, CompilationUnit cu) {
if (cu == null) {
ASTParser parser = ASTParser.newParser(AST.JLS4);
parser.setSource(source.toCharArray());
@@ -219,18 +219,18 @@ public class ASTGenerator {
// frameAutoComp.setVisible(true);
//
// }
- if (!jdocWindow.isVisible()) {
- long t = System.currentTimeMillis();
- loadJars();
- loadJavaDoc();
- System.out.println("Time taken: "
- + (System.currentTimeMillis() - t));
- jdocWindow.setBounds(new Rectangle(errorCheckerService.getEditor()
- .getX() + errorCheckerService.getEditor().getWidth(),
- errorCheckerService.getEditor()
- .getY(), 450, 600));
- jdocWindow.setVisible(true);
- }
+// if (!jdocWindow.isVisible()) {
+// long t = System.currentTimeMillis();
+// loadJars();
+// loadJavaDoc();
+// System.out.println("Time taken: "
+// + (System.currentTimeMillis() - t));
+// jdocWindow.setBounds(new Rectangle(errorCheckerService.getEditor()
+// .getX() + errorCheckerService.getEditor().getWidth(),
+// errorCheckerService.getEditor()
+// .getY(), 450, 600));
+// jdocWindow.setVisible(true);
+// }
jtree.validate();
}
}
@@ -248,45 +248,63 @@ public class ASTGenerator {
private JFrame jdocWindow;
- private void loadJars() {
- try {
- factory = new ClassPathFactory();
+ /**
+ * Loads up .jar files and classes defined in it for completion lookup
+ */
+ protected void loadJars() {
+// SwingWorker worker = new SwingWorker() {
+// protected void done(){
+// }
+// protected Object doInBackground() throws Exception {
+// return null;
+// }
+// };
+// worker.execute();
+
+ Thread t = new Thread(new Runnable() {
- StringBuffer tehPath = new StringBuffer(
- System
- .getProperty("java.class.path"));
- tehPath.append(File.pathSeparatorChar + System.getProperty("java.home")
- + "/lib/rt.jar" + File.pathSeparatorChar);
- if (errorCheckerService.classpathJars != null) {
- for (URL jarPath : errorCheckerService.classpathJars) {
- tehPath.append(jarPath.getPath() + File.pathSeparatorChar);
+ public void run() {
+ try {
+ factory = new ClassPathFactory();
+
+ StringBuffer tehPath = new StringBuffer(System
+ .getProperty("java.class.path"));
+ tehPath.append(File.pathSeparatorChar
+ + System.getProperty("java.home") + "/lib/rt.jar"
+ + File.pathSeparatorChar);
+ if (errorCheckerService.classpathJars != null) {
+ for (URL jarPath : errorCheckerService.classpathJars) {
+ System.out.println(jarPath.getPath());
+ tehPath.append(jarPath.getPath() + File.pathSeparatorChar);
+ }
+ }
+
+// String paths[] = tehPath.toString().split(File.separatorChar +"");
+ StringTokenizer st = new StringTokenizer(tehPath.toString(),
+ File.pathSeparatorChar + "");
+ while (st.hasMoreElements()) {
+ String sstr = (String) st.nextElement();
+ System.out.println(sstr);
+ }
+
+ classPath = factory.createFromPath(tehPath.toString());
+// for (String packageName : classPath.listPackages("")) {
+// System.out.println(packageName);
+// }
+// RegExpResourceFilter regExpResourceFilter = new RegExpResourceFilter(
+// ".*",
+// "ArrayList.class");
+// String[] resources = classPath.findResources("", regExpResourceFilter);
+// for (String className : resources) {
+// System.out.println("-> " + className);
+// }
+ System.out.println("jars loaded.");
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
-
-// String paths[] = tehPath.toString().split(File.separatorChar +"");
- StringTokenizer st = new StringTokenizer(tehPath.toString(),
- File.pathSeparatorChar + "");
- while (st.hasMoreElements()) {
- String sstr = (String) st.nextElement();
- System.out.println(sstr);
- }
-
- classPath = factory.createFromPath(tehPath.toString());
-// for (String packageName : classPath.listPackages("")) {
-// System.out.println(packageName);
-// }
-// RegExpResourceFilter regExpResourceFilter = new RegExpResourceFilter(
-// ".*",
-// "ArrayList.class");
-// String[] resources = classPath.findResources("", regExpResourceFilter);
-// for (String className : resources) {
-// System.out.println("-> " + className);
-// }
- System.out.println("jars loaded.");
- } catch (Exception e) {
- e.printStackTrace();
- }
-
+ });
+ t.start();
}
private TreeMap jdocMap;
@@ -298,7 +316,7 @@ public class ASTGenerator {
@Override
public void run() {
- JavadocHelper.loadJavaDoc(jdocMap,editor.mode().getReferenceFolder());
+ JavadocHelper.loadJavaDoc(jdocMap, editor.mode().getReferenceFolder());
}
});
t.start();
@@ -306,7 +324,7 @@ public class ASTGenerator {
}
public DefaultMutableTreeNode buildAST(CompilationUnit cu) {
- return buildAST2(errorCheckerService.sourceCode, cu);
+ return buildAST(errorCheckerService.sourceCode, cu);
}
public String[] checkForTypes2(ASTNode node) {
@@ -376,7 +394,10 @@ public class ASTGenerator {
case ASTNode.SINGLE_VARIABLE_DECLARATION:
return new CompletionCandidate[] { new CompletionCandidate(
- getNodeAsString2(node),"","",CompletionCandidate.LOCAL_VAR) };
+ getNodeAsString2(node),
+ "",
+ "",
+ CompletionCandidate.LOCAL_VAR) };
case ASTNode.FIELD_DECLARATION:
vdfs = ((FieldDeclaration) node).fragments();
@@ -395,7 +416,8 @@ public class ASTGenerator {
CompletionCandidate ret[] = new CompletionCandidate[vdfs.size()];
int i = 0;
for (VariableDeclarationFragment vdf : vdfs) {
- ret[i++] = new CompletionCandidate(getNodeAsString2(vdf),"","",CompletionCandidate.LOCAL_VAR);
+ ret[i++] = new CompletionCandidate(getNodeAsString2(vdf), "", "",
+ CompletionCandidate.LOCAL_VAR);
}
return ret;
}
@@ -496,6 +518,8 @@ public class ASTGenerator {
protected void done() {
String word2 = word;
+
+ //After typing 'arg.' all members of arg type are to be listed. This one is a flag for it
boolean noCompare = false;
if (word2.endsWith(".")) {
// return all matches
@@ -668,7 +692,7 @@ public class ASTGenerator {
}
} else if (word.length() - word2.length() == 1) {
- System.out.println(word +" w2 " + word2);
+ System.out.println(word + " w2 " + word2);
// int dC = 0;
// for (int i = 0; i < word.length(); i++) {
// if(word.charAt(i) == '.')
@@ -678,12 +702,13 @@ public class ASTGenerator {
System.out.println("All members of " + word2);
candidates = getMembersForType(word2, "", true, true);
// }
- }
- else{
+ } else {
System.out.println("Some members of " + word2);
int x = word2.indexOf('.');
- if(x != -1){
- candidates = getMembersForType(word2.substring(0, x), word2.substring(x+1), false, true);
+ if (x != -1) {
+ candidates = getMembersForType(word2.substring(0, x),
+ word2.substring(x + 1), false,
+ true);
}
}
@@ -763,7 +788,7 @@ public class ASTGenerator {
if (!Modifier.isStatic(field.getModifiers()) && staticOnly)
continue;
if (noCompare)
- candidates.add(new CompletionCandidate(field));
+ candidates.add(new CompletionCandidate(field));
else if (field.getName().startsWith(child.toString()))
candidates.add(new CompletionCandidate(field));
}
diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java
index cd1c181d4..a03965ada 100644
--- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java
+++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java
@@ -341,7 +341,8 @@ public class ErrorCheckerService implements Runnable{
// CompilationChecker class(from CompilationChecker.jar) that houses the
// Eclispe JDT compiler and call its getErrorsAsObj method to obtain
// errors. This way, I'm able to add the paths of contributed libraries
- // to the classpath of CompilationChecker, dynamically.
+ // to the classpath of CompilationChecker, dynamically. The eclipse compiler
+ // needs all referenced libraries in the classpath.
try {
@@ -375,7 +376,7 @@ public class ErrorCheckerService implements Runnable{
//for (File jarFile : jarFiles) {
//classpathJars.add(jarFile.toURI().toURL());
//}
-
+
classpath = new URL[classpathJars.size() + jarFiles.length];
int ii = 0;
for (; ii < classpathJars.size(); ii++) {
@@ -392,6 +393,8 @@ public class ErrorCheckerService implements Runnable{
classLoader);
// System.out.println("2.");
compilationChecker = checkerClass.newInstance();
+
+ astGenerator.loadJars(); // Update jar files for completition list
loadCompClass = false;
}