void () { myTargetClassEditor = new ReferenceEditorComboWithBrowseButton(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myContext.getProject()) .createWithInnerClassesScopeChooser(RefactoringBundle.message("choose.destination.class"), GlobalSearchScope.projectScope(myContext.getProject()), new ClassFilter() { @Override public boolean isAccepted(PsiClass aClass) { return aClass.getParent() instanceof GroovyFile || aClass.hasModifierProperty(PsiModifier.STATIC); } }, null); if (myTargetClass != null) { chooser.selectDirectory(myTargetClass.getContainingFile().getContainingDirectory()); } chooser.showDialog(); PsiClass aClass = chooser.getSelected(); if (aClass != null) { myTargetClassEditor.setText(aClass.getQualifiedName()); } } }, "", myContext.getProject(), true, RECENTS_KEY); myTargetClassPanel.setLayout(new BorderLayout()); myTargetClassPanel.add(myTargetClassLabel, BorderLayout.NORTH); myTargetClassPanel.add(myTargetClassEditor, BorderLayout.CENTER); Set<String> possibleClassNames = new LinkedHashSet<>(); for (final PsiElement occurrence : myContext.getOccurrences()) { final PsiClass parentClass = getParentClass(occurrence); if (parentClass != null && parentClass.getQualifiedName() != null) { possibleClassNames.add(parentClass.getQualifiedName()); } } for (String possibleClassName : possibleClassNames) { myTargetClassEditor.prependItem(possibleClassName); } if (myDefaultTargetClass != null) { myTargetClassEditor.prependItem(myDefaultTargetClass.getQualifiedName()); } myTargetClassEditor.getChildComponent().addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull DocumentEvent e) { targetClassChanged(); updateOkStatus(); // enableEnumDependant(introduceEnumConstant()); } }); }