void () { 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(); } }; packageTextField = new PackageNameReferenceEditorCombo("", myProject, RECENT_KEYS, RefactoringBundle.message("choose.destination.package")); packageTextField.getChildComponent().getDocument().addDocumentListener(adapter); existingClassField = new ReferenceEditorComboWithBrowseButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()) .createWithInnerClassesScopeChooser(RefactorJBundle.message("select.wrapper.class"), GlobalSearchScope.allScope(myProject), null, null); final String classText = existingClassField.getText(); final PsiClass currentClass = JavaPsiFacade.getInstance(myProject).findClass(classText, GlobalSearchScope.allScope(myProject)); if (currentClass != null) { chooser.select(currentClass); } chooser.showDialog(); final PsiClass selectedClass = chooser.getSelected(); if (selectedClass != null) { existingClassField.setText(selectedClass.getQualifiedName()); } } }, "", myProject, true, RECENT_KEYS); existingClassField.getChildComponent().getDocument().addDocumentListener(adapter); myDestinationCb = new DestinationFolderComboBox() { @Override public String getTargetPackage() { return getPackageName(); } }; ((DestinationFolderComboBox)myDestinationCb).setData(myProject, sourceMethod.getContainingFile().getContainingDirectory(), packageTextField.getChildComponent()); }