diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/DeadCodeInspection.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/DeadCodeInspection.java
index fe9931a3c387..fd9fca255d87 100644
--- a/java/java-impl/src/com/intellij/codeInspection/deadCode/DeadCodeInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/DeadCodeInspection.java
@@ -10,6 +10,7 @@
package com.intellij.codeInspection.deadCode;
import com.intellij.ExtensionPoints;
+import com.intellij.ui.SeparatorFactory;
import com.intellij.analysis.AnalysisScope;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.daemon.GroupNames;
@@ -40,7 +41,6 @@ import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.util.PsiMethodUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
-import com.intellij.ui.ScrollPaneFactory;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashMap;
import com.intellij.util.text.CharArrayUtil;
@@ -148,15 +148,17 @@ public class DeadCodeInspection extends FilteringInspectionTool {
add(myServletToEntries, gc);
for (final UnusedCodeExtension extension : myExtensions) {
- final JCheckBox extCheckbox = new JCheckBox(extension.getDisplayName());
- extCheckbox.setSelected(extension.isSelected());
- extCheckbox.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- extension.setSelected(extCheckbox.isSelected());
- }
- });
- gc.gridy++;
- add(extCheckbox, gc);
+ if (extension.showUI()) {
+ final JCheckBox extCheckbox = new JCheckBox(extension.getDisplayName());
+ extCheckbox.setSelected(extension.isSelected());
+ extCheckbox.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ extension.setSelected(extCheckbox.isSelected());
+ }
+ });
+ gc.gridy++;
+ add(extCheckbox, gc);
+ }
}
myNonJavaCheckbox =
@@ -180,8 +182,9 @@ public class DeadCodeInspection extends FilteringInspectionTool {
}
public JComponent createOptionsPanel() {
- final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(new OptionsPanel());
- scrollPane.setBorder(BorderFactory.createEtchedBorder());
+ final JPanel scrollPane = new JPanel(new BorderLayout());
+ scrollPane.add(SeparatorFactory.createSeparator("Entry points", null), BorderLayout.NORTH);
+ scrollPane.add(new OptionsPanel(), BorderLayout.CENTER);
return scrollPane;
}
diff --git a/java/openapi/src/com/intellij/codeInspection/deadCode/UnusedCodeExtension.java b/java/openapi/src/com/intellij/codeInspection/deadCode/UnusedCodeExtension.java
index e978bf683baf..69be159c936f 100644
--- a/java/openapi/src/com/intellij/codeInspection/deadCode/UnusedCodeExtension.java
+++ b/java/openapi/src/com/intellij/codeInspection/deadCode/UnusedCodeExtension.java
@@ -30,6 +30,10 @@ public abstract class UnusedCodeExtension implements JDOMExternalizable {
public abstract boolean isSelected();
public abstract void setSelected(boolean selected);
+ public boolean showUI() {
+ return true;
+ }
+
@Nullable
public String [] getIgnoreAnnotations() {
return null;
diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
index 08d7d017587b..fd36e80fa728 100644
--- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
@@ -328,11 +328,11 @@ inspection.comparing.references.use.quickfix=Use equals()
inspection.comparing.references.problem.descriptor=Suspicious comparison #ref #loc
inspection.dead.code.display.name=Unused declaration
-inspection.dead.code.option=Automatically add all void main(String args[]) methods to entry points
-inspection.dead.code.option2=Automatically add all JUnit testcases to entry points
-inspection.dead.code.option3=Automatically add all applets to entry points
-inspection.dead.code.option4=Automatically add all servlets to entry points
-inspection.dead.code.option5=Automatically add classes that have usages in non-java files to entry points
+inspection.dead.code.option=void main(String args[]) methods
+inspection.dead.code.option2=JUnit testcases
+inspection.dead.code.option3=Applets
+inspection.dead.code.option4=Servlets
+inspection.dead.code.option5=Classes that have usages in non-java files
inspection.export.results.dead.code=unused declaration
inspection.dead.code.comment=// --Commented out by Inspection
inspection.dead.code.date.comment=// --Commented out by Inspection ({0}):
@@ -611,7 +611,7 @@ fix.all.inspection.problems.in.file=Fix all ''{0}'' problems
severities.default.settings.message=Edit Settings|Colors \\& Fonts
unsupported.character.for.the.charset=Unsupported characters for the charset ''{0}''
lossy.encoding=Lossy encoding
-inspection.unused.symbol.public.method.parameters=&Report unused parameters in non-private methods
+inspection.unused.symbol.public.method.parameters=Check parameters in &Non-private methods
introduce.constant.across.the.project=Introduce Constant Across the Project
inspection.application.chosen.profile.log\ message=Inspecting with profile ''{0}''
detach.library.quickfix.name=Detach library
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java
index 6be07010cbc5..f155e65472b5 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java
@@ -19,6 +19,7 @@ package com.intellij.testFramework.fixtures;
import com.intellij.codeInsight.completion.CompletionType;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.InspectionToolProvider;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.ex.InspectionTool;
@@ -85,11 +86,11 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
* @param inspections inspections to be enabled in highliting tests.
* @see #enableInspections(com.intellij.codeInspection.InspectionToolProvider[])
*/
- void enableInspections(LocalInspectionTool... inspections);
+ void enableInspections(InspectionProfileEntry... inspections);
void enableInspections(Class extends LocalInspectionTool>... inspections);
- void disableInspections(LocalInspectionTool... inspections);
+ void disableInspections(InspectionProfileEntry... inspections);
/**
* Enable all inspections provided by given providers.
diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
index 729547f8f262..379fd96f3f12 100644
--- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
+++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
@@ -114,9 +114,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
private String myTestDataPath;
private boolean myEmptyLookup;
- private LocalInspectionTool[] myInspections;
- private final Map myAvailableTools = new THashMap();
- private final Map myAvailableLocalTools = new THashMap();
+ private InspectionProfileEntry[] myInspections;
+ private final Map myAvailableTools = new THashMap();
+ private final Map myAvailableLocalTools = new THashMap();
private final TempDirTestFixture myTempDirFixture;
protected final IdeaProjectTestFixture myProjectFixture;
@@ -190,7 +190,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
return copyFileToProject(sourceFilePath, sourceFilePath);
}
- public void enableInspections(LocalInspectionTool... inspections) {
+ public void enableInspections(InspectionProfileEntry... inspections) {
myInspections = inspections;
if (isInitialized()) {
configureInspections(myInspections);
@@ -215,20 +215,20 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
enableInspections(tools.toArray(new LocalInspectionTool[tools.size()]));
}
- public void disableInspections(LocalInspectionTool... inspections) {
+ public void disableInspections(InspectionProfileEntry... inspections) {
myAvailableTools.clear();
myAvailableLocalTools.clear();
- final ArrayList tools = new ArrayList(Arrays.asList(myInspections));
- for (Iterator i = tools.iterator(); i.hasNext();) {
- final LocalInspectionTool tool = i.next();
- for (LocalInspectionTool toRemove: inspections) {
+ final ArrayList tools = new ArrayList(Arrays.asList(myInspections));
+ for (Iterator i = tools.iterator(); i.hasNext();) {
+ final InspectionProfileEntry tool = i.next();
+ for (InspectionProfileEntry toRemove: inspections) {
if (tool.getShortName().equals(toRemove.getShortName())) {
i.remove();
break;
}
}
}
- myInspections = tools.toArray(new LocalInspectionTool[tools.size()]);
+ myInspections = tools.toArray(new InspectionProfileEntry[tools.size()]);
configureInspections(myInspections);
}
@@ -760,18 +760,21 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
configureInspections(myInspections == null ? new LocalInspectionTool[0] : myInspections);
}
- private void enableInspectionTool(LocalInspectionTool tool){
+ private void enableInspectionTool(InspectionProfileEntry tool){
final String shortName = tool.getShortName();
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null){
- HighlightDisplayKey.register(shortName, tool.getDisplayName(), tool.getID());
+ String id = tool instanceof LocalInspectionTool ? ((LocalInspectionTool)tool).getID() : shortName;
+ HighlightDisplayKey.register(shortName, tool.getDisplayName(), id);
}
myAvailableTools.put(shortName, tool);
- myAvailableLocalTools.put(shortName, new LocalInspectionToolWrapper(tool));
+ myAvailableLocalTools.put(shortName, tool instanceof LocalInspectionTool ?
+ new LocalInspectionToolWrapper((LocalInspectionTool)tool) :
+ (InspectionTool)tool);
}
- private void configureInspections(final LocalInspectionTool[] tools) {
- for (LocalInspectionTool tool : tools) {
+ private void configureInspections(final InspectionProfileEntry[] tools) {
+ for (InspectionProfileEntry tool : tools) {
enableInspectionTool(tool);
}
@@ -784,8 +787,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
@NotNull
public InspectionProfileEntry[] getInspectionTools(PsiElement element) {
- final Collection tools = myAvailableLocalTools.values();
- return tools.toArray(new LocalInspectionToolWrapper[tools.size()]);
+ final Collection tools = myAvailableLocalTools.values();
+ return tools.toArray(new InspectionTool[tools.size()]);
}
@Override
@@ -798,12 +801,12 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
}
public boolean isToolEnabled(HighlightDisplayKey key, PsiElement element) {
- return key != null && key.toString() != null && myAvailableTools != null && myAvailableTools.containsKey(key.toString());
+ return key != null && key.toString() != null && myAvailableTools.containsKey(key.toString());
}
public HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey key, PsiElement element) {
- final LocalInspectionTool localInspectionTool = key == null ? null : myAvailableTools.get(key.toString());
- return localInspectionTool != null ? localInspectionTool.getDefaultLevel() : HighlightDisplayLevel.WARNING;
+ final InspectionProfileEntry entry = myAvailableTools.get(key.toString());
+ return entry != null ? entry.getDefaultLevel() : HighlightDisplayLevel.WARNING;
}
public InspectionTool getInspectionTool(@NotNull String shortName, @NotNull PsiElement element) {
@@ -873,10 +876,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
}.execute();
}
- public void configureByDirectory(final String dir) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
public PsiFile configureByText(final FileType fileType, @NonNls final String text) throws IOException {
assertInitialized();
final String extension = fileType.getDefaultExtension();