/** * Returns the ClassPath currently represented in this panel. */ public ClassPath getClassPath() { int size = listModel.size(); if (size == 0) { return null; } ClassPath classPath = new ClassPath(); for (int index = 0; index < size; index++) { classPath.add((ClassPathEntry)listModel.get(index)); } return classPath; }
/** * Sets the ClassPath to be represented in this panel. */ public void setClassPath(ClassPath classPath) { listModel.clear(); if (classPath != null) { for (int index = 0; index < classPath.size(); index++) { listModel.addElement(classPath.get(index)); } } // Make sure the selection buttons are properly enabled, // since the clear method doesn't seem to notify the listener. enableSelectionButtons(); }
/** * Creates a DataEntryWriter that can write to the given class path entries. * * @param classPath the output class path. * @param fromIndex the start index in the class path. * @param toIndex the end index in the class path. * @return a DataEntryWriter for writing to the given class path entries. */ public DataEntryWriter createDataEntryWriter(ClassPath classPath, int fromIndex, int toIndex) { DataEntryWriter writer = null; // Create a chain of writers, one for each class path entry. for (int index = toIndex - 1; index >= fromIndex; index--) { ClassPathEntry entry = classPath.get(index); writer = createClassPathEntryWriter(entry, writer); } return writer; }
protected void outJar(@NonNull File file) { ClassPathEntry classPathEntry = new ClassPathEntry(file, true /*output*/); configuration.programJars.add(classPathEntry); }
/** * Reads all input entries from the given class path. */ private void readInput(String messagePrefix, ClassPath classPath, DataEntryReader reader) throws IOException { readInput(messagePrefix, classPath, 0, classPath.size(), reader); }
private ClassPath extendClassPath(ClassPath classPath, ClassPathElement classPathElement, boolean output) { if (classPath == null) { classPath = new ClassPath(); } classPathElement.appendClassPathEntriesTo(classPath, output); return classPath; }
/** * Creates a DataEntryWriter that can write to the given class path entries. * * @param classPath the output class path. * @param fromIndex the start index in the class path. * @param toIndex the end index in the class path. * @return a DataEntryWriter for writing to the given class path entries. */ public static DataEntryWriter createDataEntryWriter(ClassPath classPath, int fromIndex, int toIndex) { DataEntryWriter writer = null; // Create a chain of writers, one for each class path entry. for (int index = toIndex - 1; index >= fromIndex; index--) { ClassPathEntry entry = classPath.get(index); writer = createClassPathEntryWriter(entry, writer); } return writer; }
protected static void inputJar( @NonNull ClassPath classPath, @NonNull File file, @Nullable List<String> filter) { ClassPathEntry classPathEntry = new ClassPathEntry(file, false /*output*/); if (filter != null) { classPathEntry.setFilter(filter); } classPath.add(classPathEntry); } }
/** * Reads all input entries from the given class path. */ private void readInput(String messagePrefix, ClassPath classPath, DataEntryReader reader) throws IOException { readInput(messagePrefix, classPath, 0, classPath.size(), reader); }
/** * Performs some sanity checks on the class paths. */ private void checkInputOutput(ClassPath inputClassPath, ClassPath outputClassPath) throws IOException { if (inputClassPath == null || outputClassPath == null) { return; } for (int index1 = 0; index1 < inputClassPath.size(); index1++) { ClassPathEntry entry1 = inputClassPath.get(index1); if (!entry1.isOutput()) { for (int index2 = 0; index2 < outputClassPath.size(); index2++) { ClassPathEntry entry2 = outputClassPath.get(index2); if (entry2.isOutput() && entry2.getName().equals(entry1.getName())) { throw new IOException("Input jars and output jars must be different ["+entry1.getName()+"]"); } } } } }
private ClassPath extendClassPath(ClassPath classPath, ClassPathElement classPathElement, boolean output) { if (classPath == null) { classPath = new ClassPath(); } classPathElement.appendClassPathEntriesTo(classPath, output); return classPath; }
/** * Creates a DataEntryWriter that can write to the given class path entries. * * @param classPath the output class path. * @param fromIndex the start index in the class path. * @param toIndex the end index in the class path. * @return a DataEntryWriter for writing to the given class path entries. */ public DataEntryWriter createDataEntryWriter(ClassPath classPath, int fromIndex, int toIndex) { DataEntryWriter writer = null; // Create a chain of writers, one for each class path entry. for (int index = toIndex - 1; index >= fromIndex; index--) { ClassPathEntry entry = classPath.get(index); writer = createClassPathEntryWriter(entry, writer); } return writer; }
classPath.add(entry);
/** * Reads all input entries from the given class path. */ private void readInput(String messagePrefix, ClassPath classPath, DataEntryReader reader) throws IOException { readInput(messagePrefix, classPath, 0, classPath.size(), reader); }