use of com.intellij.execution.ui.ConsoleView in project intellij-community by JetBrains.
the class DefaultExternalSystemExecutionConsoleManager method attachExecutionConsole.
@NotNull
@Override
public ExecutionConsole attachExecutionConsole(@NotNull ExternalSystemTask task, @NotNull Project project, @NotNull ExternalSystemRunConfiguration configuration, @NotNull Executor executor, @NotNull ExecutionEnvironment env, @NotNull ProcessHandler processHandler) throws ExecutionException {
ConsoleView executionConsole = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
executionConsole.attachToProcess(processHandler);
return executionConsole;
}
use of com.intellij.execution.ui.ConsoleView in project intellij-community by JetBrains.
the class FoldLinesLikeThis method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Editor editor = e.getData(CommonDataKeys.EDITOR);
assert editor != null;
final String selection = getSingleLineSelection(editor);
assert selection != null;
ShowSettingsUtil.getInstance().editConfigurable(editor.getProject(), new ConsoleConfigurable() {
@Override
protected boolean editFoldingsOnly() {
return true;
}
@Override
public void reset() {
super.reset();
UIUtil.invokeLaterIfNeeded(() -> addRule(selection));
}
});
final ConsoleView consoleView = e.getData(LangDataKeys.CONSOLE_VIEW);
if (consoleView instanceof ConsoleViewImpl) {
((ConsoleViewImpl) consoleView).foldImmediately();
}
}
use of com.intellij.execution.ui.ConsoleView in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method testDaemonIgnoresConsoleActivities.
public void testDaemonIgnoresConsoleActivities() throws Exception {
configureByFile(BASE_PATH + "AClass.java");
doHighlighting(HighlightSeverity.WARNING);
final ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(getProject()).getConsole();
//create editor
consoleView.getComponent();
consoleView.print("haha", ConsoleViewContentType.NORMAL_OUTPUT);
UIUtil.dispatchAllInvocationEvents();
try {
checkDaemonReaction(false, () -> {
consoleView.clear();
try {
// *&^ing alarm
Thread.sleep(300);
} catch (InterruptedException e) {
LOG.error(e);
}
//flush
UIUtil.dispatchAllInvocationEvents();
});
checkDaemonReaction(false, () -> {
consoleView.print("sss", ConsoleViewContentType.NORMAL_OUTPUT);
try {
// *&^ing alarm
Thread.sleep(300);
} catch (InterruptedException e) {
LOG.error(e);
}
//flush
UIUtil.dispatchAllInvocationEvents();
});
checkDaemonReaction(false, () -> {
consoleView.setOutputPaused(true);
try {
// *&^ing alarm
Thread.sleep(300);
} catch (InterruptedException e) {
LOG.error(e);
}
//flush
UIUtil.dispatchAllInvocationEvents();
});
} finally {
Disposer.dispose(consoleView);
}
}
use of com.intellij.execution.ui.ConsoleView in project intellij-community by JetBrains.
the class CommandLineState method execute.
@Override
@NotNull
public ExecutionResult execute(@NotNull final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException {
final ProcessHandler processHandler = startProcess();
final ConsoleView console = createConsole(executor);
if (console != null) {
console.attachToProcess(processHandler);
}
return new DefaultExecutionResult(console, processHandler, createActions(console, processHandler, executor));
}
use of com.intellij.execution.ui.ConsoleView in project intellij-community by JetBrains.
the class LogConsoleBase method doFilter.
private synchronized void doFilter() {
if (myDisposed) {
return;
}
final ConsoleView console = getConsoleNotNull();
console.clear();
myModel.processingStarted();
final String[] lines = myOriginalDocument != null ? myOriginalDocument.toString().split("\n") : ArrayUtil.EMPTY_STRING_ARRAY;
;
int offset = 0;
boolean caretPositioned = false;
for (String line : lines) {
final int printed = printMessageToConsole(line);
if (printed > 0) {
if (!caretPositioned) {
if (Comparing.strEqual(myLineUnderSelection, line)) {
caretPositioned = true;
offset += myLineOffset != -1 ? myLineOffset : 0;
} else {
offset += printed;
}
}
}
}
// we need this, because, document can change before actual scrolling, so offset may be already not at the end
if (caretPositioned) {
console.scrollTo(offset);
} else {
((ConsoleViewImpl) console).requestScrollingToEnd();
}
}
Aggregations