PsiDirectory (PsiElement[] movedElements) { PsiDirectory commonDirectory = null; for (PsiElement movedElement : movedElements) { final PsiFile containingFile = movedElement.getContainingFile(); if (containingFile != null) { final PsiDirectory containingDirectory = containingFile.getContainingDirectory(); if (containingDirectory != null) { if (commonDirectory == null) { commonDirectory = containingDirectory; } else { if (commonDirectory != containingDirectory) { return null; } } } } } if (commonDirectory != null) { return commonDirectory; } else { return null; } }