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