void () { final PsiFile file = mySourceMethod.getContainingFile(); packageTextField = new PackageNameReferenceEditorCombo(file instanceof PsiJavaFile ? ((PsiJavaFile)file).getPackageName() : "", myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package")); final Document document = packageTextField.getChildComponent().getDocument(); final com.intellij.openapi.editor.event.DocumentListener adapter = new com.intellij.openapi.editor.event.DocumentListener() { @Override public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); } }; document.addDocumentListener(adapter); existingClassField = new ReferenceEditorComboWithBrowseButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final Project project = mySourceMethod.getProject(); final GlobalSearchScope scope = GlobalSearchScope.allScope(project); final TreeJavaClassChooserDialog chooser = new TreeJavaClassChooserDialog(RefactorJBundle.message("select.wrapper.class"), project, scope, null, null); final String classText = existingClassField.getText(); final PsiClass currentClass = JavaPsiFacade.getInstance(project).findClass(classText, GlobalSearchScope.allScope(project)); if (currentClass != null) { chooser.select(currentClass); } chooser.show(); final PsiClass selectedClass = chooser.getSelected(); if (selectedClass != null) { final String className = selectedClass.getQualifiedName(); existingClassField.setText(className); RecentsManager.getInstance(myProject).registerRecentEntry(EXISTING_KEY, className); } } }, "", myProject, true, EXISTING_KEY); existingClassField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() { @Override public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { validateButtons(); enableGenerateAccessors(); } }); myDestinationCb = new DestinationFolderComboBox() { @Override public String getTargetPackage() { return getPackageName(); } }; ((DestinationFolderComboBox)myDestinationCb).setData(myProject, mySourceMethod.getContainingFile().getContainingDirectory(), packageTextField.getChildComponent()); }