void (@NotNull Project project, @NotNull VirtualFile file, @NotNull Editor editor, @NotNull IdeScriptEngineManager.EngineInfo engineInfo) { String command = getCommandText(project, editor); if (StringUtil.isEmptyOrSpaces(command)) return; String profile = getProfileText(file); RunContentDescriptor descriptor = getConsoleView(project, file, engineInfo); IdeScriptEngine engine; Content content = descriptor.getAttachedContent(); if (content == null) { LOG.error("Attached content expected"); return; } else { Trinity<IdeScriptEngine, IdeScriptEngineManager.EngineInfo, VirtualFile> data = content.getUserData(SCRIPT_ENGINE_KEY); if (data != null) { engine = data.first; } else { engine = IdeScriptEngineManager.getInstance().getEngine(engineInfo, null); if (engine == null) { LOG.error("Script engine not found for: " + file.getName()); return; } content.putUserData(SCRIPT_ENGINE_KEY, Trinity.create(engine, engineInfo, file)); } } ConsoleViewImpl consoleView = (ConsoleViewImpl)descriptor.getExecutionConsole(); prepareEngine(project, engine, descriptor); try { long ts = System.currentTimeMillis(); //myHistoryController.getModel().addToHistory(command); consoleView.print("> " + command, ConsoleViewContentType.USER_INPUT); consoleView.print("\n", ConsoleViewContentType.USER_INPUT); String script = profile == null ? command : profile + "\n" + command; Object o = engine.eval(script); String prefix = "["+(StringUtil.formatDuration(System.currentTimeMillis() - ts))+"]"; consoleView.print(prefix + "=> " + o, ConsoleViewContentType.NORMAL_OUTPUT); consoleView.print("\n", ConsoleViewContentType.NORMAL_OUTPUT); } catch (Throwable e) { Throwable ex = ExceptionUtil.getRootCause(e); String message = StringUtil.notNullize(StringUtil.nullize(ex.getMessage()), ex.toString()); consoleView.print(ex.getClass().getSimpleName() + ": " + message, ConsoleViewContentType.ERROR_OUTPUT); consoleView.print("\n", ConsoleViewContentType.ERROR_OUTPUT); } selectContent(descriptor); }