public abstract class LocalInspectionTool extends InspectionProfileEntry
Modifier and Type | Field and Description |
---|---|
static LocalInspectionTool[] |
EMPTY_ARRAY |
static java.lang.String |
VALID_ID_PATTERN
Pattern used for inspection ID validation.
|
myNameProvider
Constructor and Description |
---|
LocalInspectionTool() |
Modifier and Type | Method and Description |
---|---|
PsiElementVisitor |
buildVisitor(ProblemsHolder holder,
boolean isOnTheFly)
Override the method to provide your own inspection visitor.
|
PsiElementVisitor |
buildVisitor(ProblemsHolder holder,
boolean isOnTheFly,
LocalInspectionToolSession session)
Override the method to provide your own inspection visitor, if you need to store additional state in the
LocalInspectionToolSession user data or get information about the inspection scope.
|
ProblemDescriptor [] |
checkFile(PsiFile file,
InspectionManager manager,
boolean isOnTheFly)
Override this to report problems at file level.
|
java.lang.String |
getAlternativeID()
For global tools read-only, for local tools would be used instead getID for modules with alternative classpath storage
|
java.lang.String |
getID()
If you want to change suppression id you have to define it in XML as well.
|
PsiNamedElement |
getProblemElement(PsiElement psiElement)
The method finds problem container (ex: method, class, file) that used to be shown as inspection view tree node.
|
protected java.lang.String |
getSuppressId()
Tool ID passed to
InspectionSuppressor . |
void |
inspectionFinished(LocalInspectionToolSession session)
Deprecated.
|
void |
inspectionFinished(LocalInspectionToolSession session,
ProblemsHolder problemsHolder) |
void |
inspectionStarted(LocalInspectionToolSession session,
boolean isOnTheFly) |
static boolean |
isValidID(java.lang.String id) |
java.util.List<ProblemDescriptor> |
processFile(PsiFile file,
InspectionManager manager) |
boolean |
runForWholeFile()
Override this method and return true if your inspection (unlike almost all others)
must be called for every element in the whole file for each change, whatever small it was.
|
cleanup, createOptionsPanel, getBatchSuppressActions, getBlackList, getDefaultLevel, getDescriptionContextClass, getDescriptionFileName, getDisplayName, getGeneralGroupName, getGroupDisplayName, getGroupKey, getGroupPath, getMainToolId, getSerializationFilter, getShortName, getShortName, getStaticDescription, getSuppressors, initialize, isEnabledByDefault, isInitialized, isSuppressedFor, loadDescription, readSettings, showDefaultConfigurationOptions, writeSettings
public static final LocalInspectionTool[] EMPTY_ARRAY
public static final java.lang.String VALID_ID_PATTERN
public static boolean isValidID(java.lang.String id)
public java.lang.String getID()
Inspection tool ID is a descriptive name to be used in "suppress" comments and annotations.
It must satisfy VALID_ID_PATTERN
regexp pattern.
If not defined InspectionProfileEntry.getShortName()
is used as tool ID.
protected final java.lang.String getSuppressId()
InspectionProfileEntry
InspectionSuppressor
.getSuppressId
in class InspectionProfileEntry
public java.lang.String getAlternativeID()
InspectionProfileEntry
getAlternativeID
in class InspectionProfileEntry
public boolean runForWholeFile()
public ProblemDescriptor [] checkFile(PsiFile file, InspectionManager manager, boolean isOnTheFly)
file
- to check.manager
- InspectionManager to ask for ProblemDescriptor's from.isOnTheFly
- true if called during on the fly editor highlighting. Called from Inspect Code action otherwise.null
if no problems found or not applicable at file level.public PsiElementVisitor buildVisitor(ProblemsHolder holder, boolean isOnTheFly, LocalInspectionToolSession session)
PsiRecursiveElementVisitor
)
since it will be fed with every element in the file anyway.
Visitor created must be thread-safe since it might be called on several elements concurrently.holder
- where visitor will register problems found.isOnTheFly
- true if inspection was run in non-batch modesession
- the session in the context of which the tool runs.PsiRecursiveVisitor
public PsiElementVisitor buildVisitor(ProblemsHolder holder, boolean isOnTheFly)
PsiRecursiveElementVisitor
)
since it will be fed with every element in the file anyway.
Visitor created must be thread-safe since it might be called on several elements concurrently.holder
- where visitor will register problems found.isOnTheFly
- true if inspection was run in non-batch modePsiRecursiveVisitor
public PsiNamedElement getProblemElement(PsiElement psiElement)
RefManagerExtension.getElementContainer(PsiElement)
to override container element for any inspection for given language.psiElement:
- problem elementpublic void inspectionStarted(LocalInspectionToolSession session, boolean isOnTheFly)
public void inspectionFinished(LocalInspectionToolSession session, ProblemsHolder problemsHolder)
@Deprecated public void inspectionFinished(LocalInspectionToolSession session)
inspectionFinished(LocalInspectionToolSession, ProblemsHolder)
insteadpublic java.util.List<ProblemDescriptor> processFile(PsiFile file, InspectionManager manager)