use of com.intellij.ide.structureView.newStructureView.StructureViewComponent in project intellij-community by JetBrains.
the class DomStructureViewBuilder method createStructureView.
@Override
@NotNull
public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project) {
return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor) fileEditor).getEditor() : null), project, true) {
@Override
public AsyncResult<AbstractTreeNode> expandPathToElement(final Object element) {
if (element instanceof XmlElement && ((XmlElement) element).isValid()) {
final XmlElement xmlElement = (XmlElement) element;
XmlTag tag = PsiTreeUtil.getParentOfType(xmlElement, XmlTag.class, false);
while (tag != null) {
final DomElement domElement = DomManager.getDomManager(xmlElement.getProject()).getDomElement(tag);
if (domElement != null) {
for (DomElement curElement = domElement; curElement != null; curElement = curElement.getParent()) {
if (myDescriptor.fun(curElement) == DomService.StructureViewMode.SHOW) {
return super.expandPathToElement(curElement.getXmlElement());
}
}
}
tag = PsiTreeUtil.getParentOfType(tag, XmlTag.class, true);
}
}
return super.expandPathToElement(element);
}
};
}
Aggregations