mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
build structure view nodes in background (with registry option to switch off)
This commit is contained in:
+3
-1
@@ -38,6 +38,7 @@ import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.SimpleToolWindowPanel;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
@@ -116,7 +117,8 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
|
||||
|
||||
@Override
|
||||
public boolean isToBuildChildrenInBackground(final Object element) {
|
||||
return getRootElement() == element;
|
||||
return Registry.is("ide.structureView.StructureViewTreeStructure.BuildChildrenInBackground") ||
|
||||
getRootElement() == element;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
@@ -19,6 +19,7 @@ import com.intellij.ide.structureView.StructureViewExtension;
|
||||
import com.intellij.ide.structureView.StructureViewFactoryEx;
|
||||
import com.intellij.ide.structureView.StructureViewTreeElement;
|
||||
import com.intellij.ide.structureView.customRegions.CustomRegionStructureUtil;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeUi;
|
||||
import com.intellij.ide.util.treeView.NodeDescriptorProvidingKey;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.util.Iconable;
|
||||
@@ -99,6 +100,11 @@ public abstract class PsiTreeElementBase <T extends PsiElement> implements Struc
|
||||
@NotNull
|
||||
@Override
|
||||
public final StructureViewTreeElement[] getChildren() {
|
||||
return AbstractTreeUi.calculateYieldingToWriteAction(this::doGetChildren);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StructureViewTreeElement[] doGetChildren() {
|
||||
final T element = getElement();
|
||||
if (element == null) return EMPTY_ARRAY;
|
||||
List<StructureViewTreeElement> result = new ArrayList<>();
|
||||
|
||||
+8
-2
@@ -19,6 +19,7 @@ package com.intellij.ide.util.treeView.smartTree;
|
||||
import com.intellij.ide.structureView.impl.StructureViewElementWrapper;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import gnu.trove.THashMap;
|
||||
@@ -47,8 +48,13 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V
|
||||
|
||||
private void ensureChildrenAreInitialized() {
|
||||
if (myChildren == null) {
|
||||
myChildren = new ArrayList<>();
|
||||
rebuildSubtree();
|
||||
try {
|
||||
myChildren = new ArrayList<>();
|
||||
rebuildSubtree();
|
||||
} catch (ProcessCanceledException pce) {
|
||||
myChildren = null;
|
||||
throw pce;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
<orderEntry type="module" module-name="icons" />
|
||||
<orderEntry type="library" name="automaton" level="project" />
|
||||
<orderEntry type="module" module-name="projectModel-api" exported="" />
|
||||
<orderEntry type="module" module-name="platform-api" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1069,6 +1069,8 @@ ide.abstractTreeUi.BuildChildrenInBackgroundYieldingToWriteAction=true
|
||||
ide.abstractTreeUi.BuildChildrenInBackgroundYieldingToWriteAction.description=Temporary ability to control a interruptible tree building
|
||||
ide.projectView.PackageViewTreeStructure.BuildChildrenInBackground=true
|
||||
ide.projectView.PackageViewTreeStructure.BuildChildrenInBackground.description=Temporary ability to control a tree building for the Package View pane
|
||||
ide.structureView.StructureViewTreeStructure.BuildChildrenInBackground=true
|
||||
ide.structureView.StructureViewTreeStructure.BuildChildrenInBackground.description=Temporary ability to control a tree building for the Structure View pane
|
||||
|
||||
ide.projectView.show.visibility=false
|
||||
ide.projectView.show.visibility.description=Shows visibility icon in Project View nodes
|
||||
|
||||
Reference in New Issue
Block a user