void (SettingsStep settingsStep) { Project project = settingsStep.getContext().getProject(); FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); descriptor.setTitle(JavaUiBundle.message("prompt.select.source.directory")); mySourcePath.addBrowseFolderListener(new TextBrowseFolderListener(descriptor, project) { @NotNull @Override protected String chosenFileToResultingText(@NotNull VirtualFile chosenFile) { String contentEntryPath = myModuleBuilder.getContentEntryPath(); String path = chosenFile.getPath(); return contentEntryPath == null ? path : path.substring(StringUtil.commonPrefixLength(contentEntryPath, path)); } }); myCreateSourceRoot.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { mySourcePath.setEnabled(myCreateSourceRoot.isSelected()); } }); settingsStep.addExpertPanel(myPanel); }