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();
Please sign in to leave a comment.
You're using StdFileTypes.CLASS which refers to compiled .class files.Use com.intellij.openapi.fileTypes.StdFileTypes#JAVA for accessing .java source files.
You got my problem resolved !!!