Search in sources :

Example 1 with ShowInstalledAppsIfChangedTask

use of org.cytoscape.app.internal.task.ShowInstalledAppsIfChangedTask 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);
    }
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp) TaskIterator(org.cytoscape.work.TaskIterator) InstallAppsFromFileTask(org.cytoscape.app.internal.task.InstallAppsFromFileTask) ArrayList(java.util.ArrayList) ShowInstalledAppsIfChangedTask(org.cytoscape.app.internal.task.ShowInstalledAppsIfChangedTask) File(java.io.File) LinkedList(java.util.LinkedList) FileChooserFilter(org.cytoscape.util.swing.FileChooserFilter)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 App (org.cytoscape.app.internal.manager.App)1 WebApp (org.cytoscape.app.internal.net.WebApp)1 InstallAppsFromFileTask (org.cytoscape.app.internal.task.InstallAppsFromFileTask)1 ShowInstalledAppsIfChangedTask (org.cytoscape.app.internal.task.ShowInstalledAppsIfChangedTask)1 FileChooserFilter (org.cytoscape.util.swing.FileChooserFilter)1 TaskIterator (org.cytoscape.work.TaskIterator)1