JComponent () { final JPanel panel = new JPanel(new GridBagLayout()); final JLabel header = new JLabel(JavaBundle.message("label.class.filter.editor.add.dialog.filter.pattern")); myClassName = new TextFieldWithBrowseButton(new JTextField(35)); final JLabel iconLabel = new JLabel(Messages.getQuestionIcon()); panel.add(header, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0)); panel.add(myClassName, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0)); panel.add(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(15, 0, 0, 0), 0, 0)); myClassName.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PsiClass currentClass = getSelectedClass(); TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createNoInnerClassesScopeChooser( JavaBundle.message("class.filter.editor.choose.class.title"), GlobalSearchScope.allScope(myProject), null, null); if (currentClass != null) { PsiFile containingFile = currentClass.getContainingFile(); if (containingFile != null) { PsiDirectory containingDirectory = containingFile.getContainingDirectory(); if (containingDirectory != null) { chooser.selectDirectory(containingDirectory); } } } chooser.showDialog(); PsiClass selectedClass = chooser.getSelected(); if (selectedClass != null) { myClassName.setText(selectedClass.getQualifiedName()); } } }); myClassName.setEnabled(myProject != null); return panel; }