Package org.twodividedbyzero.idea.findbugs.intentions

Examples of org.twodividedbyzero.idea.findbugs.intentions.ClearAndSuppressBugIntentionAction


        }

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;

      case Detector.NORMAL_PRIORITY:

        if (psiElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.YELLOW.darker(), EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;

      case Detector.EXP_PRIORITY:

        if (problemElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.GRAY, EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;
      case Detector.LOW_PRIORITY:

        if (psiElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createInfoAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
        } else {
          annotation = annotationHolder.createInfoAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.GREEN, EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;
      case Detector.IGNORE_PRIORITY:
        if (problemElement instanceof PsiAnonymousClass) {
          final PsiElement firstChild = psiElement.getFirstChild();
          annotation = annotationHolder.createWarningAnnotation(firstChild == null ? psiElement : firstChild, getAnnotationText(matchingDescriptors));
          annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.MAGENTA.brighter(), EffectType.WAVE_UNDERSCORE, Font.PLAIN));
        } else {
          annotation = annotationHolder.createWarningAnnotation(textRange, getAnnotationText(matchingDescriptors));
        }

        // todo: use color from annotation configuration
        annotation.setEnforcedTextAttributes(new TextAttributes(null, null, JBColor.MAGENTA, EffectType.WAVE_UNDERSCORE, Font.PLAIN));

        annotation.registerFix(new SuppressReportBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new SuppressReportBugForClassIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearBugIntentionAction(problemDescriptor), textRange);
        annotation.registerFix(new ClearAndSuppressBugIntentionAction(problemDescriptor), textRange);

        break;
      default:
        throw new IllegalArgumentException("Unknown bugInstance.getPriority() == " + priority);
    }
View Full Code Here


        final List<SuppressReportBugIntentionAction> intentionActions = new ArrayList<SuppressReportBugIntentionAction>(_descriptors.size());

        intentionActions.add(new SuppressReportBugIntentionAction(problemDescriptor));
        intentionActions.add(new SuppressReportBugForClassIntentionAction(problemDescriptor));
        intentionActions.add(new ClearBugIntentionAction(problemDescriptor));
        intentionActions.add(new ClearAndSuppressBugIntentionAction(problemDescriptor));

        final GroupBugIntentionListPopupStep intentionActionGroup = new GroupBugIntentionListPopupStep(_psiElement, intentionActions);
        intentionGroups.add(intentionActionGroup);
      }
View Full Code Here

TOP

Related Classes of org.twodividedbyzero.idea.findbugs.intentions.ClearAndSuppressBugIntentionAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.