mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix "analyze stacktrace" in yet another way
This commit is contained in:
@@ -375,7 +375,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
if (myFlushAlarm.isDisposed()) return;
|
||||
cancelAllFlushRequests();
|
||||
UIUtil.invokeLaterIfNeeded(new MyClearRunnable());
|
||||
addFlushRequest(new MyClearRunnable());
|
||||
cancelHeavyAlarm();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
@@ -59,15 +60,30 @@ public class AnalyzeStacktraceUtil {
|
||||
private AnalyzeStacktraceUtil() {
|
||||
}
|
||||
|
||||
public static void printStacktrace(@NotNull ConsoleView consoleView, @NotNull String unscrambledTrace) {
|
||||
public static void printStacktrace(@NotNull final ConsoleView consoleView, @NotNull String unscrambledTrace) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
String text = unscrambledTrace + "\n";
|
||||
String consoleText = ((ConsoleViewImpl)consoleView).getText();
|
||||
final String text = unscrambledTrace + "\n";
|
||||
final String consoleText = ((ConsoleViewImpl)consoleView).getText();
|
||||
if (!text.equals(consoleText)) {
|
||||
consoleView.clear();
|
||||
consoleView.print(text, ConsoleViewContentType.ERROR_OUTPUT);
|
||||
|
||||
consoleView.scrollTo(0);
|
||||
// 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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,7 +66,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
assertEquals(2, console.getContentSize());
|
||||
}
|
||||
|
||||
public void testDoubleClear() throws Exception {
|
||||
public void testConsolePrintsSomethingAfterDoubleClear() throws Exception {
|
||||
ConsoleViewImpl console = myConsole;
|
||||
Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
@@ -81,7 +81,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
TimeoutUtil.sleep(SystemProperties.getIntProperty("console.flush.delay.ms", 200));
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
assertFalse(console.hasDeferredOutput());
|
||||
//assertEquals("Test", console.getText());
|
||||
assertEquals("Test", console.getText());
|
||||
}
|
||||
|
||||
public void testTypeInEmptyConsole() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user