StripTrailingSpacesFilter (@Nullable Project project, @NotNull Document document) { if (project != null) { PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document); if (file != null) { EditorConfigTrailingSpacesOptionsProvider optionsProvider = TrailingSpacesOptionsProvider.EP_NAME.findExtension(EditorConfigTrailingSpacesOptionsProvider.class); if (optionsProvider != null) { TrailingSpacesOptionsProvider.Options options = optionsProvider.getOptions(project, file.getVirtualFile()); if (options != null && Boolean.TRUE.equals(options.getStripTrailingSpaces())) { return StripTrailingSpacesFilter.ENFORCED_REMOVAL; } } } } return StripTrailingSpacesFilter.ALL_LINES; }