String (Object element) { if (element == DirectoryChooser.ItemWrapper.NULL) return leaveInSameSourceRoot; if (element instanceof DirectoryChooser.ItemWrapper) { final VirtualFile virtualFile = ((DirectoryChooser.ItemWrapper)element).getDirectory().getVirtualFile(); final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project); if (module != null) { return module.getName(); } } return super.getElementText(element); }