FilterEditor<MatchVariableConstraint> () { return new FilterEditor<>(myTable.getMatchVariable(), myTable.getConstraintChangedCallback()) { private final EditorTextField myTextField = UIUtil.createTextComponent("", myTable.getProject()); private final JLabel myTypeLabel = new JLabel(SSRBundle.message("type.label")); private final JCheckBox myHierarchyCheckBox = new JCheckBox(SSRBundle.message("within.type.hierarchy.check.box"), false); private final JCheckBox myRegexCheckBox = new JCheckBox(SSRBundle.message("regex.check.box"), false); { myRegexCheckBox.addActionListener(e -> { final FileType fileType = myRegexCheckBox.isSelected() ? RegExpFileType.INSTANCE : PlainTextFileType.INSTANCE; final Document document = UIUtil.createDocument(fileType, myTextField.getText(), myTable.getProject()); myTextField.setDocument(document); }); } private final ContextHelpLabel myHelpLabel = ContextHelpLabel.create(SSRBundle.message("type.filter.help.text")); @Override protected void layoutComponents() { final GroupLayout layout = new GroupLayout(this); setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup( layout.createParallelGroup() .addGroup( layout.createSequentialGroup() .addComponent(myTypeLabel) .addComponent(myTextField) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 1, 1) .addComponent(myHelpLabel) ) .addGroup( layout.createSequentialGroup() .addComponent(myHierarchyCheckBox) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(myRegexCheckBox) ) ); layout.setVerticalGroup( layout.createSequentialGroup() .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myTypeLabel) .addComponent(myTextField) .addComponent(myHelpLabel) ) .addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(myHierarchyCheckBox) .addComponent(myRegexCheckBox) ) ); } @Override protected void loadValues() { final boolean regex = myConstraint.isRegexExprType(); myTextField.setFileType(myShowRegex && regex ? RegExpFileType.INSTANCE : PlainTextFileType.INSTANCE); myTextField.setText((myConstraint.isInvertExprType() ? "!" : "") + (regex ? myConstraint.getNameOfExprType() : myConstraint.getExpressionTypes())); myHierarchyCheckBox.setSelected(myConstraint.isExprTypeWithinHierarchy()); myRegexCheckBox.setSelected(myShowRegex && regex); myRegexCheckBox.setVisible(myShowRegex); } @Override public void saveValues() { String text = myTextField.getText(); final boolean inverted = text.startsWith("!"); if (inverted) { text = text.substring(1); } if (myShowRegex && myRegexCheckBox.isSelected()) { myConstraint.setNameOfExprType(text); } else { myConstraint.setExpressionTypes(text); } myConstraint.setInvertExprType(inverted); myConstraint.setExprTypeWithinHierarchy(myHierarchyCheckBox.isSelected()); } @Override public JComponent getPreferredFocusedComponent() { return myTextField; } @Override public JComponent[] getFocusableComponents() { return new JComponent[]{myTextField}; } }; }