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);
});
}
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);
}
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);
}
Aggregations