/**
* Sends the current selected text/editor to the console.
*/
private static void sendCommandToConsole(PySelection selection, ScriptConsole console, PyEdit edit)
throws BadLocationException {
PydevConsole pydevConsole = (PydevConsole) console;
IDocument document = pydevConsole.getDocument();
String cmd = getCommandToSend(edit, selection);
if (cmd != null) {
document.replace(document.getLength(), 0, cmd);
}
if (InteractiveConsolePrefs.getFocusConsoleOnSendCommand()) {
ScriptConsoleViewer viewer = pydevConsole.getViewer();
if (viewer == null) {
return;
}
StyledText textWidget = viewer.getTextWidget();
if (textWidget == null) {