PsiElement (@NotNull DataContext dataContext, @Nullable Module module) { PsiElement target = LangDataKeys.PASTE_TARGET_PSI_ELEMENT.getData(dataContext); if (module != null && target instanceof PsiDirectoryContainer) { final PsiDirectory[] directories = ((PsiDirectoryContainer)target).getDirectories(GlobalSearchScope.moduleScope(module)); if (directories.length == 1) { return directories[0]; } } return target; }