use of org.cytoscape.app.internal.task.InstallAppsFromFileTask in project cytoscape-impl by cytoscape.
the class InstallAppsPanel method installFromFileButtonActionPerformed.
private void installFromFileButtonActionPerformed(ActionEvent evt) {
List<String> sha1Checksums = new ArrayList<String>();
for (App app : appManager.getApps()) {
sha1Checksums.add(app.getSha512Checksum());
}
// Setup a the file filter for the open file dialog
FileChooserFilter fileChooserFilter = new FileChooserFilter("Jar, Zip, and Karaf Kar Files (*.jar, *.zip, *.kar)", new String[] { "jar", "zip", "kar" });
Collection<FileChooserFilter> fileChooserFilters = new LinkedList<FileChooserFilter>();
fileChooserFilters.add(fileChooserFilter);
// Show the dialog
final File[] files = fileUtil.getFiles(parent, "Choose file(s)", FileUtil.LOAD, FileUtil.LAST_DIRECTORY, "Install", true, fileChooserFilters);
if (files != null) {
TaskIterator ti = new TaskIterator();
ti.append(new InstallAppsFromFileTask(Arrays.asList(files), appManager, true));
ti.append(new ShowInstalledAppsIfChangedTask(appManager, parent));
taskManager.setExecutionContext(parent);
taskManager.execute(ti);
}
}
Aggregations