@NonNls private static final String CONSOLE_VIEW_POPUP_MENU = "ConsoleView.PopupMenu";
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.impl.ConsoleViewImpl");
- static final int DEFAULT_FLUSH_DELAY = SystemProperties.getIntProperty("console.flush.delay.ms", 200);
+ private static final int DEFAULT_FLUSH_DELAY = SystemProperties.getIntProperty("console.flush.delay.ms", 200);
private static final CharMatcher NEW_LINE_MATCHER = CharMatcher.anyOf("\n\r");
}
}, null, DocCommandGroupId.noneGroupId(document));
}
+ return;
}
private AnalyzeStacktraceUtil() {
}
- public static void printStacktrace(@NotNull final ConsoleView consoleView, @NotNull String unscrambledTrace) {
+ public static void printStacktrace(@NotNull ConsoleView consoleView, @NotNull String unscrambledTrace) {
ApplicationManager.getApplication().assertIsDispatchThread();
- final String text = unscrambledTrace + "\n";
- final String consoleText = ((ConsoleViewImpl)consoleView).getText();
+ String text = unscrambledTrace + "\n";
+ String consoleText = ((ConsoleViewImpl)consoleView).getText();
if (!text.equals(consoleText)) {
consoleView.clear();
- // make sure other "clear" requests stuck in EDT are performed before our print next stacktrace
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- @Override
- public void run() {
- try {
- consoleView.print(text, ConsoleViewContentType.ERROR_OUTPUT);
- consoleView.scrollTo(0);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }, new Condition() {
- @Override
- public boolean value(Object o) {
- return !((ConsoleViewImpl)consoleView).isVisible();
- }
- });
+ consoleView.print(text, ConsoleViewContentType.ERROR_OUTPUT);
+ consoleView.scrollTo(0);
}
}
latch.countDown();
}, 0);
latch.await();
- UIUtil.dispatchAllInvocationEvents();
- TimeoutUtil.sleep(ConsoleViewImpl.DEFAULT_FLUSH_DELAY);
- UIUtil.dispatchAllInvocationEvents();
- assertFalse(console.hasDeferredOutput());
+ while (console.hasDeferredOutput()) {
+ UIUtil.dispatchAllInvocationEvents();
+ TimeoutUtil.sleep(5);
+ }
assertEquals("Test", console.getText());
}
UIUtil.dispatchAllInvocationEvents(); // flush 1-st clear request
latch.await();
UIUtil.dispatchAllInvocationEvents(); // flush 2-nd clear request
- TimeoutUtil.sleep(ConsoleViewImpl.DEFAULT_FLUSH_DELAY);
- UIUtil.dispatchAllInvocationEvents(); // flush print request
- // Need more investigation: sometimes console.hasDeferredOutput() is true
while (console.hasDeferredOutput()) {
- TimeoutUtil.sleep(10);
UIUtil.dispatchAllInvocationEvents();
+ TimeoutUtil.sleep(5);
}
- //uncomment the next assertion to see probably failing test
- //assertEquals("Test", console.getText());
+ assertEquals("Test", console.getText());
}
}