ItemPresentation (@NotNull PsiJavaModule item) { return new ItemPresentation() { @Override public String getPresentableText() { return item.getName(); } @Override public @Nullable String getLocationString() { VirtualFile file = PsiImplUtil.getModuleVirtualFile(item); FileIndexFacade index = FileIndexFacade.getInstance(item.getProject()); if (index.isInLibraryClasses(file)) { Matcher matcher = JAR_NAME.matcher(file.getPath()); if (matcher.find()) { return matcher.group(1); } } else if (index.isInSource(file)) { Module module = index.getModuleForFile(file); if (module != null) { return '[' + module.getName() + ']'; } } return null; } @Override public Icon getIcon(boolean unused) { return IconManager.getInstance().getPlatformIcon(item instanceof LightJavaModule ? PlatformIcons.ArchiveFileType : PlatformIcons.JavaModule); } }; }