InspectionGadgetsFix (Object... infos) { final PsiJavaFile file = (PsiJavaFile)infos[0]; final String fileName = file.getName(); final int prefixIndex = fileName.indexOf('.'); final String filenameWithoutPrefix = fileName.substring(0, prefixIndex); final PsiClass[] classes = file.getClasses(); for (PsiClass psiClass : classes) { final String className = psiClass.getName(); if (filenameWithoutPrefix.equals(className)) { return null; } } return new RenameFix(filenameWithoutPrefix); }