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;
}
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));
}
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();
}
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);
}
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();
}
Aggregations