protected HighlightSeverity getSeverity(@NotNull RefElement element) { final PsiElement psiElement = element.getPointer().getContainingFile(); if (psiElement != null) { final GlobalInspectionContextImpl context = getContext(); final String shortName = getSeverityDelegateName(); final Tools tools = context.getTools().get(shortName); if (tools != null) { for (ScopeToolState state : tools.getTools()) { InspectionToolWrapper toolWrapper = state.getTool(); if (toolWrapper == getToolWrapper()) { return context .getCurrentProfile() .getErrorLevel(HighlightDisplayKey.find(shortName), psiElement) .getSeverity(); } } } final InspectionProfile profile = InspectionProjectProfileManager.getInstance(context.getProject()).getInspectionProfile(); final HighlightDisplayLevel level = profile.getErrorLevel(HighlightDisplayKey.find(shortName), psiElement); return level.getSeverity(); } return null; }
private InspectionTool getTool(final RefEntity refEntity) { InspectionTool tool = getTool(); assert tool != null; final GlobalInspectionContextImpl manager = tool.getContext(); if (manager == null) return tool; if (refEntity instanceof RefElement) { PsiElement element = ((RefElement) refEntity).getElement(); if (element == null) return tool; final InspectionProfileWrapper profileWrapper = InspectionProjectProfileManagerImpl.getInstanceImpl(manager.getProject()) .getProfileWrapper(); if (profileWrapper == null) return tool; tool = profileWrapper.getInspectionTool(tool.getShortName(), element); } return tool; }