UnusedDeclarationInspectionBase (PsiFile file) { GlobalInspectionContextBase contextBase = (GlobalInspectionContextBase)myRefManager.getContext(); Tools tools = contextBase.getTools().get(UnusedDeclarationInspectionBase.SHORT_NAME); InspectionToolWrapper<?,?> toolWrapper; if (tools != null) { toolWrapper = tools.getEnabledTool(file); } else { String singleTool = contextBase.getCurrentProfile().getSingleTool(); if (singleTool != null && !UnusedDeclarationInspectionBase.SHORT_NAME.equals(singleTool)) { return UnusedDeclarationInspectionBase.findUnusedDeclarationInspection(file); } else { return null; } } InspectionProfileEntry tool = toolWrapper == null ? null : toolWrapper.getTool(); return tool instanceof UnusedDeclarationInspectionBase ? (UnusedDeclarationInspectionBase)tool : null; }