Search in sources :

Example 1 with StopRuntimeAction

use of org.talend.designer.esb.runcontainer.ui.actions.StopRuntimeAction in project tesb-studio-se by Talend.

the class ESBRuntimeConsolePageParticipant method init.

@Override
public void init(IPageBookViewPage page, IConsole console) {
    if (page.getControl() instanceof StyledText) {
        StyledText viewer = (StyledText) page.getControl();
        AnsiConsoleStyleListener myListener = new AnsiConsoleStyleListener();
        viewer.addLineStyleListener(myListener);
        ESBRunContainerPlugin.getDefault().addViewer(viewer, this);
    }
    startRuntimeAction = new StartRuntimeAction(true, page.getControl().getShell());
    haltRuntimeAction = new StopRuntimeAction(page.getControl().getShell());
    openRuntimeInfoAction = new OpenRuntimeInfoAction();
    openRuntimePrefsAction = new OpenRuntimePrefsAction();
    serverListener = new RuntimeStatusChangeListener() {

        @Override
        public void stopRunning() {
            Display.getDefault().asyncExec(new Runnable() {

                @Override
                public void run() {
                    startRuntimeAction.setEnabled(true);
                    haltRuntimeAction.setEnabled(false);
                    openRuntimeInfoAction.setEnabled(false);
                }
            });
        }

        @Override
        public void startRunning() {
            Display.getDefault().asyncExec(new Runnable() {

                @Override
                public void run() {
                    startRuntimeAction.setEnabled(false);
                    haltRuntimeAction.setEnabled(true);
                    openRuntimeInfoAction.setEnabled(true);
                }
            });
        }

        @Override
        public void featureUninstalled(int id) {
        }

        @Override
        public void featureInstalled(int id) {
        }
    };
    RuntimeServerController.getInstance().addStatusChangeListener(serverListener);
    IActionBars actionBars = page.getSite().getActionBars();
    configureToolBar(actionBars.getToolBarManager());
}
Also used : AnsiConsoleStyleListener(org.talend.designer.esb.runcontainer.ui.console.ansi.AnsiConsoleStyleListener) StartRuntimeAction(org.talend.designer.esb.runcontainer.ui.actions.StartRuntimeAction) StyledText(org.eclipse.swt.custom.StyledText) RuntimeStatusChangeListener(org.talend.designer.esb.runcontainer.server.RuntimeStatusChangeListener) StopRuntimeAction(org.talend.designer.esb.runcontainer.ui.actions.StopRuntimeAction) OpenRuntimeInfoAction(org.talend.designer.esb.runcontainer.ui.actions.OpenRuntimeInfoAction) OpenRuntimePrefsAction(org.talend.designer.esb.runcontainer.ui.actions.OpenRuntimePrefsAction) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

StyledText (org.eclipse.swt.custom.StyledText)1 IActionBars (org.eclipse.ui.IActionBars)1 RuntimeStatusChangeListener (org.talend.designer.esb.runcontainer.server.RuntimeStatusChangeListener)1 OpenRuntimeInfoAction (org.talend.designer.esb.runcontainer.ui.actions.OpenRuntimeInfoAction)1 OpenRuntimePrefsAction (org.talend.designer.esb.runcontainer.ui.actions.OpenRuntimePrefsAction)1 StartRuntimeAction (org.talend.designer.esb.runcontainer.ui.actions.StartRuntimeAction)1 StopRuntimeAction (org.talend.designer.esb.runcontainer.ui.actions.StopRuntimeAction)1 AnsiConsoleStyleListener (org.talend.designer.esb.runcontainer.ui.console.ansi.AnsiConsoleStyleListener)1