Search in sources :

Example 1 with ListTable

use of com.intellij.codeInspection.ui.ListTable 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;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox) ListTable(com.intellij.codeInspection.ui.ListTable) VerticalLayout(com.intellij.ui.components.panels.VerticalLayout) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with ListTable

use of com.intellij.codeInspection.ui.ListTable 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;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox) ListTable(com.intellij.codeInspection.ui.ListTable) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel)

Example 3 with ListTable

use of com.intellij.codeInspection.ui.ListTable in project intellij-community by JetBrains.

the class MalformedFormatStringInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    ListWrappingTableModel classTableModel = new ListWrappingTableModel(classNames, InspectionGadgetsBundle.message("string.format.class.column.name"));
    JPanel classChooserPanel = UiUtils.createAddRemoveTreeClassChooserPanel(new ListTable(classTableModel), InspectionGadgetsBundle.message("string.format.choose.class"));
    ListWrappingTableModel methodTableModel = new ListWrappingTableModel(methodNames, InspectionGadgetsBundle.message("string.format.class.method.name"));
    JPanel methodPanel = UiUtils.createAddRemovePanel(new ListTable(methodTableModel));
    final JPanel panel = new JPanel();
    BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.Y_AXIS);
    panel.setLayout(boxLayout);
    panel.add(classChooserPanel);
    panel.add(methodPanel);
    return panel;
}
Also used : ListTable(com.intellij.codeInspection.ui.ListTable) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel)

Example 4 with ListTable

use of com.intellij.codeInspection.ui.ListTable in project intellij-community by JetBrains.

the class MismatchedCollectionQueryUpdateInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final ListTable queryNamesTable = new ListTable(new ListWrappingTableModel(queryNames, InspectionGadgetsBundle.message("query.column.name")));
    final JPanel queryNamesPanel = UiUtils.createAddRemovePanel(queryNamesTable);
    final ListTable updateNamesTable = new ListTable(new ListWrappingTableModel(updateNames, InspectionGadgetsBundle.message("update.column.name")));
    final JPanel updateNamesPanel = UiUtils.createAddRemovePanel(updateNamesTable);
    final ListTable ignoredClassesTable = new ListTable(new ListWrappingTableModel(ignoredClasses, InspectionGadgetsBundle.message("ignored.class.names")));
    final JPanel ignoredClassesPanel = UiUtils.createAddRemovePanel(ignoredClassesTable);
    final JPanel namesPanel = new JPanel(new GridLayout(1, 2, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
    namesPanel.add(queryNamesPanel);
    namesPanel.add(updateNamesPanel);
    final JPanel panel = new JPanel(new GridLayout(2, 1, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
    panel.add(namesPanel);
    panel.add(ignoredClassesPanel);
    return panel;
}
Also used : ListTable(com.intellij.codeInspection.ui.ListTable) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel)

Example 5 with ListTable

use of com.intellij.codeInspection.ui.ListTable in project intellij-community by JetBrains.

the class BadExceptionDeclaredInspection method createOptionsPanel.

@Override
public JComponent createOptionsPanel() {
    final JComponent panel = new JPanel(new GridBagLayout());
    final ListTable table = new ListTable(new ListWrappingTableModel(exceptions, InspectionGadgetsBundle.message("exception.class.column.name")));
    final JPanel tablePanel = UiUtils.createAddRemoveTreeClassChooserPanel(table, InspectionGadgetsBundle.message("choose.exception.class"), "java.lang.Throwable");
    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(tablePanel, constraints);
    final CheckBox checkBox2 = new CheckBox(InspectionGadgetsBundle.message("ignore.exceptions.declared.on.library.override.option"), this, "ignoreLibraryOverrides");
    constraints.weighty = 0.0;
    constraints.gridy = 1;
    panel.add(checkBox2, constraints);
    return panel;
}
Also used : CheckBox(com.intellij.util.ui.CheckBox) ListTable(com.intellij.codeInspection.ui.ListTable) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel)

Aggregations

ListTable (com.intellij.codeInspection.ui.ListTable)14 ListWrappingTableModel (com.intellij.codeInspection.ui.ListWrappingTableModel)14 CheckBox (com.intellij.util.ui.CheckBox)9 Nullable (org.jetbrains.annotations.Nullable)2 VerticalLayout (com.intellij.ui.components.panels.VerticalLayout)1 TextField (com.siyeh.ig.ui.TextField)1 NotNull (org.jetbrains.annotations.NotNull)1