use of com.intellij.codeInspection.ui.RegExFormatter in project intellij-idea-plugin-connector-for-aws-lambda by satr.
the class ConnectorViewFactory method getRegexFormatterFactory.
private JFormattedTextField.AbstractFormatterFactory getRegexFormatterFactory(String pattern) {
RegExFormatter formatter = new RegExFormatter();
formatter.setAllowsInvalid(false);
return new DefaultFormatterFactory(new RegexFormatter(pattern));
}
use of com.intellij.codeInspection.ui.RegExFormatter in project intellij-community by JetBrains.
the class ClassHasNoToStringMethodInspection method createOptionsPanel.
/**
* Creates the options panel in the settings for user changeable options.
*
* @return the options panel
*/
@Override
public JComponent createOptionsPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.weightx = 0.0;
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.NONE;
panel.add(new JLabel("Exclude classes (reg exp):"), constraints);
final JFormattedTextField excludeClassNamesField = new JFormattedTextField(new RegExFormatter());
excludeClassNamesField.setValue(excludeClassNamesPattern);
excludeClassNamesField.setColumns(25);
excludeClassNamesField.setInputVerifier(new RegExInputVerifier());
excludeClassNamesField.setFocusLostBehavior(JFormattedTextField.COMMIT);
excludeClassNamesField.setMinimumSize(excludeClassNamesField.getPreferredSize());
UIUtil.fixFormattedField(excludeClassNamesField);
Document document = excludeClassNamesField.getDocument();
document.addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
try {
excludeClassNamesField.commitEdit();
excludeClassNamesPattern = (Pattern) excludeClassNamesField.getValue();
excludeClassNames = excludeClassNamesPattern.pattern();
} catch (final Exception ignore) {
}
}
});
constraints.gridx = 1;
constraints.gridy = 0;
constraints.weightx = 1.0;
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.fill = GridBagConstraints.NONE;
panel.add(excludeClassNamesField, constraints);
final CheckBox excludeExceptionCheckBox = new CheckBox("Ignore exception classes", this, "excludeException");
constraints.gridx = 0;
constraints.gridy = 1;
constraints.gridwidth = 2;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add(excludeExceptionCheckBox, constraints);
final CheckBox excludeDeprecatedCheckBox = new CheckBox("Ignore deprecated classes", this, "excludeDeprecated");
constraints.gridy = 2;
panel.add(excludeDeprecatedCheckBox, constraints);
final CheckBox excludeEnumCheckBox = new CheckBox("Ignore enum classes", this, "excludeEnum");
constraints.gridy = 3;
panel.add(excludeEnumCheckBox, constraints);
final CheckBox excludeAbstractCheckBox = new CheckBox("Ignore abstract classes", this, "excludeAbstract");
constraints.gridy = 4;
panel.add(excludeAbstractCheckBox, constraints);
final CheckBox excludeInTestCodeCheckBox = new CheckBox("Ignore test classes", this, "excludeTestCode");
constraints.gridy = 5;
panel.add(excludeInTestCodeCheckBox, constraints);
final CheckBox excludeInnerClasses = new CheckBox("Ignore inner classes", this, "excludeInnerClasses");
constraints.gridy = 6;
constraints.weighty = 1.0;
panel.add(excludeInnerClasses, constraints);
return panel;
}
Aggregations