PsiDirectory (PsiElement initialTargetElement, final PsiElement[] movedElements) { PsiDirectory initialTargetDirectory = getContainerDirectory(initialTargetElement); if (initialTargetDirectory == null) { if (movedElements != null) { final PsiDirectory commonDirectory = getCommonDirectory(movedElements); if (commonDirectory != null) { initialTargetDirectory = commonDirectory; } else { initialTargetDirectory = getContainerDirectory(movedElements[0]); } } } return initialTargetDirectory; }