Search in sources :

Example 6 with App

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

the class CurrentlyInstalledAppsPanel method continueWithConflicts.

public boolean continueWithConflicts(Map<App, Collection<App>> otherAppsDependingOn) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    JLabel title = new JLabel("The following are required by one or more installed apps:");
    title.setAlignmentX(LEFT_ALIGNMENT);
    panel.add(title);
    panel.add(Box.createVerticalStrut(title.getPreferredSize().height));
    String deps = "";
    for (App app : otherAppsDependingOn.keySet()) {
        deps += app.getAppName() + " (required by";
        for (App otherAppDependingOn : otherAppsDependingOn.get(app)) {
            deps += " " + otherAppDependingOn.getAppName() + ",";
        }
        deps = deps.substring(0, deps.length() - 1) + ")\n";
    }
    deps = deps.substring(0, deps.length() - 1);
    JTextArea textArea = new JTextArea(deps);
    textArea.setRows(Math.min(otherAppsDependingOn.size(), 10));
    textArea.setEditable(false);
    // disables text selection
    textArea.setHighlighter(null);
    textArea.setBorder(null);
    textArea.setOpaque(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setAlignmentX(LEFT_ALIGNMENT);
    scrollPane.setBorder(null);
    scrollPane.getViewport().setOpaque(false);
    scrollPane.setOpaque(false);
    panel.add(scrollPane);
    panel.add(Box.createVerticalStrut(title.getPreferredSize().height));
    JLabel message = new JLabel("Continue?");
    message.setAlignmentX(LEFT_ALIGNMENT);
    panel.add(message);
    Dimension size = panel.getPreferredSize();
    if (size.width > 600) {
        size.width = 600;
        panel.setPreferredSize(size);
    }
    int confirm = JOptionPane.showConfirmDialog(this, panel, "Warning", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
    return (confirm == JOptionPane.OK_OPTION);
}
Also used : BundleApp(org.cytoscape.app.internal.manager.BundleApp) App(org.cytoscape.app.internal.manager.App) SimpleApp(org.cytoscape.app.internal.manager.SimpleApp) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 7 with App

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

the class DisableTask 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("Disabling app " + app);
    App appObject = getApp(app);
    if (appObject == null) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Can't find app '" + app + "'");
        return;
    }
    appManager.disableApp(appObject);
    updateApps();
    taskMonitor.showMessage(TaskMonitor.Level.INFO, "App '" + app + "' disabled");
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp)

Example 8 with App

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

the class EnableTask 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("Enabling app " + app);
    App appObject = getApp(app);
    if (appObject == null) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Can't find app '" + app + "'");
        return;
    }
    if (!appObject.getStatus().equals(App.AppStatus.DISABLED)) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "App '" + app + "' is not disabled");
        return;
    }
    appManager.installApp(appObject);
    updateApps();
    taskMonitor.showMessage(TaskMonitor.Level.INFO, "App '" + app + "' re-enabled");
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp)

Example 9 with App

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

the class InstallAppsTask method run.

@Override
public void run(TaskMonitor taskMonitor) throws Exception {
    for (App appToInstall : appsToInstall) {
        App appToReplace = appsToReplace.get(appToInstall);
        if (appToReplace != null)
            taskMonitor.setStatusMessage("Updating " + appToInstall.getAppName());
        else
            taskMonitor.setStatusMessage("Installing " + appToInstall.getAppName());
        appManager.installApp(appToInstall);
        if (appToReplace != null && !appToInstall.getVersion().equals(appToReplace.getVersion()))
            appManager.uninstallApp(appToReplace);
    }
}
Also used : App(org.cytoscape.app.internal.manager.App)

Example 10 with App

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

the class WebQuerier method findAppDescriptions.

public void findAppDescriptions(Set<App> apps) {
    if (appsByUrl.get(DEFAULT_APP_STORE_URL) == null) {
        return;
    }
    // Find the set of all available apps
    Set<WebApp> allWebApps = new HashSet<WebApp>(appsByUrl.get(DEFAULT_APP_STORE_URL).size());
    for (String url : appsByUrl.keySet()) {
        Set<WebApp> urlApps = appsByUrl.get(url);
        for (WebApp webApp : urlApps) {
            allWebApps.add(webApp);
        }
    }
    // Find set of all app releases
    Map<Release, WebApp> allReleases = new HashMap<Release, WebApp>(appsByUrl.get(DEFAULT_APP_STORE_URL).size());
    List<Release> appReleases = null;
    for (WebApp webApp : allWebApps) {
        appReleases = webApp.getReleases();
        for (Release appRelease : appReleases) {
            allReleases.put(appRelease, webApp);
        }
    }
    // Find matching app hashes
    for (Release release : allReleases.keySet()) {
        for (App app : apps) {
            String checksum = app.getSha512Checksum().toLowerCase();
            // in cases where multiple stores give the same hash.
            if (checksum.indexOf(release.getSha512Checksum().toLowerCase()) != -1 && app.getDescription() == null) {
                // WebQuerier obtains app information from app store because no description metadata is required
                // in the app zip file itself. This was to allow better App-Bundle interchangeability, not
                // imposing unneeded restrictions on OSGi bundles (from past discussion on mailing list, some time in 2012)
                // System.out.println("Found description: " + allReleases.get(release).getDescription());
                app.setDescription(allReleases.get(release).getDescription());
            }
        }
    }
}
Also used : App(org.cytoscape.app.internal.manager.App) HashMap(java.util.HashMap) Release(org.cytoscape.app.internal.net.WebApp.Release) HashSet(java.util.HashSet)

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