use of com.intellij.lang.annotation.ProblemGroup in project intellij-community by JetBrains.
the class GlobalInspectionContextImpl method getProblemDescriptionProcessor.
@NotNull
private ProblemDescriptionsProcessor getProblemDescriptionProcessor(@NotNull final GlobalInspectionToolWrapper toolWrapper, @NotNull final Map<String, InspectionToolWrapper> wrappersMap) {
return new ProblemDescriptionsProcessor() {
@Override
public void addProblemElement(@Nullable RefEntity refEntity, @NotNull CommonProblemDescriptor... commonProblemDescriptors) {
for (CommonProblemDescriptor problemDescriptor : commonProblemDescriptors) {
if (!(problemDescriptor instanceof ProblemDescriptor)) {
continue;
}
ProblemGroup problemGroup = ((ProblemDescriptor) problemDescriptor).getProblemGroup();
InspectionToolWrapper targetWrapper = problemGroup == null ? toolWrapper : wrappersMap.get(problemGroup.getProblemName());
if (targetWrapper != null) {
// Else it's switched off
InspectionToolPresentation toolPresentation = getPresentation(targetWrapper);
toolPresentation.addProblemElement(refEntity, problemDescriptor);
}
}
}
};
}
use of com.intellij.lang.annotation.ProblemGroup in project kotlin by JetBrains.
the class AbstractQuickFixTest method findActionWithText.
@Override
protected IntentionAction findActionWithText(String text) {
IntentionAction intention = super.findActionWithText(text);
if (intention != null)
return intention;
// Support warning suppression
int caretOffset = myEditor.getCaretModel().getOffset();
for (HighlightInfo highlight : doHighlighting()) {
if (highlight.startOffset <= caretOffset && caretOffset <= highlight.endOffset) {
ProblemGroup group = highlight.getProblemGroup();
if (group instanceof SuppressableProblemGroup) {
SuppressableProblemGroup problemGroup = (SuppressableProblemGroup) group;
PsiElement at = getFile().findElementAt(highlight.getActualStartOffset());
SuppressIntentionAction[] actions = problemGroup.getSuppressActions(at);
for (SuppressIntentionAction action : actions) {
if (action.getText().equals(text)) {
return action;
}
}
}
}
}
return null;
}
Aggregations