Search in sources :

Example 1 with CyHelpBrokerImpl

use of org.cytoscape.internal.view.CyHelpBrokerImpl in project cytoscape-impl by cytoscape.

the class CyActivator method start.

@Override
public void start(final BundleContext bc) throws Exception {
    final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
    invokeOnEDTAndWait(() -> {
        setLookAndFeel(bc);
    }, logger);
    // ////////////
    ConfigDirPropertyWriter configDirPropertyWriter = new ConfigDirPropertyWriter(serviceRegistrar);
    registerService(bc, configDirPropertyWriter, CyShutdownListener.class);
    CyHelpBrokerImpl cyHelpBroker = new CyHelpBrokerImpl();
    registerService(bc, cyHelpBroker, CyHelpBroker.class);
    registerServiceListener(bc, configDirPropertyWriter::addCyProperty, configDirPropertyWriter::removeCyProperty, CyProperty.class);
    SimpleGUITunableHandlerFactory<CyPropertyConfirmationHandler> cyPropConfirmHandlerFactory = new SimpleGUITunableHandlerFactory<>(CyPropertyConfirmationHandler.class, CyPropertyConfirmation.class);
    registerService(bc, cyPropConfirmHandlerFactory, GUITunableHandlerFactory.class);
    invokeOnEDTAndWait(() -> {
        initComponents(bc, serviceRegistrar);
    });
    registerService(bc, undoAction, CyAction.class);
    registerService(bc, redoAction, CyAction.class);
    registerService(bc, printAction, CyAction.class);
    registerService(bc, preferenceAction, CyAction.class);
    // registerService(bc, cy3preferenceAction, CyAction.class);
    registerService(bc, bookmarkAction, CyAction.class);
    registerService(bc, settingsAction, CyAction.class);
    registerService(bc, settingsAction, SetCurrentNetworkViewListener.class);
    registerService(bc, cytoPanelWestAction, CyAction.class);
    registerService(bc, cytoPanelSouthAction, CyAction.class);
    registerService(bc, cytoPanelEastAction, CyAction.class);
    registerService(bc, cytoPanelSouthWestAction, CyAction.class);
    registerService(bc, cytoPanelCommandAction, CyAction.class);
    registerService(bc, starterPanelAction, CyAction.class);
    registerService(bc, detachedViewToolBarAction, CyAction.class);
    registerService(bc, closeWindowAction, CyAction.class);
    registerService(bc, cyDesktopManager, CyNetworkViewDesktopMgr.class);
    registerService(bc, bookmarkDialogFactory, SessionLoadedListener.class);
    {
        Properties props = new Properties();
        props.setProperty(PREFERRED_MENU, "Help");
        props.setProperty(TITLE, "User Manual");
        props.setProperty(MENU_GRAVITY, "1.0");
        props.setProperty(TOOLTIP, "Show User Manual");
        registerService(bc, helpUserManualTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(PREFERRED_MENU, "Help");
        props.setProperty(MENU_GRAVITY, "7.0");
        props.setProperty(TITLE, "Contact Help Desk...");
        registerService(bc, helpContactHelpDeskTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(PREFERRED_MENU, "Help");
        props.setProperty(TITLE, "Report a Bug...");
        props.setProperty(MENU_GRAVITY, "8.0");
        registerService(bc, helpReportABugTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
        props.setProperty(ACCELERATOR, "cmd g");
        props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
        props.setProperty(TITLE, "Grid");
        props.setProperty(MENU_GRAVITY, "1.0");
        registerService(bc, arrangeGridTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
        props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
        props.setProperty(TITLE, "Cascade");
        props.setProperty(MENU_GRAVITY, "2.0");
        registerService(bc, arrangeCascadeTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
        props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
        props.setProperty(TITLE, "Vertical Stack");
        props.setProperty(MENU_GRAVITY, "3.0");
        registerService(bc, arrangeHorizontalTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
        props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
        props.setProperty(TITLE, "Side by Side");
        props.setProperty(MENU_GRAVITY, "4.0");
        registerService(bc, arrangeVerticalTaskFactory, TaskFactory.class, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
        registerAllServices(bc, createNetworkViewsAction, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
        registerAllServices(bc, destroyNetworkViewsAction, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
        registerAllServices(bc, destroyNetworksAction, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
        registerAllServices(bc, exportNetworkAction, props);
    }
    {
        Properties props = new Properties();
        props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
        registerAllServices(bc, exportImageAction, props);
    }
    {
        TaskFactory pauseCommand = new PauseCommandTaskFactory(cytoscapeDesktop);
        Properties props = new Properties();
        props.setProperty(COMMAND_NAMESPACE, "command");
        props.setProperty(COMMAND_DESCRIPTION, "Display a message and pause until the user continues.");
        props.setProperty(COMMAND, "pause");
        props.setProperty(COMMAND_LONG_DESCRIPTION, "The **pause** command displays a dialog with the text provided in the *message* argument " + "and waits for the user to click **OK**");
        props.setProperty(COMMAND_SUPPORTS_JSON, "true");
        props.setProperty(COMMAND_EXAMPLE_JSON, "{}");
        registerService(bc, pauseCommand, TaskFactory.class, props);
    }
    registerAllServices(bc, cytoscapeDesktop);
    registerAllServices(bc, netMainPanel);
    registerAllServices(bc, commandToolPanel);
    registerAllServices(bc, netMediator);
    registerAllServices(bc, netViewMediator);
    registerService(bc, undoMonitor, SetCurrentNetworkViewListener.class);
    registerService(bc, undoMonitor, NetworkDestroyedListener.class);
    registerService(bc, undoMonitor, NetworkViewDestroyedListener.class);
    registerAllServices(bc, rowViewTracker);
    registerAllServices(bc, selecteEdgeViewUpdater);
    registerAllServices(bc, selecteNodeViewUpdater);
    registerAllServices(bc, rowsSetViewUpdater);
    registerAllServices(bc, sessionHandler);
    registerAllServices(bc, toolBarEnableUpdater);
    registerAllServices(bc, recentSessionManager);
    registerAllServices(bc, netSelectionMediator);
    registerAllServices(bc, netSearchMediator);
    registerServiceListener(bc, cytoscapeDesktop::addAction, cytoscapeDesktop::removeAction, CyAction.class);
    registerServiceListener(bc, preferenceAction::addCyProperty, preferenceAction::removeCyProperty, CyProperty.class);
    // registerServiceListener(bc, cy3preferenceAction::addCyProperty, cy3preferenceAction::removeCyProperty, CyProperty.class);
    registerServiceListener(bc, cytoscapeDesktop::addCytoPanelComponent, cytoscapeDesktop::removeCytoPanelComponent, CytoPanelComponent.class);
    registerServiceListener(bc, cytoscapeDesktop::addToolBarComponent, cytoscapeDesktop::removeToolBarComponent, ToolBarComponent.class);
    registerServiceListener(bc, cytoscapeMenuPopulator::addTaskFactory, cytoscapeMenuPopulator::removeTaskFactory, TaskFactory.class);
    registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkTaskFactory, cytoscapeMenuPopulator::removeNetworkTaskFactory, NetworkTaskFactory.class);
    registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkViewTaskFactory, cytoscapeMenuPopulator::removeNetworkViewTaskFactory, NetworkViewTaskFactory.class);
    registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkCollectionTaskFactory, cytoscapeMenuPopulator::removeNetworkCollectionTaskFactory, NetworkCollectionTaskFactory.class);
    registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkViewCollectionTaskFactory, cytoscapeMenuPopulator::removeNetworkViewCollectionTaskFactory, NetworkViewCollectionTaskFactory.class);
    registerServiceListener(bc, cytoscapeMenuPopulator::addTableTaskFactory, cytoscapeMenuPopulator::removeTableTaskFactory, TableTaskFactory.class);
    registerServiceListener(bc, layoutSettingsManager::addLayout, layoutSettingsManager::removeLayout, CyLayoutAlgorithm.class);
    registerServiceListener(bc, settingsAction::addLayout, settingsAction::removeLayout, CyLayoutAlgorithm.class);
    // For Network Panel context menu
    registerServiceListener(bc, netMediator::addNetworkViewTaskFactory, netMediator::removeNetworkViewTaskFactory, NetworkViewTaskFactory.class, CONTEXT_MENU_FILTER);
    registerServiceListener(bc, netMediator::addNetworkTaskFactory, netMediator::removeNetworkTaskFactory, NetworkTaskFactory.class, CONTEXT_MENU_FILTER);
    registerServiceListener(bc, netMediator::addNetworkViewCollectionTaskFactory, netMediator::removeNetworkViewCollectionTaskFactory, NetworkViewCollectionTaskFactory.class, CONTEXT_MENU_FILTER);
    registerServiceListener(bc, netMediator::addNetworkCollectionTaskFactory, netMediator::removeNetworkCollectionTaskFactory, NetworkCollectionTaskFactory.class, CONTEXT_MENU_FILTER);
    registerServiceListener(bc, netMediator::addCyAction, netMediator::removeCyAction, CyAction.class, CONTEXT_MENU_FILTER);
    registerServiceListener(bc, netSearchMediator::addNetworkSearchTaskFactory, netSearchMediator::removeNetworkSearchTaskFactory, NetworkSearchTaskFactory.class);
    registerServiceListener(bc, layoutMenuPopulator::addLayout, layoutMenuPopulator::removeLayout, CyLayoutAlgorithm.class);
    if (LookAndFeelUtil.isMac()) {
        try {
            new MacCyActivator().start(bc);
        } catch (Exception e) {
            logger.error("Cannot start MacCyActivator", e);
        }
    } else {
        Properties props = new Properties();
        props.setProperty(PREFERRED_MENU, "Help");
        props.setProperty(TITLE, "About");
        props.setProperty(MENU_GRAVITY, "10.0");
        registerService(bc, helpAboutTaskFactory, TaskFactory.class, props);
        registerService(bc, exitAction, CyAction.class);
    }
    // Full screen actions.  This is platform dependent
    FullScreenAction fullScreenAction = null;
    if (LookAndFeelUtil.isMac() && MacFullScreenEnabler.supportsNativeFullScreenMode())
        fullScreenAction = new FullScreenMacAction(cytoscapeDesktop);
    else
        fullScreenAction = new FullScreenAction(cytoscapeDesktop);
    registerService(bc, fullScreenAction, CyAction.class);
}
Also used : SimpleGUITunableHandlerFactory(org.cytoscape.work.swing.SimpleGUITunableHandlerFactory) PauseCommandTaskFactory(org.cytoscape.internal.command.PauseCommandTaskFactory) FullScreenAction(org.cytoscape.internal.actions.FullScreenAction) Properties(java.util.Properties) ServiceProperties(org.cytoscape.work.ServiceProperties) CyHelpBrokerImpl(org.cytoscape.internal.view.CyHelpBrokerImpl) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) FullScreenMacAction(org.cytoscape.internal.actions.FullScreenMacAction) ConfigDirPropertyWriter(org.cytoscape.internal.shutdown.ConfigDirPropertyWriter) CyPropertyConfirmationHandler(org.cytoscape.internal.tunable.CyPropertyConfirmationHandler) NetworkViewCollectionTaskFactory(org.cytoscape.task.NetworkViewCollectionTaskFactory) HelpContactHelpDeskTaskFactory(org.cytoscape.internal.view.help.HelpContactHelpDeskTaskFactory) NetworkCollectionTaskFactory(org.cytoscape.task.NetworkCollectionTaskFactory) HelpAboutTaskFactory(org.cytoscape.internal.view.help.HelpAboutTaskFactory) ArrangeTaskFactory(org.cytoscape.internal.view.help.ArrangeTaskFactory) NetworkViewTaskFactory(org.cytoscape.task.NetworkViewTaskFactory) HelpUserManualTaskFactory(org.cytoscape.internal.view.help.HelpUserManualTaskFactory) HelpReportABugTaskFactory(org.cytoscape.internal.view.help.HelpReportABugTaskFactory) TaskFactory(org.cytoscape.work.TaskFactory) NetworkTaskFactory(org.cytoscape.task.NetworkTaskFactory) TableTaskFactory(org.cytoscape.task.TableTaskFactory) PauseCommandTaskFactory(org.cytoscape.internal.command.PauseCommandTaskFactory) NetworkSearchTaskFactory(org.cytoscape.application.swing.search.NetworkSearchTaskFactory)

Aggregations

Properties (java.util.Properties)1 NetworkSearchTaskFactory (org.cytoscape.application.swing.search.NetworkSearchTaskFactory)1 FullScreenAction (org.cytoscape.internal.actions.FullScreenAction)1 FullScreenMacAction (org.cytoscape.internal.actions.FullScreenMacAction)1 PauseCommandTaskFactory (org.cytoscape.internal.command.PauseCommandTaskFactory)1 ConfigDirPropertyWriter (org.cytoscape.internal.shutdown.ConfigDirPropertyWriter)1 CyPropertyConfirmationHandler (org.cytoscape.internal.tunable.CyPropertyConfirmationHandler)1 CyHelpBrokerImpl (org.cytoscape.internal.view.CyHelpBrokerImpl)1 ArrangeTaskFactory (org.cytoscape.internal.view.help.ArrangeTaskFactory)1 HelpAboutTaskFactory (org.cytoscape.internal.view.help.HelpAboutTaskFactory)1 HelpContactHelpDeskTaskFactory (org.cytoscape.internal.view.help.HelpContactHelpDeskTaskFactory)1 HelpReportABugTaskFactory (org.cytoscape.internal.view.help.HelpReportABugTaskFactory)1 HelpUserManualTaskFactory (org.cytoscape.internal.view.help.HelpUserManualTaskFactory)1 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)1 NetworkCollectionTaskFactory (org.cytoscape.task.NetworkCollectionTaskFactory)1 NetworkTaskFactory (org.cytoscape.task.NetworkTaskFactory)1 NetworkViewCollectionTaskFactory (org.cytoscape.task.NetworkViewCollectionTaskFactory)1 NetworkViewTaskFactory (org.cytoscape.task.NetworkViewTaskFactory)1 TableTaskFactory (org.cytoscape.task.TableTaskFactory)1 ServiceProperties (org.cytoscape.work.ServiceProperties)1