TargetDirectoryWrapper (final PsiDirectory dir) { final VirtualFile vFile = dir.getVirtualFile(); final VirtualFile sourceRoot = index.getSourceRootForFile(vFile); LOG.assertTrue(sourceRoot != null, vFile.getPath()); return new TargetDirectoryWrapper(dir.getManager().findDirectory(sourceRoot), newName.replaceAll("\\.", "\\/")); }