Java 类org.eclipse.jface.text.source.AnnotationModelEvent 实例源码

项目:eclemma    文件:CoverageAnnotationModel.java   
private void createAnnotations(final ISourceNode linecoverage) {
  AnnotationModelEvent event = new AnnotationModelEvent(this);
  clear(event);
  final int firstline = linecoverage.getFirstLine();
  final int lastline = Math.min(linecoverage.getLastLine(),
      document.getNumberOfLines());
  try {
    for (int l = firstline; l <= lastline; l++) {
      final ILine line = linecoverage.getLine(l);
      if (line.getStatus() != ICounter.EMPTY) {
        final IRegion region = document.getLineInformation(l - 1);
        final CoverageAnnotation ca = new CoverageAnnotation(
            region.getOffset(), region.getLength(), line);
        annotations.add(ca);
        event.annotationAdded(ca);
      }
    }
  } catch (BadLocationException ex) {
    EclEmmaUIPlugin.log(ex);
  }
  fireModelChanged(event);
}
项目:goclipse    文件:ProblemMarkerManager.java   
@Override
    public void modelChanged(AnnotationModelEvent event) {
//      if (event instanceof CompilationUnitAnnotationModelEvent) {
//          CompilationUnitAnnotationModelEvent cuEvent= (CompilationUnitAnnotationModelEvent) event;
//          if (cuEvent.includesProblemMarkerAnnotationChanges()) {
//              boolean hasChanges= false;
//              synchronized (this) {
//                  IResource changedResource= cuEvent.getUnderlyingResource();
//                  hasChanges= fResourcesWithAnnotationChanges.add(changedResource);
//              }
//              if (hasChanges) {
//                  fireChanges();
//              }
//          }
//      }
    }
