Search in sources :

Example 1 with ScriptConsole

use of org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole in project linuxtools by eclipse.

the class RunScriptHandler method executeAction.

private void executeAction(ExecutionEvent event) throws ExecutionException {
    final boolean local = getRunLocal();
    findTargetEditor(event);
    findFilePath();
    tryEditorSave(event);
    if (!local) {
        prepareNonLocalScript();
    }
    final String[] script = buildStandardScript();
    final String[] envVars = EnvironmentVariablesPreferencePage.getEnvironmentVariables();
    Display.getDefault().asyncExec(() -> {
        String name = getConsoleName();
        if (ScriptConsole.instanceIsRunning(name)) {
            MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.RunScriptHandler_AlreadyRunningDialogTitle, null, MessageFormat.format(Messages.RunScriptHandler_AlreadyRunningDialogMessage, fileName), MessageDialog.QUESTION, new String[] { "Yes", "No" }, // $NON-NLS-1$ //$NON-NLS-2$
            0);
            if (dialog.open() != Window.OK) {
                if (launch != null) {
                    launch.forceRemove();
                }
                return;
            }
        }
        final ScriptConsole console = ScriptConsole.getInstance(name);
        if (!local) {
            console.run(script, envVars, remoteOptions, new StapErrorParser());
        } else {
            console.runLocally(script, envVars, new StapErrorParser(), getProject());
        }
        scriptConsoleInitialized(console);
    });
}
Also used : ScriptConsole(org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) StapErrorParser(org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.StapErrorParser)

Example 2 with ScriptConsole

use of org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole in project linuxtools by eclipse.

the class ScriptConsoleTest method testGetInstance.

@Test
public void testGetInstance() {
    assertNotNull(console);
    assertSame(console, ScriptConsole.getInstance("test"));
    ScriptConsole console2 = ScriptConsole.getInstance("a");
    assertNotNull(console2);
    assertNotSame(console, console2);
}
Also used : ScriptConsole(org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole) Test(org.junit.Test)

Example 3 with ScriptConsole

use of org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole in project linuxtools by eclipse.

the class ScriptConsolePageParticipant method init.

@Override
public void init(IPageBookViewPage page, IConsole iConsole) {
    if (!(iConsole instanceof ScriptConsole)) {
        return;
    }
    fPage = page;
    fConsole = (ScriptConsole) iConsole;
    fView = (IConsoleView) fPage.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
    StopScriptAction stopScriptAction = new StopScriptAction(fConsole);
    CloseStapConsoleAction closeConsoleAction = new CloseStapConsoleAction(fConsole);
    SaveLogAction saveLogAction = new SaveLogAction(fConsole);
    // contribute to toolbar
    IToolBarManager manager = fPage.getSite().getActionBars().getToolBarManager();
    manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, stopScriptAction);
    manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeConsoleAction);
    manager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, saveLogAction);
    // TODO if {@link ModifyParsingAction} is restored, it is to be used here,
    // in the same way stopScriptAction and saveLogAction are used.
    DebugUITools.getDebugContextManager().getContextService(fPage.getSite().getWorkbenchWindow()).addDebugContextListener(this);
}
Also used : ScriptConsole(org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole) SaveLogAction(org.eclipse.linuxtools.internal.systemtap.ui.consolelog.actions.SaveLogAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) StopScriptAction(org.eclipse.linuxtools.internal.systemtap.ui.consolelog.actions.StopScriptAction) CloseStapConsoleAction(org.eclipse.linuxtools.internal.systemtap.ui.consolelog.actions.CloseStapConsoleAction)

Aggregations

ScriptConsole (org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole)3 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 CloseStapConsoleAction (org.eclipse.linuxtools.internal.systemtap.ui.consolelog.actions.CloseStapConsoleAction)1 SaveLogAction (org.eclipse.linuxtools.internal.systemtap.ui.consolelog.actions.SaveLogAction)1 StopScriptAction (org.eclipse.linuxtools.internal.systemtap.ui.consolelog.actions.StopScriptAction)1 StapErrorParser (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.StapErrorParser)1 Test (org.junit.Test)1