mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
speed up variables tree update: if we use Application.invokeLater there are too many tree repaints
This commit is contained in:
@@ -27,6 +27,7 @@ import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.TreeSpeedSearch;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.containers.TransferToEDTQueue;
|
||||
import com.intellij.util.ui.TextTransferable;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||
@@ -56,6 +57,8 @@ import java.util.List;
|
||||
* @author nik
|
||||
*/
|
||||
public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposable {
|
||||
private final TransferToEDTQueue<Runnable> myLaterInvocator = TransferToEDTQueue.createRunnableMerger("XDebuggerTree later invocator", 100);
|
||||
|
||||
private static final DataKey<XDebuggerTree> XDEBUGGER_TREE_KEY = DataKey.create("xdebugger.tree");
|
||||
private static final Convertor<TreePath, String> SPEED_SEARCH_CONVERTER = new Convertor<TreePath, String>() {
|
||||
@Override
|
||||
@@ -324,4 +327,8 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
|
||||
public static XDebuggerTree getTree(DataContext context) {
|
||||
return XDEBUGGER_TREE_KEY.getData(context);
|
||||
}
|
||||
|
||||
public TransferToEDTQueue<Runnable> getLaterInvocator() {
|
||||
return myLaterInvocator;
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -189,4 +189,8 @@ public abstract class XDebuggerTreeNode implements TreeNode, TreeSpeedSearch.Pat
|
||||
component.append(link.getLinkText(), link.getTextAttributes(), link);
|
||||
}
|
||||
}
|
||||
|
||||
void invokeNodeUpdate(Runnable runnable) {
|
||||
myTree.getLaterInvocator().offer(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -22,7 +22,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.SortedList;
|
||||
import com.intellij.xdebugger.frame.*;
|
||||
import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -75,7 +74,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
|
||||
|
||||
@Override
|
||||
public void addChildren(@NotNull final XValueChildrenList children, final boolean last) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
invokeNodeUpdate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myValueChildren == null) {
|
||||
@@ -125,7 +124,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
|
||||
|
||||
@Override
|
||||
public void tooManyChildren(final int remaining) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
invokeNodeUpdate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setTemporaryMessageNode(MessageTreeNode.createEllipsisNode(myTree, XValueContainerNode.this, remaining));
|
||||
@@ -162,7 +161,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
|
||||
@Override
|
||||
public void setMessage(@NotNull final String message,
|
||||
final Icon icon, @NotNull final SimpleTextAttributes attributes, @Nullable final XDebuggerTreeNodeHyperlink link) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
invokeNodeUpdate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setMessageNodes(MessageTreeNode.createMessages(myTree, XValueContainerNode.this, message, link,
|
||||
|
||||
+8
-2
@@ -94,12 +94,18 @@ public final class XValueNodePresentationConfigurator {
|
||||
node.applyPresentation(icon, presentation, hasChildren);
|
||||
}
|
||||
else {
|
||||
application.invokeLater(new Runnable() {
|
||||
Runnable updater = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
node.applyPresentation(icon, presentation, hasChildren);
|
||||
}
|
||||
});
|
||||
};
|
||||
if (node instanceof XDebuggerTreeNode) {
|
||||
((XDebuggerTreeNode)node).invokeNodeUpdate(updater);
|
||||
}
|
||||
else {
|
||||
application.invokeLater(updater);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user