Search in sources :

Example 1 with StringList

use of processing.data.StringList in project processing by processing.

the class Base method getInstalledContribsInfo.

public byte[] getInstalledContribsInfo() {
    List<Contribution> contribs = getInstalledContribs();
    StringList entries = new StringList();
    for (Contribution c : contribs) {
        String entry = c.getTypeName() + "=" + PApplet.urlEncode(String.format("name=%s\nurl=%s\nrevision=%d\nversion=%s", c.getName(), c.getUrl(), c.getVersion(), c.getBenignVersion()));
        entries.append(entry);
    }
    String joined = "id=" + UpdateCheck.getUpdateID() + "&" + entries.join("&");
    //    return sb.toString();
    return joined.getBytes();
}
Also used : StringList(processing.data.StringList)

Example 2 with StringList

use of processing.data.StringList in project processing by processing.

the class Util method listFiles.

public static String[] listFiles(File folder, boolean relative, String extension) {
    if (extension != null) {
        if (!extension.startsWith(".")) {
            extension = "." + extension;
        }
    }
    StringList list = new StringList();
    listFilesImpl(folder, relative, extension, list);
    if (relative) {
        String[] outgoing = new String[list.size()];
        // remove the slash (or backslash) as well
        int prefixLength = folder.getAbsolutePath().length() + 1;
        for (int i = 0; i < outgoing.length; i++) {
            outgoing[i] = list.get(i).substring(prefixLength);
        }
        return outgoing;
    }
    return list.array();
}
Also used : StringList(processing.data.StringList)

Example 3 with StringList

use of processing.data.StringList in project processing by processing.

the class Util method packageListFromClassPath.

/**
   * A classpath, separated by the path separator, will contain
   * a series of .jar/.zip files or directories containing .class
   * files, or containing subdirectories that have .class files.
   *
   * @param path the input classpath
   * @return array of possible package names
   */
public static StringList packageListFromClassPath(String path) {
    //    Map<String, Object> map = new HashMap<String, Object>();
    StringList list = new StringList();
    String[] pieces = PApplet.split(path, File.pathSeparatorChar);
    for (int i = 0; i < pieces.length; i++) {
        //System.out.println("checking piece '" + pieces[i] + "'");
        if (pieces[i].length() == 0)
            continue;
        if (pieces[i].toLowerCase().endsWith(".jar") || pieces[i].toLowerCase().endsWith(".zip")) {
            //System.out.println("checking " + pieces[i]);
            packageListFromZip(pieces[i], list);
        } else {
            // it's another type of file or directory
            File dir = new File(pieces[i]);
            if (dir.exists() && dir.isDirectory()) {
                packageListFromFolder(dir, null, list);
            //importCount = magicImportsRecursive(dir, null,
            //                                  map);
            //imports, importCount);
            }
        }
    }
    //    int mapCount = map.size();
    //    String output[] = new String[mapCount];
    //    int index = 0;
    //    Set<String> set = map.keySet();
    //    for (String s : set) {
    //      output[index++] = s.replace('/', '.');
    //    }
    //    return output;
    StringList outgoing = new StringList(list.size());
    for (String item : list) {
        outgoing.append(item.replace('/', '.'));
    }
    return outgoing;
}
Also used : StringList(processing.data.StringList)

Example 4 with StringList

use of processing.data.StringList in project processing by processing.

the class Contribution method parseModeList.

/**
   * Helper function that creates a StringList of the compatible Modes
   * for this Contribution.
   */
static StringList parseModeList(StringDict properties) {
    String unparsedModes = properties.get(MODES_PROPERTY);
    // Workaround for 3.0 alpha/beta bug for 3.0b2
    if ("null".equals(unparsedModes)) {
        properties.remove(MODES_PROPERTY);
        unparsedModes = null;
    }
    StringList outgoing = new StringList();
    if (unparsedModes != null) {
        outgoing.append(PApplet.trim(PApplet.split(unparsedModes, ',')));
    }
    return outgoing;
}
Also used : StringList(processing.data.StringList)

Example 5 with StringList

use of processing.data.StringList in project processing by processing.

the class Contribution method parseImports.

/**
   * Returns the list of imports specified by this library author. Only
   * necessary for library authors that want to override the default behavior
   * of importing all packages in their library.
   * @return null if no entries found
   */
static StringList parseImports(StringDict properties) {
    StringList outgoing = new StringList();
    String importStr = properties.get(IMPORTS_PROPERTY);
    if (importStr != null) {
        String[] importList = PApplet.trim(PApplet.split(importStr, ','));
        for (String importName : importList) {
            if (!importName.isEmpty()) {
                outgoing.append(importName);
            }
        }
    }
    return (outgoing.size() > 0) ? outgoing : null;
}
Also used : StringList(processing.data.StringList)

Aggregations

StringList (processing.data.StringList)21 Point (java.awt.Point)3 File (java.io.File)2 ZipFile (java.util.zip.ZipFile)2 Library (processing.app.Library)2 SketchCode (processing.app.SketchCode)2 SketchException (processing.app.SketchException)2 Argument (com.sun.jdi.connect.Connector.Argument)1 FileDialog (java.awt.FileDialog)1 Font (java.awt.Font)1 GraphicsDevice (java.awt.GraphicsDevice)1 GraphicsEnvironment (java.awt.GraphicsEnvironment)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 ConnectException (java.net.ConnectException)1 MatchResult (java.util.regex.MatchResult)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 JFileChooser (javax.swing.JFileChooser)1 BuildException (org.apache.tools.ant.BuildException)1 Editor (processing.app.ui.Editor)1