Search in sources :

Example 11 with App

use of org.cytoscape.app.internal.manager.App in project cytoscape-impl by cytoscape.

the class UninstallTask method run.

@Override
public void run(TaskMonitor taskMonitor) throws Exception {
    if (app == null) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "App name not provided");
        return;
    }
    taskMonitor.setTitle("Uninstalling app " + app);
    App appObject = getApp(app);
    if (appObject == null) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Can't find app '" + app + "'");
        return;
    }
    appManager.uninstallApp(appObject);
    updateApps();
    taskMonitor.showMessage(TaskMonitor.Level.INFO, "App '" + app + "' uninstalled");
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp)

Example 12 with App

use of org.cytoscape.app.internal.manager.App in project cytoscape-impl by cytoscape.

the class UpdateTask method run.

@Override
public void run(TaskMonitor taskMonitor) throws Exception {
    if (app == null) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "App name not provided");
        return;
    }
    if (app.equals("all")) {
    }
    updateList = new ArrayList<>();
    Set<Update> updates = updateManager.getUpdates();
    if (app.equals("all")) {
        updateList.addAll(updates);
    } else {
        for (Update update : updates) {
            App appObject = update.getApp();
            if (appObject.getAppName().equalsIgnoreCase(app))
                updateList.add(update);
        }
    }
    taskMonitor.setTitle("Updating apps");
    insertTasksAfterCurrentTask(new InstallUpdatesTask(updates, appManager));
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp) Update(org.cytoscape.app.internal.net.Update)

Example 13 with App

use of org.cytoscape.app.internal.manager.App 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)

Example 14 with App

use of org.cytoscape.app.internal.manager.App in project cytoscape-impl by cytoscape.

the class CheckForUpdatesPanel method checkUpdates.

private void checkUpdates() {
    final Set<App> appsToCheckUpdates = appManager.getInstalledApps();
    taskManager.execute(new TaskIterator(new Task() {

        @Override
        public void run(TaskMonitor taskMonitor) throws Exception {
            taskMonitor.setTitle("Checking for updates");
            WebQuerier webQuerier = appManager.getWebQuerier();
            String siteName, siteUrl;
            double progress = 0.0;
            // Obtain apps listing from each site if not done so
            for (DownloadSite downloadSite : downloadSitesManager.getDownloadSites()) {
                siteName = downloadSite.getSiteName();
                siteUrl = downloadSite.getSiteUrl();
                taskMonitor.setStatusMessage("Obtaining apps listing from " + siteName + "(" + siteUrl + ") ...");
                taskMonitor.setProgress(progress);
                progress += 1.0 / (downloadSitesManager.getDownloadSites().size() + 1);
                webQuerier.setCurrentAppStoreUrl(siteUrl);
                Set<WebApp> webApps = webQuerier.getAllApps();
            }
            taskMonitor.setStatusMessage("Reading listings for new versions");
            // We're 98% done.
            taskMonitor.setProgress(0.98);
            updateManager.checkForUpdates(appsToCheckUpdates);
        }

        @Override
        public void cancel() {
        // TODO Auto-generated method stub
        }
    }));
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp) Task(org.cytoscape.work.Task) InstallUpdatesTask(org.cytoscape.app.internal.task.InstallUpdatesTask) InstallAppsFromWebAppTask(org.cytoscape.app.internal.task.InstallAppsFromWebAppTask) ObservableTask(org.cytoscape.work.ObservableTask) TaskIterator(org.cytoscape.work.TaskIterator) TaskMonitor(org.cytoscape.work.TaskMonitor) DownloadSite(org.cytoscape.app.internal.ui.downloadsites.DownloadSite) WebQuerier(org.cytoscape.app.internal.net.WebQuerier) WebApp(org.cytoscape.app.internal.net.WebApp)

Example 15 with App

use of org.cytoscape.app.internal.manager.App in project cytoscape-impl by cytoscape.

the class CurrentlyInstalledAppsPanel method enableSelectedButtonActionPerformed.

private void enableSelectedButtonActionPerformed(ActionEvent evt) {
    // Obtain App objects corresponding to currently selected table entries
    Set<App> selectedApps = getSelectedApps();
    for (App app : selectedApps) {
        // Only install apps that are not already installed
        if (app.getStatus() != AppStatus.INSTALLED) {
            try {
                appManager.installApp(app);
            } catch (AppInstallException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    enableSelectedButton.setEnabled(false);
    disableSelectedButton.setEnabled(true);
    uninstallSelectedButton.setEnabled(true);
}
Also used : BundleApp(org.cytoscape.app.internal.manager.BundleApp) App(org.cytoscape.app.internal.manager.App) SimpleApp(org.cytoscape.app.internal.manager.SimpleApp) AppInstallException(org.cytoscape.app.internal.exception.AppInstallException)

Aggregations

App (org.cytoscape.app.internal.manager.App)25 WebApp (org.cytoscape.app.internal.net.WebApp)11 BundleApp (org.cytoscape.app.internal.manager.BundleApp)8 SimpleApp (org.cytoscape.app.internal.manager.SimpleApp)8 ArrayList (java.util.ArrayList)4 File (java.io.File)3 HashSet (java.util.HashSet)3 TaskIterator (org.cytoscape.work.TaskIterator)3 Dimension (java.awt.Dimension)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 BoxLayout (javax.swing.BoxLayout)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 JTextArea (javax.swing.JTextArea)2 DefaultTableModel (javax.swing.table.DefaultTableModel)2 Release (org.cytoscape.app.internal.net.WebApp.Release)2 WebQuerier (org.cytoscape.app.internal.net.WebQuerier)2