CreateClassOrPackageFix (@NotNull final String qualifiedName, @NotNull final GlobalSearchScope scope, @NotNull final PsiElement context, @Nullable final PsiPackage basePackage, @Nullable ClassKind kind, @Nullable String superClass, @Nullable String templateName) { final List<PsiDirectory> directories = getWritableDirectoryListDefault(basePackage, scope, context.getManager()); if (directories.isEmpty()) { return null; } final String redPart = basePackage == null ? qualifiedName : qualifiedName.substring(basePackage.getQualifiedName().length() + 1); final int dot = redPart.indexOf('.'); final boolean fixPath = dot >= 0; final String firstRedName = fixPath ? redPart.substring(0, dot) : redPart; directories.removeIf(directory -> !checkCreateClassOrPackage(kind != null && !fixPath, directory, firstRedName)); return new CreateClassOrPackageFix(directories, context, fixPath ? qualifiedName : redPart, redPart, kind, superClass, templateName); }