mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
import "Result of method call ignored" ui
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.siyeh.ig.bugs.IgnoreResultOfCallInspection.Form">
|
||||
<grid id="581e5" binding="contentPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="4" vgap="4">
|
||||
<margin top="4" left="4" bottom="4" right="4"/>
|
||||
<constraints>
|
||||
<xy x="102" y="63" width="270" height="165"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<scrollpane class="com.intellij.ui.components.JBScrollPane" id="14807">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="3" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="c2949" class="com.intellij.codeInspection.ui.ListTable" binding="table" custom-create="true">
|
||||
<constraints/>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
<component id="52926" class="javax.swing.JButton" binding="addButton">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<margin top="3" left="8" bottom="3" right="8"/>
|
||||
<text resource-bundle="com/siyeh/InspectionGadgetsBundle" key="button.add"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f6174" class="javax.swing.JButton" binding="removeButton">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<margin top="3" left="8" bottom="3" right="8"/>
|
||||
<text resource-bundle="com/siyeh/InspectionGadgetsBundle" key="button.remove"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2d492" class="javax.swing.JCheckBox" binding="nonLibraryCheckbox">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<autoscrolls value="true"/>
|
||||
<text resource-bundle="com/siyeh/InspectionGadgetsBundle" key="result.of.method.call.ignored.non.library.option"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="d5484">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -15,25 +15,28 @@
|
||||
*/
|
||||
package com.siyeh.ig.bugs;
|
||||
|
||||
import com.intellij.codeInspection.ui.AddAction;
|
||||
import com.intellij.codeInspection.ui.ListTable;
|
||||
import com.intellij.codeInspection.ui.ListWrappingTableModel;
|
||||
import com.intellij.codeInspection.ui.RemoveAction;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.util.ui.CheckBox;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import com.siyeh.ig.psiutils.LibraryUtil;
|
||||
import com.siyeh.ig.ui.ToggleAction;
|
||||
import com.siyeh.ig.ui.UiUtils;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
@@ -100,8 +103,48 @@ public class IgnoreResultOfCallInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel(){
|
||||
final Form form = new Form();
|
||||
return form.getContentPanel();
|
||||
final JPanel panel = new JPanel(new GridBagLayout());
|
||||
final ListTable table =
|
||||
new ListTable(new ListWrappingTableModel(
|
||||
Arrays.asList(classNames, methodNamePatterns),
|
||||
InspectionGadgetsBundle.message(
|
||||
"result.of.method.call.ignored.class.column.title"),
|
||||
InspectionGadgetsBundle.message(
|
||||
"result.of.method.call.ignored.method.column.title")));
|
||||
final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(table);
|
||||
final FontMetrics fontMetrics = table.getFontMetrics(table.getFont());
|
||||
scrollPane.setPreferredSize(
|
||||
new Dimension(0, fontMetrics.getHeight() * 7));
|
||||
scrollPane.setMinimumSize(
|
||||
new Dimension(0, fontMetrics.getHeight() * 3));
|
||||
|
||||
final ActionToolbar toolbar = UiUtils.createAddRemoveToolbar(table);
|
||||
|
||||
final CheckBox checkBox = new CheckBox(InspectionGadgetsBundle.message(
|
||||
"result.of.method.call.ignored.non.library.option"), this,
|
||||
"m_reportAllNonLibraryCalls");
|
||||
|
||||
final GridBagConstraints constraints = new GridBagConstraints();
|
||||
constraints.anchor = GridBagConstraints.FIRST_LINE_START;
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy = 0;
|
||||
constraints.insets.left = 4;
|
||||
constraints.insets.right = 4;
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel.add(toolbar.getComponent(), constraints);
|
||||
|
||||
constraints.gridy = 1;
|
||||
constraints.weightx = 1.0;
|
||||
constraints.weighty = 1.0;
|
||||
constraints.fill = GridBagConstraints.BOTH;
|
||||
panel.add(scrollPane, constraints);
|
||||
|
||||
constraints.gridy = 2;
|
||||
constraints.weighty = 0.0;
|
||||
constraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
panel.add(checkBox, constraints);
|
||||
panel.add(checkBox, constraints);
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,37 +231,4 @@ public class IgnoreResultOfCallInspection extends BaseInspection {
|
||||
return matcher.matches();
|
||||
}
|
||||
}
|
||||
|
||||
private class Form{
|
||||
|
||||
JPanel contentPanel;
|
||||
JButton addButton;
|
||||
JButton removeButton;
|
||||
ListTable table;
|
||||
JCheckBox nonLibraryCheckbox;
|
||||
|
||||
Form(){
|
||||
addButton.setAction(new AddAction(table));
|
||||
removeButton.setAction(new RemoveAction(table));
|
||||
nonLibraryCheckbox.setAction(new ToggleAction(
|
||||
InspectionGadgetsBundle.message(
|
||||
"result.of.method.call.ignored.non.library.option"),
|
||||
IgnoreResultOfCallInspection.this,
|
||||
"m_reportAllNonLibraryCalls"));
|
||||
nonLibraryCheckbox.setSelected(m_reportAllNonLibraryCalls);
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
table = new ListTable(new ListWrappingTableModel(
|
||||
Arrays.asList(classNames, methodNamePatterns),
|
||||
InspectionGadgetsBundle.message(
|
||||
"result.of.method.call.ignored.class.column.title"),
|
||||
InspectionGadgetsBundle.message(
|
||||
"result.of.method.call.ignored.method.column.title")));
|
||||
}
|
||||
|
||||
public JComponent getContentPanel(){
|
||||
return contentPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user