I tried to modify the StructureView, so it only contains files that contain "test".
I defined my own Factory, a Model, and an Element.(See Code bellow). I also registered it in the plugin.xml.
However when i run the Code in the Debugger and set an breakpoint in the constructor of the Factory class, it shows that my code is never reached.
Can somone tell my why it isnt working?

Thank you for your help,

public class SimpleStructureViewFactory implements PsiStructureViewFactory {
    public StructureViewBuilder getStructureViewBuilder(PsiFile psiFile) {
        if(!(psiFile instanceof PsiJavaFile)) return null;
        return new TreeBasedStructureViewBuilder() {
            public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
                return new MyJavaFileTreeModel((PsiJavaFile)psiFile,editor);


public class MyJavaFileTreeElement extends JavaFileTreeElement {
    public MyJavaFileTreeElement(PsiClassOwner file) {

    public Collection()));
            return result;



public class MyJavaFileTreeModel extends JavaFileTreeModel {
    public MyJavaFileTreeModel(PsiClassOwner file, Editor editor) {
        super(file, editor);

    public StructureViewTreeElement getRoot(){
        return new MyJavaFileTreeElement(getPsiFile());

Original message URL:

1 comment
Comment actions Permalink

Sry for posting it twice. I cant delete this post.


Please sign in to leave a comment.