PsiStructureViewFactory

Hallo,
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,
Tobi.

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

        };
    }
-


public class MyJavaFileTreeElement extends JavaFileTreeElement {
    public MyJavaFileTreeElement(PsiClassOwner file) {
        super(file);
    }


    @Override
    public Collection()));
                }
            }}
            return result;


    }
}


-




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

    @Override
    public StructureViewTreeElement getRoot(){
        return new MyJavaFileTreeElement(getPsiFile());
    }
}

---
Original message URL: https://devnet.jetbrains.com/message/5560639#5560639

1 comment
Comment actions Permalink

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


0

Please sign in to leave a comment.