diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java index f0c6983775d4..4af1250e38c0 100644 --- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesDialog.java @@ -291,7 +291,7 @@ public class MoveClassesOrPackagesDialog extends RefactoringDialog { final PsiDirectory directory = itemWrapper.getDirectory(); final VirtualFile virtualFile = directory != null ? directory.getVirtualFile() : null; - append(virtualFile != null ? ProjectUtil.calcRelativeToProjectPath(virtualFile, myProject) : itemWrapper.getPresentableUrl()); + append(virtualFile != null ? ProjectUtil.calcRelativeToProjectPath(virtualFile, myProject, true, true) : itemWrapper.getPresentableUrl()); } else { setText("Leave in same source root"); diff --git a/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java b/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java index aea6b0d89375..8f9c4c822c8c 100644 --- a/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java +++ b/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java @@ -68,6 +68,13 @@ public class ProjectUtil { } public static String calcRelativeToProjectPath(final VirtualFile file, final Project project, final boolean includeFilePath) { + return calcRelativeToProjectPath(file, project, includeFilePath, false); + } + + public static String calcRelativeToProjectPath(final VirtualFile file, + final Project project, + final boolean includeFilePath, + final boolean keepModuleAlwaysOnTheLeft) { if (file instanceof VirtualFilePathWrapper) { return includeFilePath ? ((VirtualFilePathWrapper)file).getPresentablePath() : file.getName(); } @@ -84,8 +91,7 @@ public class ProjectUtil { url = "..." + url.substring(projectHomeUrl.length()); } } - final Module module = ModuleUtil.findModuleForFile(file, project); - + if (SystemInfo.isMac && file.getFileSystem() instanceof JarFileSystem) { final VirtualFile fileForJar = ((JarFileSystem)file.getFileSystem()).getVirtualFileForJar(file); if (fileForJar != null) { @@ -101,13 +107,15 @@ public class ProjectUtil { } } } - + + final Module module = ModuleUtil.findModuleForFile(file, project); if (module == null) return url; - return SystemInfo.isMac ? new StringBuffer().append(url).append(" - [").append(module.getName()).append("]").toString() : - new StringBuffer().append("[").append(module.getName()).append("] - ").append(url).toString(); + return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ? + new StringBuffer().append(url).append(" - [").append(module.getName()).append("]").toString() : + new StringBuffer().append("[").append(module.getName()).append("] - ").append(url).toString(); } - } - + } + public static String calcRelativeToProjectPath(final VirtualFile file, final Project project) { return calcRelativeToProjectPath(file, project, true); }