VirtualFilePattern (final FileType type) { // Avoid capturing FileType instance if plugin providing the file type is unloaded String fileTypeName = type.getName(); return with(new PatternCondition<VirtualFile>("ofType") { @Override public boolean accepts(final @NotNull VirtualFile virtualFile, final ProcessingContext context) { return virtualFile.getFileType().getName().equals(fileTypeName); } }); }