class naming: description & ui tweaks

This commit is contained in:
Anna Kozlova
2017-09-15 20:56:03 +03:00
parent 9eeb75b2e8
commit a1b1a9352d
2 changed files with 6 additions and 3 deletions
@@ -37,6 +37,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.ui.CheckBoxList;
import com.intellij.ui.CheckBoxListListener;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ui.JBUI;
import com.intellij.util.xmlb.XmlSerializationException;
import com.intellij.util.xmlb.XmlSerializer;
@@ -181,11 +182,12 @@ public class NewClassNamingConventionInspection extends BaseInspection {
@Nullable
@Override
public JComponent createOptionsPanel() {
JPanel panel = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new BorderLayout(JBUI.scale(2), JBUI.scale(2)));
JPanel descriptionPanel = new JPanel(new BorderLayout());
descriptionPanel.setBorder(JBUI.Borders.empty(2));
panel.add(descriptionPanel, BorderLayout.CENTER);
CheckBoxList<NamingConvention<PsiClass>> list = new CheckBoxList<>();
list.setBorder(JBUI.Borders.empty());
for (NamingConvention<PsiClass> convention : myNamingConventions.values()) {
list.addItem(convention, convention.getElementDescription(), !myDisabledShortNames.contains(convention.getShortName()));
}
@@ -205,7 +207,7 @@ public class NewClassNamingConventionInspection extends BaseInspection {
}
});
list.setSelectedIndex(myNamingConventions.size() - 1);
panel.add(list, BorderLayout.WEST);
panel.add(new JBScrollPane(list), BorderLayout.WEST);
return panel;
}
@@ -4,7 +4,8 @@ Reports classes whose names are either too short, too long, or do not follow
the specified regular expression pattern.
<!-- tooltip end -->
<p>
Use the fields below to specify minimum length, maximum length and regular expression expected for class names.
Use list below to specify which classes should be checked. When unchecked, common class name patterns <b>won't be applied</b>.
For each class type use the fields to specify minimum length, maximum length and regular expression expected for class names.
Specify <b>0</b> to not check the length of names. Regular expressions are in standard <b>java.util.regex</b> format.
<p>