Merge pull request #3648 from omerjerk/master

Let the mode decide in which jars to search for during auto completion
This commit is contained in:
Ben Fry
2015-08-17 08:39:47 -04:00
3 changed files with 21 additions and 8 deletions

View File

@@ -263,6 +263,20 @@ public class JavaMode extends Mode {
JavaBuild build = new JavaBuild(sketch);
return build.exportApplication();
}
@Override
public String getSearchPath() {
StringBuilder tehPath = new StringBuilder(System.getProperty("java.class.path"));
// Starting with JDK 1.7, no longer using Apple's Java, so
// rt.jar has the same path on all OSes
tehPath.append(File.pathSeparatorChar
+ System.getProperty("java.home") + File.separator + "lib"
+ File.separator + "rt.jar");
return tehPath.toString();
}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

View File

@@ -306,14 +306,7 @@ public class ASTGenerator {
protected void loadJars() {
factory = new ClassPathFactory();
StringBuilder tehPath =
new StringBuilder(System.getProperty("java.class.path"));
// Starting with JDK 1.7, no longer using Apple's Java, so
// rt.jar has the same path on all OSes
tehPath.append(File.pathSeparatorChar
+ System.getProperty("java.home") + File.separator + "lib"
+ File.separator + "rt.jar" + File.pathSeparatorChar);
StringBuilder tehPath = new StringBuilder(editor.getMode().getSearchPath());
if (errorCheckerService.classpathJars != null) {
synchronized (errorCheckerService.classpathJars) {