annotations patterns support in DeadCodeInspection (IDEA-24043 Jersey request methods...
[fedora-idea.git] / java / java-impl / src / com / intellij / codeInspection / deadCode / DummyEntryPointsTool.java
blob78434be3c88b1844ed270a0c0714e342c25b019f
1 package com.intellij.codeInspection.deadCode;
3 import com.intellij.analysis.AnalysisScope;
4 import com.intellij.codeInspection.InspectionManager;
5 import com.intellij.codeInspection.InspectionsBundle;
6 import com.intellij.codeInspection.ex.*;
7 import com.intellij.codeInspection.reference.RefElement;
8 import com.intellij.codeInspection.reference.RefEntity;
9 import com.intellij.codeInspection.util.RefFilter;
10 import org.jdom.Element;
11 import org.jetbrains.annotations.NotNull;
13 /**
14 * @author max
16 public class DummyEntryPointsTool extends FilteringInspectionTool {
17 private RefEntryPointFilter myFilter;
18 private final DeadCodeInspection myOwner;
19 private QuickFixAction[] myQuickFixActions;
21 public DummyEntryPointsTool(DeadCodeInspection owner) {
22 myOwner = owner;
25 public RefFilter getFilter() {
26 if (myFilter == null) {
27 myFilter = new RefEntryPointFilter();
29 return myFilter;
32 public void runInspection(AnalysisScope scope, final InspectionManager manager) {}
34 public void exportResults(Element parentNode) {}
36 @NotNull
37 public JobDescriptor[] getJobDescriptors() {
38 return new JobDescriptor[0];
41 @NotNull
42 public String getDisplayName() {
43 return InspectionsBundle.message("inspection.dead.code.entry.points.display.name");
46 @NotNull
47 public String getGroupDisplayName() {
48 return "";
51 @NotNull
52 public String getShortName() {
53 return "";
56 public HTMLComposerImpl getComposer() {
57 return new DeadHTMLComposer(this);
60 public GlobalInspectionContextImpl getContext() {
61 return myOwner.getContext();
64 public QuickFixAction[] getQuickFixes(final RefEntity[] refElements) {
65 if (myQuickFixActions == null) {
66 myQuickFixActions = new QuickFixAction[]{new MoveEntriesToSuspicious()};
68 return myQuickFixActions;
71 private class MoveEntriesToSuspicious extends QuickFixAction {
72 private MoveEntriesToSuspicious() {
73 super(InspectionsBundle.message("inspection.dead.code.remove.from.entry.point.quickfix"), null, null, DummyEntryPointsTool.this);
76 protected boolean applyFix(RefElement[] refElements) {
77 final EntryPointsManager entryPointsManager =
78 getContext().getExtension(GlobalJavaInspectionContextImpl.CONTEXT).getEntryPointsManager(getContext().getRefManager());
79 for (RefElement refElement : refElements) {
80 entryPointsManager.removeEntryPoint(refElement);
83 return true;