Skip to content

Commit 7eb59ba

Browse files
committed
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>
1 parent a9460e8 commit 7eb59ba

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

app/src/processing/app/Mode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,12 @@ public void prepareExportFolder(File targetFolder) {
936936
// base.handleNewReplace();
937937
// }
938938

939+
940+
public String getSearchPath() {
941+
return "";
942+
}
943+
944+
939945
@Override
940946
public String toString() {
941947
return getTitle();

java/src/processing/mode/java/JavaMode.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,20 @@ public boolean handleExportApplication(Sketch sketch) throws SketchException, IO
263263
JavaBuild build = new JavaBuild(sketch);
264264
return build.exportApplication();
265265
}
266+
267+
268+
@Override
269+
public String getSearchPath() {
270+
StringBuilder tehPath = new StringBuilder(System.getProperty("java.class.path"));
271+
272+
// Starting with JDK 1.7, no longer using Apple's Java, so
273+
// rt.jar has the same path on all OSes
274+
tehPath.append(File.pathSeparatorChar
275+
+ System.getProperty("java.home") + File.separator + "lib"
276+
+ File.separator + "rt.jar");
277+
278+
return tehPath.toString();
279+
}
266280

267281

268282
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

java/src/processing/mode/java/pdex/ASTGenerator.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,7 @@ protected void done() {
306306
protected void loadJars() {
307307
factory = new ClassPathFactory();
308308

309-
StringBuilder tehPath =
310-
new StringBuilder(System.getProperty("java.class.path"));
311-
312-
// Starting with JDK 1.7, no longer using Apple's Java, so
313-
// rt.jar has the same path on all OSes
314-
tehPath.append(File.pathSeparatorChar
315-
+ System.getProperty("java.home") + File.separator + "lib"
316-
+ File.separator + "rt.jar" + File.pathSeparatorChar);
309+
StringBuilder tehPath = new StringBuilder(editor.getMode().getSearchPath());
317310

318311
if (errorCheckerService.classpathJars != null) {
319312
synchronized (errorCheckerService.classpathJars) {

0 commit comments

Comments
 (0)