Search in sources :

Example 1 with DownloadSite

use of org.cytoscape.app.internal.ui.downloadsites.DownloadSite 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 2 with DownloadSite

use of org.cytoscape.app.internal.ui.downloadsites.DownloadSite in project cytoscape-impl by cytoscape.

the class UpdateManager method handleEvent.

@Override
public void handleEvent(AppsFinishedStartingEvent event) {
    for (DownloadSite downloadSite : downloadSitesManager.getDownloadSites()) {
        appManager.getWebQuerier().setCurrentAppStoreUrl(downloadSite.getSiteUrl());
        appManager.getWebQuerier().getAllApps();
    }
    checkForUpdates(appManager.getInstalledApps());
    for (Update update : updates) {
        userLogger.info("Update for " + update + " available (latest version: " + update.getUpdateVersion() + ", " + update.getApp().getVersion() + " installed)");
    }
    if (updates.size() > 0)
        userLogger.info(updates.size() + " " + (updates.size() == 1 ? "update" : "updates") + " available");
}
Also used : DownloadSite(org.cytoscape.app.internal.ui.downloadsites.DownloadSite)

Aggregations

DownloadSite (org.cytoscape.app.internal.ui.downloadsites.DownloadSite)2 App (org.cytoscape.app.internal.manager.App)1 WebApp (org.cytoscape.app.internal.net.WebApp)1 WebQuerier (org.cytoscape.app.internal.net.WebQuerier)1 InstallAppsFromWebAppTask (org.cytoscape.app.internal.task.InstallAppsFromWebAppTask)1 InstallUpdatesTask (org.cytoscape.app.internal.task.InstallUpdatesTask)1 ObservableTask (org.cytoscape.work.ObservableTask)1 Task (org.cytoscape.work.Task)1 TaskIterator (org.cytoscape.work.TaskIterator)1 TaskMonitor (org.cytoscape.work.TaskMonitor)1