I use idea api createFileChooser as follows,but can not search the file I want, what's the problem?

Answered
PsiFile ps = PsiManager.getInstance(project).findFile(virtualFiles[0]);
TreeFileChooser.PsiFileFilter psiFileFilter = new TreeFileChooser.PsiFileFilter() {
@Override
public boolean accept(PsiFile psiFile) {
return true;
}
};
//PsiFile ps = PsiFileFactory.getInstance(project).createFileFromText("psi", StdFileTypes.CLASS,null);
TreeFileChooser fileChooser = TreeClassChooserFactory.getInstance(project).createFileChooser("选择类",ps, StdFileTypes.CLASS, psiFileFilter);
fileChooser.showDialog();


2 comments
Comment actions Permalink

You're using StdFileTypes.CLASS which refers to compiled .class files.Use com.intellij.openapi.fileTypes.StdFileTypes#JAVA for accessing .java source files.

0
Comment actions Permalink

You got my problem resolved !!!

0

Please sign in to leave a comment.