use of com.intellij.openapi.externalSystem.service.internal.ExternalSystemExecuteTaskTask in project intellij-community by JetBrains.
the class GradleTestsExecutionConsoleManager method attachExecutionConsole.
@NotNull
@Override
public GradleTestsExecutionConsole attachExecutionConsole(@NotNull final ExternalSystemTask task, @NotNull final Project project, @NotNull final ExternalSystemRunConfiguration configuration, @NotNull final Executor executor, @NotNull final ExecutionEnvironment env, @NotNull final ProcessHandler processHandler) throws ExecutionException {
final GradleConsoleProperties consoleProperties = new GradleConsoleProperties(configuration, executor);
String testFrameworkName = configuration.getSettings().getExternalSystemId().getReadableName();
String splitterPropertyName = SMTestRunnerConnectionUtil.getSplitterPropertyName(testFrameworkName);
final GradleTestsExecutionConsole consoleView = new GradleTestsExecutionConsole(consoleProperties, splitterPropertyName);
consoleView.initTaskExecutionView(project, processHandler, task.getId());
SMTestRunnerConnectionUtil.initConsoleView(consoleView, testFrameworkName);
consoleView.attachToProcess(processHandler);
final TestTreeView testTreeView = consoleView.getResultsViewer().getTreeView();
if (testTreeView != null) {
TestTreeRenderer originalRenderer = ObjectUtils.tryCast(testTreeView.getCellRenderer(), TestTreeRenderer.class);
if (originalRenderer != null) {
originalRenderer.setAdditionalRootFormatter(new SMRootTestProxyFormatter() {
@Override
public void format(@NotNull SMTestProxy.SMRootTestProxy testProxy, @NotNull TestTreeRenderer renderer) {
final TestStateInfo.Magnitude magnitude = testProxy.getMagnitudeInfo();
if (magnitude == TestStateInfo.Magnitude.RUNNING_INDEX) {
renderer.clear();
renderer.append(GradleBundle.message("gradle.test.runner.ui.tests.tree.presentation.labels.waiting.tests"), SimpleTextAttributes.REGULAR_ATTRIBUTES);
} else if (!testProxy.isInProgress() && testProxy.isEmptySuite()) {
renderer.clear();
renderer.append(GradleBundle.message("gradle.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found"), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
}
}
if (task instanceof ExternalSystemExecuteTaskTask) {
final ExternalSystemExecuteTaskTask executeTask = (ExternalSystemExecuteTaskTask) task;
if (executeTask.getArguments() == null || !StringUtil.contains(executeTask.getArguments(), "--tests")) {
executeTask.appendArguments("--tests *");
}
}
return consoleView;
}
Aggregations