项目:eclemma    文件:CoverageAnnotationModel.java   
private void fireModelChanged(AnnotationModelEvent event) {
  event.markSealed();
  if (!event.isEmpty()) {
    for (final IAnnotationModelListener l : annotationModelListeners) {
      if (l instanceof IAnnotationModelListenerExtension) {
        ((IAnnotationModelListenerExtension) l).modelChanged(event);
      } else {
        l.modelChanged(this);
      }
    }
  }
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitDocumentProvider.java   
/**
 * @see IAnnotationModelListenerExtension#modelChanged(AnnotationModelEvent)
 */
public void modelChanged(AnnotationModelEvent event) {
    Object[] listeners= fListenerList.getListeners();
    for (int i= 0; i < listeners.length; i++) {
        Object curr= listeners[i];
        if (curr instanceof IAnnotationModelListenerExtension) {
            ((IAnnotationModelListenerExtension) curr).modelChanged(event);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ProblemMarkerManager.java   
public void modelChanged(AnnotationModelEvent event) {
    if (event instanceof CompilationUnitAnnotationModelEvent) {
        CompilationUnitAnnotationModelEvent cuEvent= (CompilationUnitAnnotationModelEvent) event;
        if (cuEvent.includesProblemMarkerAnnotationChanges()) {
            boolean hasChanges= false;
            synchronized (this) {
                IResource changedResource= cuEvent.getUnderlyingResource();
                hasChanges= fResourcesWithAnnotationChanges.add(changedResource);
            }
            if (hasChanges) {
                fireChanges();
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitDocumentProvider.java   
/**
 * @see IAnnotationModelListenerExtension#modelChanged(AnnotationModelEvent)
 */
public void modelChanged(AnnotationModelEvent event) {
    Object[] listeners= fListenerList.getListeners();
    for (int i= 0; i < listeners.length; i++) {
        Object curr= listeners[i];
        if (curr instanceof IAnnotationModelListenerExtension) {
            ((IAnnotationModelListenerExtension) curr).modelChanged(event);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ProblemMarkerManager.java   
public void modelChanged(AnnotationModelEvent event) {
    if (event instanceof CompilationUnitAnnotationModelEvent) {
        CompilationUnitAnnotationModelEvent cuEvent= (CompilationUnitAnnotationModelEvent) event;
        if (cuEvent.includesProblemMarkerAnnotationChanges()) {
            boolean hasChanges= false;
            synchronized (this) {
                IResource changedResource= cuEvent.getUnderlyingResource();
                hasChanges= fResourcesWithAnnotationChanges.add(changedResource);
            }
            if (hasChanges) {
                fireChanges();
            }
        }
    }
}
项目:Pydev    文件:CopiedOverviewRuler.java   
@Override
public void modelChanged(AnnotationModelEvent event) {
    if (!event.isValid()) {
        return;
    }

    if (event.isWorldChange()) {
        update();
        return;
    }

    Annotation[] annotations = event.getAddedAnnotations();
    int length = annotations.length;
    for (int i = 0; i < length; i++) {
        if (!skip(annotations[i].getType())) {
            update();
            return;
        }
    }

    annotations = event.getRemovedAnnotations();
    length = annotations.length;
    for (int i = 0; i < length; i++) {
        if (!skip(annotations[i].getType())) {
            update();
            return;
        }
    }

    annotations = event.getChangedAnnotations();
    length = annotations.length;
    for (int i = 0; i < length; i++) {
        if (!skip(annotations[i].getType())) {
            update();
            return;
        }
    }

}
项目:eclemma    文件:CoverageAnnotationModel.java   
private void clear() {
  AnnotationModelEvent event = new AnnotationModelEvent(this);
  clear(event);
  fireModelChanged(event);
}
项目:eclemma    文件:CoverageAnnotationModel.java   
private void clear(AnnotationModelEvent event) {
  for (final CoverageAnnotation ca : annotations) {
    event.annotationRemoved(ca, ca.getPosition());
  }
  annotations.clear();
}
项目:eclemma    文件:CoverageAnnotationModel.java   
public void addAnnotationModelListener(IAnnotationModelListener listener) {
  if (!annotationModelListeners.contains(listener)) {
    annotationModelListeners.add(listener);
    fireModelChanged(new AnnotationModelEvent(this, true));
  }
}
项目:bts    文件:EgyTextEditorPart.java   
/**
 * Sets the sentence translation.
 *
 * @param sentence the new sentence translation
 */
private AnnotationModelEvent setSentenceTranslation(BTSSenctence sentence, boolean postSelection) {
    // TODO: allow for multiple sentence translations to be highlighted simultaneously
    // i.e. create method setSentenceTranslation(List<BTSSentence>) which gets passed
    // a Collection containing all sentences detected within a BTSTextSelectionEvent
    final AnnotationModelEvent ev = new AnnotationModelEvent(annotationModel);
    if (sentence != null && !sentence.equals(selectedSentence)) {
        selectedSentence = sentence;
        if (selectedSentence.getTranslation() == null) {
            Command command = AddCommand.create(editingDomain, selectedSentence,
                    BtsCorpusModelPackage.BTS_SENCTENCE__TRANSLATION,
                    BtsmodelFactory.eINSTANCE
                    .createBTSTranslations());
            editingDomain.getCommandStack().execute(command);
        }
        sentenceTranslate_Editor.setEnabled(userMayEdit);
        sentenceTranslate_Editor.load(selectedSentence.getTranslation(),
                editingDomain, false);

        BTSModelAnnotation am = modelAnnotationMap.get(sentence.get_id());
        if (am != null)
        {
            if (!am.equals(highlightedSentenceAnnotation) || !am.getType().endsWith(".highlighted")) {
                // highlight current translation
                am.setHighlighted(true);
                ev.annotationChanged(am);
                // remove previous highlight
                if (highlightedSentenceAnnotation != null) { 
                    highlightedSentenceAnnotation.setHighlighted(false);
                    ev.annotationChanged(highlightedSentenceAnnotation);
                }
                highlightedSentenceAnnotation = am;
            }
            if (!postSelection) {
                // make sure annotation is visible in text editor 
                Position pos = annotationModel.getPosition(am);
                if (pos != null)
                    embeddedEditor.getViewer().revealRange(pos.getOffset(), pos.length);

                // In order to limit workload, only repaint text editor (including highlight of line(s)
                // containing this sentence) if method call seems to come from selection listener
                // in EgyTextTranslationPart. This is indicated by postSelection being false. 
                // (if postSelection is true, repaint has most likely already been invoked in processSelection)
                sync.asyncExec(new Runnable() {
                    public void run() {
                        // TODO this can be improved in order to reduce work load repainting large texts

                        if (painter == null || embeddedEditor.getViewer().getTextWidget().isDisposed()) return;
                        painter.modelChanged(ev);
                        painter.paint(IPainter.INTERNAL);
                        ruler.update();
                        ruler.relayout();
                        oruler.update();
                        embeddedEditor.getViewer().getTextWidget().redraw();
                    }
                });
                return null;
            }

        }

        if (postSelection)
            selectionService.setSelection(sentence);
        return ev;
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitDocumentProvider.java   
@Override
protected AnnotationModelEvent createAnnotationModelEvent() {
    return new CompilationUnitAnnotationModelEvent(this, getResource());
}
项目:idecore    文件:ApexDocumentProvider.java   
@Override
protected AnnotationModelEvent createAnnotationModelEvent() {
    return new CompilationUnitAnnotationModelEvent(this, getResource());
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitDocumentProvider.java   
@Override
protected AnnotationModelEvent createAnnotationModelEvent() {
    return new CompilationUnitAnnotationModelEvent(this, getResource());
}