use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.
the class IfCanBeSwitchInspection method createOptionsPanel.
@Override
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final JLabel label = new JLabel(InspectionGadgetsBundle.message("if.can.be.switch.minimum.branch.option"));
final NumberFormat formatter = NumberFormat.getIntegerInstance();
formatter.setParseIntegerOnly(true);
final JFormattedTextField valueField = new JFormattedTextField(formatter);
valueField.setValue(Integer.valueOf(minimumBranches));
valueField.setColumns(2);
final Document document = valueField.getDocument();
document.addDocumentListener(new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent e) {
try {
valueField.commitEdit();
minimumBranches = ((Number) valueField.getValue()).intValue();
} catch (ParseException ignore) {
// No luck this time
}
}
});
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.insets.bottom = 4;
constraints.weightx = 0.0;
constraints.anchor = GridBagConstraints.BASELINE_LEADING;
constraints.fill = GridBagConstraints.NONE;
constraints.insets.right = 10;
panel.add(label, constraints);
constraints.gridx = 1;
constraints.gridy = 0;
constraints.weightx = 1.0;
constraints.insets.right = 0;
panel.add(valueField, constraints);
constraints.gridx = 0;
constraints.gridy = 1;
constraints.gridwidth = 2;
final CheckBox checkBox1 = new CheckBox(InspectionGadgetsBundle.message("if.can.be.switch.int.option"), this, "suggestIntSwitches");
panel.add(checkBox1, constraints);
constraints.gridy = 2;
final CheckBox checkBox2 = new CheckBox(InspectionGadgetsBundle.message("if.can.be.switch.enum.option"), this, "suggestEnumSwitches");
panel.add(checkBox2, constraints);
constraints.gridy = 3;
constraints.weighty = 1.0;
final CheckBox checkBox3 = new CheckBox(InspectionGadgetsBundle.message("if.can.be.switch.null.safe.option"), this, "onlySuggestNullSafe");
panel.add(checkBox3, constraints);
return panel;
}
use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.
the class AutoCloseableResourceInspection method createOptionsPanel.
@NotNull
@Override
public JComponent createOptionsPanel() {
final JComponent panel = new JPanel(new VerticalLayout(2));
final ListTable table = new ListTable(new ListWrappingTableModel(ignoredTypes, InspectionGadgetsBundle.message("ignored.autocloseable.types.column.label")));
final JPanel tablePanel = UiUtils.createAddRemoveTreeClassChooserPanel(table, InspectionGadgetsBundle.message("choose.autocloseable.type.to.ignore.title"), "java.lang.AutoCloseable");
final ListTable table2 = new ListTable(new ListWrappingTableModel(Arrays.asList(myMethodMatcher.getClassNames(), myMethodMatcher.getMethodNamePatterns()), InspectionGadgetsBundle.message("result.of.method.call.ignored.class.column.title"), InspectionGadgetsBundle.message("method.name.regex"))) {
@Override
public void setEnabled(boolean enabled) {
// hack to display correctly on initial opening of
// inspection settings (otherwise it is always enabled)
super.setEnabled(enabled && !ignoreFromMethodCall);
}
};
final JPanel tablePanel2 = UiUtils.createAddRemoveTreeClassChooserPanel(table2, "Choose class");
final JPanel wrapperPanel = new JPanel(new BorderLayout());
wrapperPanel.setBorder(IdeBorderFactory.createTitledBorder("Ignore AutoCloseable instances returned from these methods", false));
wrapperPanel.add(tablePanel2);
panel.add(tablePanel);
panel.add(wrapperPanel);
final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("auto.closeable.resource.returned.option"), this, "ignoreFromMethodCall");
checkBox.addChangeListener(e -> table2.setEnabled(!ignoreFromMethodCall));
panel.add(checkBox);
panel.add(new CheckBox(InspectionGadgetsBundle.message("any.method.may.close.resource.argument"), this, "anyMethodMayClose"));
return panel;
}
use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.
the class SerializableInspectionUtil method createOptions.
@NotNull
public static JComponent createOptions(@NotNull SerializableInspectionBase inspection) {
final JComponent panel = new JPanel(new GridBagLayout());
final JPanel chooserList = UiUtils.createTreeClassChooserList(inspection.superClassList, InspectionGadgetsBundle.message("ignore.classes.in.hierarchy.column.name"), InspectionGadgetsBundle.message("choose.super.class.to.ignore"));
UiUtils.setComponentSize(chooserList, 7, 25);
final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("ignore.anonymous.inner.classes"), inspection, "ignoreAnonymousInnerClasses");
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(chooserList, constraints);
final JComponent[] additionalOptions = inspection.createAdditionalOptions();
for (JComponent additionalOption : additionalOptions) {
constraints.gridy++;
if (additionalOption instanceof JPanel) {
constraints.fill = GridBagConstraints.BOTH;
constraints.weighty = 1.0;
} else {
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weighty = 0.0;
}
panel.add(additionalOption, constraints);
}
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridy++;
constraints.weighty = 0.0;
panel.add(checkBox, constraints);
return panel;
}
use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.
the class PublicMethodNotExposedInInterfaceInspection method createOptionsPanel.
@Override
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final JPanel annotationsListControl = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(ignorableAnnotations, InspectionGadgetsBundle.message("ignore.if.annotated.by"));
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.weighty = 1.0;
constraints.weightx = 1.0;
constraints.anchor = GridBagConstraints.CENTER;
constraints.fill = GridBagConstraints.BOTH;
panel.add(annotationsListControl, constraints);
final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("public.method.not.in.interface.option"), this, "onlyWarnIfContainingClassImplementsAnInterface");
constraints.gridy = 1;
constraints.weighty = 0.0;
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
panel.add(checkBox, constraints);
return panel;
}
use of com.intellij.util.ui.CheckBox in project intellij-community by JetBrains.
the class IgnoreResultOfCallInspection method createOptionsPanel.
@Override
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new BorderLayout());
final ListTable table = new ListTable(new ListWrappingTableModel(Arrays.asList(myMethodMatcher.getClassNames(), myMethodMatcher.getMethodNamePatterns()), InspectionGadgetsBundle.message("result.of.method.call.ignored.class.column.title"), InspectionGadgetsBundle.message("result.of.method.call.ignored.method.column.title")));
final JPanel tablePanel = UiUtils.createAddRemoveTreeClassChooserPanel(table, "Choose class");
final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message("result.of.method.call.ignored.non.library.option"), this, "m_reportAllNonLibraryCalls");
panel.add(tablePanel, BorderLayout.CENTER);
panel.add(checkBox, BorderLayout.SOUTH);
return panel;
}
Aggregations