TreeElement (final PsiFile file, final StructureViewComposite.StructureViewDescriptor view) { return new StructureViewTreeElement() { @Override public Object getValue() { return view; } @Override public void navigate(boolean requestFocus) { file.navigate(requestFocus); } @Override public boolean canNavigate() { return file.canNavigate(); } @Override public boolean canNavigateToSource() { return file.canNavigateToSource(); } @Override public @NotNull ItemPresentation getPresentation() { return new ItemPresentation() { @Override public @Nullable String getPresentableText() { return view.title; } @Override public @Nullable Icon getIcon(boolean unused) { return view.icon; } }; } @Override public TreeElement @NotNull [] getChildren() { return view.structureModel.getRoot().getChildren(); } }; }