Exemplo n.º 1
0
  public void doApplyInformationToEditor() {
    AnnotationHolder annotationHolder = new AnnotationHolderImpl();
    Annotation[] annotations = new Annotation[myUnusedImports.size()];
    int i = 0;
    for (GrImportStatement unusedImport : myUnusedImports) {
      IntentionAction action = createUnusedImportIntention();
      Annotation annotation =
          annotationHolder.createWarningAnnotation(
              unusedImport, GroovyInspectionBundle.message("unused.import"));
      annotation.setHighlightType(ProblemHighlightType.LIKE_UNUSED_SYMBOL);
      annotation.registerFix(action);
      annotations[i++] = annotation;
    }

    HighlightInfoHolder holder = new HighlightInfoHolder(myFile, HighlightInfoFilter.EMPTY_ARRAY);
    holder.setWritable(true);
    List<HighlightInfo> infos =
        ContainerUtil.map(
            annotations,
            new Function<Annotation, HighlightInfo>() {
              public HighlightInfo fun(Annotation annotation) {
                return HighlightInfo.fromAnnotation(annotation);
              }
            });
    UpdateHighlightersUtil.setHighlightersToEditor(
        myProject, myDocument, 0, myFile.getTextLength(), infos, getId());
  }
 @Override
 public void doApplyInformationToEditor() {
   if (myDocument != null) {
     final List<HighlightInfo> infos = getHighlights();
     UpdateHighlightersUtil.setHighlightersToEditor(
         myProject, myDocument, 0, myFile.getTextLength(), infos, getColorsScheme(), getId());
   }
 }
 @Override
 public void doApplyInformationToEditor() {
   if (toHighlight == null) return;
   UpdateHighlightersUtil.setHighlightersToEditor(
       myProject, myDocument, 0, myFile.getTextLength(), toHighlight, getColorsScheme(), getId());
 }