use of com.intellij.ide.util.treeView.smartTree.Group in project intellij-community by JetBrains.
the class StructureTreeBuilder method isAutoExpandNode.
@Override
protected final boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
StructureViewModel model = myStructureModel;
if (model instanceof TreeModelWrapper) {
model = ((TreeModelWrapper) model).getModel();
}
if (model instanceof StructureViewModel.ExpandInfoProvider) {
StructureViewModel.ExpandInfoProvider provider = (StructureViewModel.ExpandInfoProvider) model;
Object element = nodeDescriptor.getElement();
if (element instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
StructureViewComponent.StructureViewTreeElementWrapper wrapper = (StructureViewComponent.StructureViewTreeElementWrapper) element;
if (wrapper.getValue() instanceof StructureViewTreeElement) {
final StructureViewTreeElement value = (StructureViewTreeElement) wrapper.getValue();
if (value != null) {
return provider.isAutoExpand(value);
}
}
} else if (element instanceof GroupWrapper) {
final Group group = ((GroupWrapper) element).getValue();
for (TreeElement treeElement : group.getChildren()) {
if (treeElement instanceof StructureViewTreeElement && !provider.isAutoExpand((StructureViewTreeElement) treeElement)) {
return false;
}
}
}
}
// expand root node & its immediate children
final NodeDescriptor parent = nodeDescriptor.getParentDescriptor();
return super.isAutoExpandNode(parent == null ? nodeDescriptor : parent);
}
Aggregations