use of com.jetbrains.edu.learning.ui.StudyTestResultsToolWindowFactory in project intellij-community by JetBrains.
the class StudyCheckUtils method showTestResultsToolWindow.
public static void showTestResultsToolWindow(@NotNull final Project project, @NotNull final String message, boolean solved) {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
if (window == null) {
toolWindowManager.registerToolWindow(StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
}
final Content[] contents = window.getContentManager().getContents();
for (Content content : contents) {
final JComponent component = content.getComponent();
if (component instanceof ConsoleViewImpl) {
((ConsoleViewImpl) component).clear();
if (!solved) {
((ConsoleViewImpl) component).print(message, ConsoleViewContentType.ERROR_OUTPUT);
} else {
((ConsoleViewImpl) component).print(message, ConsoleViewContentType.NORMAL_OUTPUT);
}
window.setAvailable(true, () -> {
});
window.show(() -> {
});
return;
}
}
}
Aggregations