mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 19:31:16 +01:00
Modes can now specifiy additional jars for ecs/cc classpath
This commit is contained in:
@@ -265,10 +265,14 @@ public class JavaMode extends Mode {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Any modes that extend JavaMode can override this method to add additional jars to be
|
||||
* included in the classpath for code completion and error checking
|
||||
* @return searchPath: file-paths separated by File.pathSeparatorChar
|
||||
*/
|
||||
public String getSearchPath() {
|
||||
return System.getProperty("java.class.path") +
|
||||
File.pathSeparatorChar + System.getProperty("java.home") +
|
||||
File.separator + "lib" + File.separator + "rt.jar";
|
||||
// Java Mode doesn't need any default external jars at the moment.
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -300,6 +300,12 @@ public class ASTGenerator {
|
||||
|
||||
//protected JFrame frmJavaDoc;
|
||||
|
||||
protected String getJavaSearchPath() {
|
||||
return System.getProperty("java.class.path") +
|
||||
File.pathSeparatorChar + System.getProperty("java.home") +
|
||||
File.separator + "lib" + File.separator + "rt.jar";
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads up .jar files and classes defined in it for completion lookup
|
||||
*/
|
||||
@@ -307,7 +313,7 @@ public class ASTGenerator {
|
||||
factory = new ClassPathFactory();
|
||||
|
||||
StringBuilder path = new StringBuilder();
|
||||
String modeClassPath = ((JavaMode) editor.getMode()).getSearchPath();
|
||||
String modeClassPath = getJavaSearchPath() + File.pathSeparatorChar + ((JavaMode) editor.getMode()).getSearchPath();
|
||||
if (modeClassPath != null) {
|
||||
path.append(modeClassPath);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
package processing.mode.java.pdex;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
@@ -871,8 +872,17 @@ public class ErrorCheckerService implements Runnable {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Also add jars specified in mode's search path
|
||||
String modeJars[] = ((JavaMode) getEditor().getMode()).getSearchPath().split(File.pathSeparatorChar + "");
|
||||
for (String mj : modeJars) {
|
||||
try {
|
||||
classpathJars.add(new File(mj).toURI().toURL());
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
astGenerator.loadJars(); // update jar file for completion lookup
|
||||
@@ -1119,8 +1129,8 @@ public class ErrorCheckerService implements Runnable {
|
||||
* Calculates the tab number and line number of the error in that particular
|
||||
* tab. Provides mapping between pure java and pde code.
|
||||
*
|
||||
* @param problem
|
||||
* - IProblem
|
||||
* @param javalineNumber
|
||||
* - int
|
||||
* @return int[0] - tab number, int[1] - line number
|
||||
*/
|
||||
protected int[] calculateTabIndexAndLineNumber(int javalineNumber) {
|
||||
@@ -1335,7 +1345,7 @@ public class ErrorCheckerService implements Runnable {
|
||||
/**
|
||||
* Now defunct.
|
||||
* The super method that highlights any ASTNode in the pde editor =D
|
||||
* @param node
|
||||
* @param awrap
|
||||
* @return true - if highlighting happened correctly.
|
||||
*/
|
||||
private boolean highlightNode(ASTNodeWrapper awrap){
|
||||
|
||||
Reference in New Issue
Block a user