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
;
16 public class DummyEntryPointsTool
extends FilteringInspectionTool
{
17 private RefEntryPointFilter myFilter
;
18 private final DeadCodeInspection myOwner
;
19 private QuickFixAction
[] myQuickFixActions
;
21 public DummyEntryPointsTool(DeadCodeInspection owner
) {
25 public RefFilter
getFilter() {
26 if (myFilter
== null) {
27 myFilter
= new RefEntryPointFilter();
32 public void runInspection(AnalysisScope scope
, final InspectionManager manager
) {}
34 public void exportResults(Element parentNode
) {}
37 public JobDescriptor
[] getJobDescriptors() {
38 return new JobDescriptor
[0];
42 public String
getDisplayName() {
43 return InspectionsBundle
.message("inspection.dead.code.entry.points.display.name");
47 public String
getGroupDisplayName() {
52 public String
getShortName() {
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
);