@Override
public void prepareMovedFile(PsiFile file, PsiDirectory moveDestination, Map<PsiElement, PsiElement> oldToNewMap) {
file.putUserData(ORIGINAL_PACKAGE_NAME, ((PerlFileImpl)file).getFilePackageName());
String newFilePath = moveDestination.getVirtualFile().getPath() + '/' + file.getName();
VirtualFile newClassRoot = PerlUtil.getFileClassRoot(moveDestination.getProject(), newFilePath);
if (newClassRoot != null) {
String newRelativePath = newFilePath.substring(newClassRoot.getPath().length());
String newPackageName = PerlPackageUtil.getPackageNameByPath(newRelativePath);
if (newPackageName != null) {
for (PsiReference reference : ReferencesSearch.search(file, file.getUseScope()).findAll()) {
PerlPsiUtil.renameElement(reference.getElement(), newPackageName);
}
}
}
}