went in for import issues, did much housecleaning (fixes #3403)

This commit is contained in:
Ben Fry
2015-06-22 14:41:30 -04:00
parent b6e298073b
commit bc41d058d4
14 changed files with 399 additions and 325 deletions

View File

@@ -34,6 +34,7 @@ import org.apache.tools.ant.ProjectHelper;
import processing.app.*;
import processing.app.exec.ProcessHelper;
import processing.core.*;
import processing.data.StringList;
import processing.data.XML;
import processing.mode.java.preproc.*;
@@ -212,7 +213,7 @@ public class JavaBuild {
// figure out the contents of the code folder to see if there
// are files that need to be added to the imports
String[] codeFolderPackages = null;
StringList codeFolderPackages = null;
if (sketch.hasCodeFolder()) {
File codeFolder = sketch.getCodeFolder();
javaLibraryPath = codeFolder.getAbsolutePath();

View File

@@ -22,6 +22,7 @@ import javax.swing.text.Document;
import org.eclipse.jdt.core.compiler.IProblem;
import processing.core.PApplet;
import processing.data.StringList;
import processing.app.*;
import processing.app.Toolkit;
import processing.app.contrib.AvailableContribution;
@@ -527,7 +528,7 @@ public class JavaEditor extends Editor {
* are to be added
* @return true if and only if any JMenuItems were added; false otherwise
*/
private boolean addLibReferencesToSubMenu(ArrayList<Library> libsList, JMenu subMenu) {
private boolean addLibReferencesToSubMenu(List<Library> libsList, JMenu subMenu) {
boolean isItemAdded = false;
Iterator<Library> iter = libsList.iterator();
while (iter.hasNext()) {
@@ -1265,16 +1266,18 @@ public class JavaEditor extends Editor {
// could also scan the text in the file to see if each import
// statement is already in there, but if the user has the import
// commented out, then this will be a problem.
String[] list = lib.getSpecifiedImports(); // ask the library for its imports
StringList list = lib.getImports(); // ask the library for its imports
if (list == null) {
// Default to old behavior and load each package in the primary jar
list = Base.packageListFromClassPath(lib.getJarPath());
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.length; i++) {
// for (int i = 0; i < list.length; i++) {
for (String item : list) {
sb.append("import ");
sb.append(list[i]);
// sb.append(list[i]);
sb.append(item);
sb.append(".*;\n");
}
sb.append('\n');

View File

@@ -645,7 +645,7 @@ public class PdePreprocessor {
public PreprocessorResult write(Writer out, String program,
String codeFolderPackages[])
StringList codeFolderPackages)
throws SketchException, RecognitionException, TokenStreamException {
// these ones have the .* at the end, since a class name might be at the end