Let the mode decide in which jars to search for during auto completion

This will allow Android mode to add android.jar to this searchable jars list.

Signed-off-by: Umair Khan <omerjerk@gmail.com>
This commit is contained in:
Umair Khan
2015-08-17 11:34:14 +05:30
parent 6ff0cfdbb4
commit 4592afc213
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) {