boolean (@NotNull Project project, Editor editor, PsiFile file) { if (!(file instanceof PsiJavaFile)) { return false; } if (ApplicationManager.getApplication().isDispatchThread() && myOnTheFly && !timeToOptimizeImports(file, myInContent, extensionsAllowToChangeFileSilently)) { return false; } VirtualFile virtualFile = file.getViewProvider().getVirtualFile(); return myInContent || ScratchUtil.isScratch(virtualFile) || virtualFile.getFileSystem() instanceof NonPhysicalFileSystem; }