boolean (@NotNull VirtualFile vFile) { if (FileTypeRegistry.getInstance().isFileOfType(vFile, JavaClassFileType.INSTANCE)) { // See IDEADEV-5626 VirtualFile root = ProjectRootManager.getInstance(myManager.getProject()).getFileIndex().getClassRootForFile(vFile); VirtualFile parent = vFile.getParent(); PsiNameHelper nameHelper = PsiNameHelper.getInstance(myManager.getProject()); while (parent != null && !Comparing.equal(parent, root)) { if (!nameHelper.isIdentifier(parent.getName())) return false; parent = parent.getParent(); } } return true; }