diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/ClassTreeNode.java b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/ClassTreeNode.java index a92c1cd0670d..92118bb0da68 100644 --- a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/ClassTreeNode.java +++ b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/ClassTreeNode.java @@ -12,7 +12,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.ElementPresentationUtil; import com.intellij.psi.impl.source.jsp.jspJava.JspClass; -import com.intellij.util.SlowOperations; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -172,7 +171,8 @@ public class ClassTreeNode extends BasePsiMemberNode { @Override public boolean canRepresent(final Object element) { - return SlowOperations.allowSlowOperations(() -> canRepresentInner(element)); + if (!isValid()) return false; + return super.canRepresent(element) || canRepresent(getValue(), element); } private boolean canRepresentInner(final Object element) { diff --git a/platform/platform-impl/src/com/intellij/ui/tree/AbstractTreeNodeVisitor.java b/platform/platform-impl/src/com/intellij/ui/tree/AbstractTreeNodeVisitor.java index f5a4680b6bfd..f4f5afc58f83 100644 --- a/platform/platform-impl/src/com/intellij/ui/tree/AbstractTreeNodeVisitor.java +++ b/platform/platform-impl/src/com/intellij/ui/tree/AbstractTreeNodeVisitor.java @@ -1,8 +1,9 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ui.tree; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.util.SlowOperations; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -94,7 +95,7 @@ public abstract class AbstractTreeNodeVisitor implements TreeVisitor { * @return {@code true} if the specified node represents the given element */ protected boolean matches(@NotNull AbstractTreeNode node, @NotNull T element) { - return node.canRepresent(element); + return SlowOperations.allowSlowOperations(() -> node.canRepresent(element)); } /**