Search in sources :

Example 16 with CheckBox

use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.

the class LogStatementGuardedByLogConditionInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel classNameLabel = new JLabel(InspectionGadgetsBundle.message("logger.name.option"));
    classNameLabel.setHorizontalAlignment(SwingConstants.TRAILING);
    final TextField loggerClassNameField = new TextField(this, "loggerClassName");
    final ListTable table = new ListTable(new ListWrappingTableModel(Arrays.asList(logMethodNameList, logConditionMethodNameList), InspectionGadgetsBundle.message("log.method.name"), InspectionGadgetsBundle.message("log.condition.text")));
    panel.add(UiUtils.createAddRemovePanel(table), BorderLayout.CENTER);
    panel.add(FormBuilder.createFormBuilder().addLabeledComponent(classNameLabel, loggerClassNameField).getPanel(), BorderLayout.NORTH);
    panel.add(new CheckBox(InspectionGadgetsBundle.message("log.statement.guarded.by.log.condition.flag.all.unguarded.option"), this, "flagAllUnguarded"), BorderLayout.SOUTH);
    return panel;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox) ListTable(com.intellij.codeInspection.ui.ListTable) TextField(com.siyeh.ig.ui.TextField) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel)

Example 17 with CheckBox

use of com.intellij.util.ui.CheckBox 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;
}
Also used : Pattern(java.util.regex.Pattern) DocumentAdapter(com.intellij.ui.DocumentAdapter) Document(javax.swing.text.Document) DocumentEvent(javax.swing.event.DocumentEvent) RegExInputVerifier(com.intellij.codeInspection.ui.RegExInputVerifier) PatternSyntaxException(java.util.regex.PatternSyntaxException) RegExFormatter(com.intellij.codeInspection.ui.RegExFormatter) CheckBox(com.intellij.util.ui.CheckBox)

Example 18 with CheckBox

use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.

the class InstanceVariableUninitializedUseInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final JComponent panel = new JPanel(new GridBagLayout());
    final JPanel annotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(annotationNames, InspectionGadgetsBundle.message("ignore.if.annotated.by"));
    final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("primitive.fields.ignore.option"), this, "m_ignorePrimitives");
    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    panel.add(annotationsPanel, constraints);
    constraints.gridy = 1;
    constraints.weighty = 0.0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    panel.add(checkBox, constraints);
    return panel;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox)

Example 19 with CheckBox

use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.

the class SizeReplaceableByIsEmptyInspection method createOptionsPanel.

@Override
@Nullable
public JComponent createOptionsPanel() {
    final JComponent panel = new JPanel(new BorderLayout());
    final ListTable table = new ListTable(new ListWrappingTableModel(ignoredTypes, InspectionGadgetsBundle.message("ignored.classes.table")));
    JPanel tablePanel = UiUtils.createAddRemoveTreeClassChooserPanel(table, InspectionGadgetsBundle.message("choose.class.type.to.ignore"));
    final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("size.replaceable.by.isempty.negation.ignore.option"), this, "ignoreNegations");
    panel.add(tablePanel, BorderLayout.CENTER);
    panel.add(checkBox, BorderLayout.SOUTH);
    return panel;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox) ListTable(com.intellij.codeInspection.ui.ListTable) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel) Nullable(org.jetbrains.annotations.Nullable)

Example 20 with CheckBox

use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.

the class StaticImportInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final JComponent panel = new JPanel(new GridBagLayout());
    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    final JPanel chooserList = UiUtils.createTreeClassChooserList(allowedClasses, "Statically importable Classes", "Choose statically importable class");
    panel.add(chooserList, constraints);
    constraints.gridy = 1;
    constraints.weighty = 0.0;
    final CheckBox checkBox1 = new CheckBox(InspectionGadgetsBundle.message("ignore.single.field.static.imports.option"), this, "ignoreSingleFieldImports");
    panel.add(checkBox1, constraints);
    constraints.gridy = 2;
    final CheckBox checkBox2 = new CheckBox(InspectionGadgetsBundle.message("ignore.single.method.static.imports.option"), this, "ignoreSingeMethodImports");
    panel.add(checkBox2, constraints);
    return panel;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox)

Aggregations

CheckBox (com.intellij.util.ui.CheckBox)28 ListTable (com.intellij.codeInspection.ui.ListTable)9 ListWrappingTableModel (com.intellij.codeInspection.ui.ListWrappingTableModel)9 Nullable (org.jetbrains.annotations.Nullable)5 DocumentAdapter (com.intellij.ui.DocumentAdapter)2 NumberFormat (java.text.NumberFormat)2 DocumentEvent (javax.swing.event.DocumentEvent)2 Document (javax.swing.text.Document)2 NotNull (org.jetbrains.annotations.NotNull)2 ListEditForm (com.intellij.codeInspection.ui.ListEditForm)1 RegExFormatter (com.intellij.codeInspection.ui.RegExFormatter)1 RegExInputVerifier (com.intellij.codeInspection.ui.RegExInputVerifier)1 OnePixelSplitter (com.intellij.ui.OnePixelSplitter)1 VerticalLayout (com.intellij.ui.components.panels.VerticalLayout)1 GridBag (com.intellij.util.ui.GridBag)1 TextField (com.siyeh.ig.ui.TextField)1 ParseException (java.text.ParseException)1 Pattern (java.util.regex.Pattern)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1