minor UI changes to unused declaration (IDEA-160972)

This commit is contained in:
Anna Kozlova
2016-09-12 14:40:05 +03:00
parent dc37f19e2b
commit 3539146b98
4 changed files with 14 additions and 25 deletions
@@ -24,14 +24,13 @@ import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.InputValidatorEx;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.ex.MultiLineLabel;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiNameHelper;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.ui.*;
import com.intellij.ui.table.JBTable;
import com.intellij.util.IconUtil;
import com.intellij.util.ui.ItemRemovable;
import com.intellij.util.ui.JBDimension;
import com.intellij.util.ui.UIUtil;
@@ -51,7 +50,6 @@ class ClassPatternsPanel extends JPanel {
super(new BorderLayout());
myModifiedPatterns = patterns;
myTable = createTableForPatterns();
final String addPatternMessage = "Add Class Name Pattern";
final String addClassMessage = "Add Class";
final ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(myTable)
.setAddAction(new AnActionButtonRunnable() {
@@ -69,18 +67,6 @@ class ClassPatternsPanel extends JPanel {
}
})
.setAddActionName(addClassMessage)
.setAddIcon(IconUtil.getAddClassIcon())
.addExtraAction(new AnActionButton(addPatternMessage, IconUtil.getAddPatternIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
final PsiNameHelper nameHelper = PsiNameHelper.getInstance(e.getProject());
String selectedPattern = Messages.showInputDialog("Pattern:", "Class Name Pattern", Messages.getQuestionIcon(), null,
new ClassPatternValidator(nameHelper));
if (selectedPattern != null) {
insertRow(selectedPattern);
}
}
})
.setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
@@ -93,10 +79,11 @@ class ClassPatternsPanel extends JPanel {
public boolean isEnabled(AnActionEvent e) {
return myTable.getSelectedRow() >= 0;
}
})
.setButtonComparator(addClassMessage, addPatternMessage, "Remove");
});
add(SeparatorFactory.createSeparator("Mark code as entry point if qualified name matches", null), BorderLayout.NORTH);
add(toolbarDecorator.createPanel(), BorderLayout.CENTER);
add(new MultiLineLabel("Leave method blank to represent constructors\n" +
"Any * will match against one ore more characters in the qualified name (including dots)"), BorderLayout.SOUTH);
setPreferredSize(new JBDimension(-1, 250));
}
@@ -124,7 +111,7 @@ class ClassPatternsPanel extends JPanel {
int row,
int column) {
final Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (!hasFocus && !isSelected && value instanceof String && ((String)value).isEmpty()) {
if (value instanceof String && ((String)value).isEmpty()) {
setText("constructors");
setForeground(UIUtil.getInactiveTextColor());
}
@@ -55,7 +55,7 @@ public class EntryPointsManagerImpl extends EntryPointsManagerBase implements Pe
final List<String> writeList = new ArrayList<>(myWriteAnnotations);
final JPanel listPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(list, "Mark as entry point if annotated by", true);
final JPanel writeAnnotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(writeList, "Mark field as implicitly write if annotated by", false);
final JPanel writtenAnnotationsPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(writeList, "Mark field as implicitly written if annotated by", false);
new DialogWrapper(myProject) {
{
init();
@@ -66,7 +66,7 @@ public class EntryPointsManagerImpl extends EntryPointsManagerBase implements Pe
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new VerticalFlowLayout());
panel.add(listPanel);
panel.add(writeAnnotationsPanel);
panel.add(writtenAnnotationsPanel);
return panel;
}
@@ -4,7 +4,6 @@ This inspection points out the cases where a variable value
is never used after its assignment, i.e.: <br>
&nbsp;- the variable never gets read after assignment OR <br>
&nbsp;- the value is always overwritten with another assignment before the next variable read OR <br>
&nbsp;- the variable initializer is redundant (for one of the above two reasons) OR <br>
&nbsp;- the variable is never used.
&nbsp;- the variable initializer is redundant (for one of the above two reasons)
</body>
</html>
@@ -2,10 +2,13 @@
<body>
This inspection reports classes, methods or fields in the specified inspection scope that
are not used or not reachable from entry points. It also reports parameters that are not used by their methods and all method
implementations/overriders.
In editor, it also detects local variables that are declared but not used as well as private members that are never accessed for reading or not initialized in a class.<br> <br>
implementations/overriders and local variables that are declared but not used.<br> <br>
<!-- tooltip end -->
Use visibility settings below to configure what members should be reported, e.g. configuring report private methods only means
that public methods of private inner class would be reported though protected methods of top level class would be ignored.
<br>
Use check boxes in the inspection options below, to specify what should be automatically assumed entry points. You will
also have a possibility to add entry points manually when inspection results are ready.
also have a possibility to add entry points manually when inspection results are ready. You may also configure annotations to mark members as entry points as well
as code patterns.
</body>
</html>