use of org.cytoscape.command.CommandExecutorTaskFactory in project cytoscape-impl by cytoscape.
the class AppStoreTask method run.
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
WebApp webApp = null;
if (app != null) {
webApp = getWebApp(app);
url = APP_STORE + "apps/" + app;
} else {
url = APP_STORE;
}
// Do we have access to the CyBrowser?
App cyBrowser = getApp("cybrowser");
// System.out.println("cybrowser: "+cyBrowser);
if (useCybrowser == true && cyBrowser != null && cyBrowser.getStatus() == App.AppStatus.INSTALLED) {
CommandExecutorTaskFactory commandTF = serviceRegistrar.getService(CommandExecutorTaskFactory.class);
TaskManager<?, ?> taskManager = serviceRegistrar.getService(TaskManager.class);
// Yes, use it!
Map<String, Object> args = new HashMap<>();
args.put("url", url);
args.put("id", "AppStore");
TaskIterator ti = commandTF.createTaskIterator("cybrowser", "dialog", args, null);
taskManager.execute(ti);
} else {
// No, use the standard open browser
OpenBrowser openBrowser = serviceRegistrar.getService(OpenBrowser.class);
openBrowser.openURL(url);
}
}
use of org.cytoscape.command.CommandExecutorTaskFactory in project PhenomeScape by soulj.
the class CommandExecutor method execute.
public static void execute(String command, CyServiceRegistrar cyServiceRegistrar) {
CommandExecutorTaskFactory executor = cyServiceRegistrar.getService(CommandExecutorTaskFactory.class);
List<String> commands = new ArrayList<String>();
commands.add(command);
TaskIterator task = executor.createTaskIterator(commands, null);
SynchronousTaskManager manager = cyServiceRegistrar.getService(SynchronousTaskManager.class);
manager.execute(task);
}
Aggregations