Search in sources :

Example 1 with AbstractTaskFactory

use of org.cytoscape.work.AbstractTaskFactory in project cytoscape-impl by cytoscape.

the class CyActivator method start.

public void start(final BundleContext bc) {
    final CySwingApplication cySwingApplicationRef = getService(bc, CySwingApplication.class);
    final TaskManager taskManagerRef = getService(bc, TaskManager.class);
    final Map<String, String> logViewerConfig = ezMap("baseHTMLPath", "/consoledialogbase.html", "colorParityTrue", "ffffff", "colorParityFalse", "f9f9f9", "entryTemplate", " <html> <body bgcolor=\"#%s\"> <table border=0 width=\"100%%\" cellspacing=5> <tr> <td width=\"0%%\"><img src=\"%s\"></td> <td><h3>%s</h3></td> </tr> <tr> <td></td> <td><font size=\"-2\" color=\"#555555\">%s</font></td> </tr> </table> </body> </html>", "DEBUG", "console-debug.png", "ERROR", "console-error.png", "FATAL", "console-error.png", "INFO", "console-info.png", "TRACE", "console-debug.png", "WARN", "console-warn.png");
    final UserMessagesDialog userMessagesDialog = new UserMessagesDialog(cySwingApplicationRef, logViewerConfig);
    registerService(bc, new AbstractTaskFactory() {

        public TaskIterator createTaskIterator() {
            return new TaskIterator(new Task() {

                public void cancel() {
                }

                public void run(TaskMonitor monitor) {
                    userMessagesDialog.open();
                }
            });
        }
    }, TaskFactory.class, ezProps(PREFERRED_MENU, "Help", TITLE, "User Messages...", MENU_GRAVITY, "3.0"));
    final CyStatusBar statusBar = new CyStatusBar(cySwingApplicationRef, "/logConsole.png", userMessagesDialog, ezMap("DEBUG", "/status-bar-debug.png", "ERROR", "/status-bar-error.png", "FATAL", "/status-bar-error.png", "INFO", "/status-bar-info.png", "TRACE", "/status-bar-debug.png", "WARN", "/status-bar-warn.png"));
    final ExecutorService executor = Executors.newCachedThreadPool(new LowPriorityDaemonThreadFactory());
    final LinkedBlockingQueue<PaxLoggingEvent> userMessagesQueue = new LinkedBlockingQueue<PaxLoggingEvent>();
    executor.submit(new UserMessagesProcesser(userMessagesQueue, statusBar, userMessagesDialog));
    registerService(bc, new AppenderToQueue(userMessagesQueue), PaxAppender.class, ezProps("org.ops4j.pax.logging.appender.name", "OrgCytoscapeLogSwingUserMessagesAppender"));
    final ConsoleDialog consoleDialog = new ConsoleDialog(taskManagerRef, cySwingApplicationRef, logViewerConfig);
    final LinkedBlockingQueue<PaxLoggingEvent> allLogMessagesQueue = new LinkedBlockingQueue<PaxLoggingEvent>();
    executor.submit(new AllLogMessagesProcesser(allLogMessagesQueue, consoleDialog));
    registerService(bc, new AppenderToQueue(allLogMessagesQueue), PaxAppender.class, ezProps("org.ops4j.pax.logging.appender.name", "OrgCytoscapeLogSwingAllLogMessagesAppender"));
    registerService(bc, new AbstractTaskFactory() {

        public TaskIterator createTaskIterator() {
            return new TaskIterator(new Task() {

                public void cancel() {
                }

                public void run(TaskMonitor monitor) {
                    consoleDialog.open();
                }
            });
        }
    }, TaskFactory.class, ezProps(PREFERRED_MENU, "Help", TITLE, "Developer's Log Console...", MENU_GRAVITY, "4.0"));
}
Also used : Task(org.cytoscape.work.Task) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) AbstractTaskFactory(org.cytoscape.work.AbstractTaskFactory) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) PaxLoggingEvent(org.ops4j.pax.logging.spi.PaxLoggingEvent) TaskManager(org.cytoscape.work.TaskManager) TaskIterator(org.cytoscape.work.TaskIterator) TaskMonitor(org.cytoscape.work.TaskMonitor) ExecutorService(java.util.concurrent.ExecutorService)

Aggregations

ExecutorService (java.util.concurrent.ExecutorService)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 CySwingApplication (org.cytoscape.application.swing.CySwingApplication)1 AbstractTaskFactory (org.cytoscape.work.AbstractTaskFactory)1 Task (org.cytoscape.work.Task)1 TaskIterator (org.cytoscape.work.TaskIterator)1 TaskManager (org.cytoscape.work.TaskManager)1 TaskMonitor (org.cytoscape.work.TaskMonitor)1 PaxLoggingEvent (org.ops4j.pax.logging.spi.PaxLoggingEvent)1