Search in sources :

Example 1 with ListWrappingTableModel

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

the class UiUtils method editTableCell.

private static void editTableCell(final ListTable table, final int row, final int column) {
    final ListSelectionModel selectionModel = table.getSelectionModel();
    selectionModel.setSelectionInterval(row, row);
    EventQueue.invokeLater(() -> {
        final ListWrappingTableModel tableModel = table.getModel();
        IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
            IdeFocusManager.getGlobalInstance().requestFocus(table, true);
        });
        final Rectangle rectangle = table.getCellRect(row, column, true);
        table.scrollRectToVisible(rectangle);
        table.editCellAt(row, column);
        final TableCellEditor editor = table.getCellEditor();
        final Component component = editor.getTableCellEditorComponent(table, tableModel.getValueAt(row, column), true, row, column);
        IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
            IdeFocusManager.getGlobalInstance().requestFocus(component, true);
        });
    });
}
Also used : TableCellEditor(javax.swing.table.TableCellEditor) ListWrappingTableModel(com.intellij.codeInspection.ui.ListWrappingTableModel)

Example 2 with ListWrappingTableModel

use of com.intellij.codeInspection.ui.ListWrappingTableModel 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 3 with ListWrappingTableModel

use of com.intellij.codeInspection.ui.ListWrappingTableModel 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 4 with ListWrappingTableModel

use of com.intellij.codeInspection.ui.ListWrappingTableModel 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 5 with ListWrappingTableModel

use of com.intellij.codeInspection.ui.ListWrappingTableModel 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)

Aggregations

ListWrappingTableModel (com.intellij.codeInspection.ui.ListWrappingTableModel)17 ListTable (com.intellij.codeInspection.ui.ListTable)14 CheckBox (com.intellij.util.ui.CheckBox)9 Nullable (org.jetbrains.annotations.Nullable)2 ClassFilter (com.intellij.ide.util.ClassFilter)1 TreeClassChooser (com.intellij.ide.util.TreeClassChooser)1 TreeClassChooserFactory (com.intellij.ide.util.TreeClassChooserFactory)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 Project (com.intellij.openapi.project.Project)1 PsiClass (com.intellij.psi.PsiClass)1 VerticalLayout (com.intellij.ui.components.panels.VerticalLayout)1 TextField (com.siyeh.ig.ui.TextField)1 TableCellEditor (javax.swing.table.TableCellEditor)1 NotNull (org.jetbrains.annotations.NotNull)1