CodeStyleSettings (@NotNull Project project, @NotNull Document document) { PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document); return file != null ? getSettings(file) : getSettings(project); }