renamed
[fedora-idea.git] / java / java-impl / src / com / intellij / codeInspection / deadCode / DummyEntryPointsTool.java
blob850b2d1d3906535b2d296bd531df7bac324f87c6
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.codeInspection.deadCode;
18 import com.intellij.analysis.AnalysisScope;
19 import com.intellij.codeInspection.InspectionManager;
20 import com.intellij.codeInspection.InspectionsBundle;
21 import com.intellij.codeInspection.ex.*;
22 import com.intellij.codeInspection.reference.RefElement;
23 import com.intellij.codeInspection.reference.RefEntity;
24 import com.intellij.codeInspection.util.RefFilter;
25 import org.jdom.Element;
26 import org.jetbrains.annotations.NotNull;
28 /**
29 * @author max
31 public class DummyEntryPointsTool extends FilteringInspectionTool {
32 private RefEntryPointFilter myFilter;
33 private final UnusedDeclarationInspection myOwner;
34 private QuickFixAction[] myQuickFixActions;
36 public DummyEntryPointsTool(UnusedDeclarationInspection owner) {
37 myOwner = owner;
40 public RefFilter getFilter() {
41 if (myFilter == null) {
42 myFilter = new RefEntryPointFilter();
44 return myFilter;
47 public void runInspection(AnalysisScope scope, final InspectionManager manager) {}
49 public void exportResults(Element parentNode) {}
51 @NotNull
52 public JobDescriptor[] getJobDescriptors() {
53 return new JobDescriptor[0];
56 @NotNull
57 public String getDisplayName() {
58 return InspectionsBundle.message("inspection.dead.code.entry.points.display.name");
61 @NotNull
62 public String getGroupDisplayName() {
63 return "";
66 @NotNull
67 public String getShortName() {
68 return "";
71 public HTMLComposerImpl getComposer() {
72 return new DeadHTMLComposer(this);
75 public GlobalInspectionContextImpl getContext() {
76 return myOwner.getContext();
79 public QuickFixAction[] getQuickFixes(final RefEntity[] refElements) {
80 if (myQuickFixActions == null) {
81 myQuickFixActions = new QuickFixAction[]{new MoveEntriesToSuspicious()};
83 return myQuickFixActions;
86 private class MoveEntriesToSuspicious extends QuickFixAction {
87 private MoveEntriesToSuspicious() {
88 super(InspectionsBundle.message("inspection.dead.code.remove.from.entry.point.quickfix"), null, null, DummyEntryPointsTool.this);
91 protected boolean applyFix(RefElement[] refElements) {
92 final EntryPointsManager entryPointsManager =
93 getContext().getExtension(GlobalJavaInspectionContextImpl.CONTEXT).getEntryPointsManager(getContext().getRefManager());
94 for (RefElement refElement : refElements) {
95 entryPointsManager.removeEntryPoint(refElement);
98 return true;