Search in sources :

Example 1 with App

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

the class AppConflictHandler method setTunableDirectly.

@Override
public boolean setTunableDirectly(Window possibleParent) {
    try {
        AppConflict conflict = (AppConflict) getValue();
        Map<App, App> appsToReplace = conflict.getAppsToReplace();
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
        JLabel title = new JLabel("The following " + (appsToReplace.size() == 1 ? "app" : "apps") + " will be replaced:");
        title.setAlignmentX(Component.LEFT_ALIGNMENT);
        panel.add(title);
        panel.add(Box.createVerticalStrut(title.getPreferredSize().height));
        String deps = "";
        for (Entry<App, App> entry : appsToReplace.entrySet()) {
            deps += entry.getKey().getAppName() + " (to be installed: " + entry.getKey().getVersion() + ", " + entry.getValue().getVersion() + " currently installed)\n";
        }
        deps = deps.substring(0, deps.length() - 1);
        JTextArea textArea = new JTextArea(deps);
        textArea.setRows(Math.min(appsToReplace.size(), 10));
        textArea.setEditable(false);
        // disables text selection
        textArea.setHighlighter(null);
        textArea.setBorder(null);
        textArea.setOpaque(false);
        JScrollPane scrollPane = new JScrollPane(textArea);
        scrollPane.setAlignmentX(Component.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(Component.LEFT_ALIGNMENT);
        panel.add(message);
        Dimension size = panel.getPreferredSize();
        if (size.width > 600) {
            size.width = 600;
            panel.setPreferredSize(size);
        }
        int response = JOptionPane.showConfirmDialog(possibleParent, panel, "Replace " + (appsToReplace.size() == 1 ? "App" : "Apps"), JOptionPane.OK_CANCEL_OPTION);
        conflict.setReplaceApps(response);
    } catch (IllegalAccessException e) {
        logger.warn("Error accessing conflict object", e);
    } catch (InvocationTargetException e) {
        logger.warn("Exception thrown by conflict object", e);
    }
    return true;
}
Also used : App(org.cytoscape.app.internal.manager.App) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextArea(javax.swing.JTextArea) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) InvocationTargetException(java.lang.reflect.InvocationTargetException) AppConflict(org.cytoscape.app.internal.task.ResolveAppConflictTask.AppConflict)

Example 2 with App

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

the class ResolveAppDependenciesTask method run.

@Override
public void run(TaskMonitor taskMonitor) throws Exception {
    this.taskMonitor = taskMonitor;
    status = new DownloadStatus(taskMonitor);
    while (!appQueue.isEmpty()) {
        App app = appQueue.poll();
        resolveAppDependencies(app);
    }
    if (promptToReplace && !appsToReplace.isEmpty())
        insertTasksAfterCurrentTask(new ResolveAppConflictTask(appsToInstall, appsToReplace, appManager));
    else
        insertTasksAfterCurrentTask(new InstallAppsTask(appsToInstall, appsToReplace, appManager));
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp) DownloadStatus(org.cytoscape.app.internal.net.DownloadStatus)

Example 3 with App

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

the class StatusTask 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("Getting the status of app " + app);
    App appObject = getApp(app);
    if (appObject == null) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Can't find app '" + app + "'");
        return;
    }
    status = appObject.getStatus();
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp)

Example 4 with App

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

the class CurrentlyInstalledAppsPanel method disableSelectedButtonActionPerformed.

private void disableSelectedButtonActionPerformed(ActionEvent evt) {
    // Obtain App objects corresponding to currently selected table entries
    Set<App> selectedApps = getSelectedApps();
    Map<App, Collection<App>> otherAppsDependingOn = getOtherAppsDependingOn(selectedApps);
    if (otherAppsDependingOn != null && !continueWithConflicts(otherAppsDependingOn))
        return;
    for (App app : selectedApps) {
        if (app.getStatus().equals(AppStatus.DISABLED))
            continue;
        try {
            appManager.disableApp(app);
        } catch (AppDisableException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    disableSelectedButton.setEnabled(false);
    enableSelectedButton.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) Collection(java.util.Collection) AppDisableException(org.cytoscape.app.internal.exception.AppDisableException)

Example 5 with App

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

the class CurrentlyInstalledAppsPanel method uninstallSelectedButtonActionPerformed.

private void uninstallSelectedButtonActionPerformed(ActionEvent evt) {
    // Obtain App objects corresponding to currently selected table entries
    Set<App> selectedApps = getSelectedApps();
    Map<App, Collection<App>> otherAppsDependingOn = getOtherAppsDependingOn(selectedApps);
    if (otherAppsDependingOn != null && !continueWithConflicts(otherAppsDependingOn))
        return;
    for (App app : selectedApps) {
        // Only uninstall apps that are installed
        if (app.getStatus() == AppStatus.INSTALLED || app.getStatus() == AppStatus.DISABLED || app.getStatus() == AppStatus.FAILED_TO_LOAD || app.getStatus() == AppStatus.FAILED_TO_START) {
            try {
                appManager.uninstallApp(app);
            } catch (AppUninstallException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
    uninstallSelectedButton.setEnabled(false);
    disableSelectedButton.setEnabled(true);
    enableSelectedButton.setEnabled(true);
    appsAvailableTable.clearSelection();
}
Also used : BundleApp(org.cytoscape.app.internal.manager.BundleApp) App(org.cytoscape.app.internal.manager.App) SimpleApp(org.cytoscape.app.internal.manager.SimpleApp) Collection(java.util.Collection) AppUninstallException(org.cytoscape.app.internal.exception.AppUninstallException)

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