Search in sources :

Example 6 with CommandExecutorTaskFactory

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);
    }
}
Also used : App(org.cytoscape.app.internal.manager.App) WebApp(org.cytoscape.app.internal.net.WebApp) TaskIterator(org.cytoscape.work.TaskIterator) OpenBrowser(org.cytoscape.util.swing.OpenBrowser) CommandExecutorTaskFactory(org.cytoscape.command.CommandExecutorTaskFactory) HashMap(java.util.HashMap) WebApp(org.cytoscape.app.internal.net.WebApp)

Example 7 with CommandExecutorTaskFactory

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);
}
Also used : TaskIterator(org.cytoscape.work.TaskIterator) CommandExecutorTaskFactory(org.cytoscape.command.CommandExecutorTaskFactory) SynchronousTaskManager(org.cytoscape.work.SynchronousTaskManager) ArrayList(java.util.ArrayList)

Aggregations

CommandExecutorTaskFactory (org.cytoscape.command.CommandExecutorTaskFactory)7 TaskIterator (org.cytoscape.work.TaskIterator)4 Properties (java.util.Properties)2 CyVersion (org.cytoscape.application.CyVersion)2 AvailableCommands (org.cytoscape.command.AvailableCommands)2 OpenBrowser (org.cytoscape.util.swing.OpenBrowser)2 SynchronousTaskManager (org.cytoscape.work.SynchronousTaskManager)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 AppsFinishedStartingEvent (org.cytoscape.app.event.AppsFinishedStartingEvent)1 AppsFinishedStartingListener (org.cytoscape.app.event.AppsFinishedStartingListener)1 AppManagerAction (org.cytoscape.app.internal.action.AppManagerAction)1 CitationsAction (org.cytoscape.app.internal.action.CitationsAction)1 App (org.cytoscape.app.internal.manager.App)1 AppManager (org.cytoscape.app.internal.manager.AppManager)1 UpdateManager (org.cytoscape.app.internal.net.UpdateManager)1 WebApp (org.cytoscape.app.internal.net.WebApp)1 WebQuerier (org.cytoscape.app.internal.net.WebQuerier)1 AddAllowOriginHeader (org.cytoscape.app.internal.net.server.AddAllowOriginHeader)1