Package org.eclipse.jface.text.source

Examples of org.eclipse.jface.text.source.IAnnotationModel


  // public boolean canSaveDocument(Object element) {
  // return false;
  // }

  protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
    IAnnotationModel model = null;
    if (debugOperations) {
      if (element instanceof IStorageEditorInput)
        System.out.println("StorageModelProvider: createAnnotationModel for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
      else
        System.out.println("StorageModelProvider: createAnnotationModel for " + element); //$NON-NLS-1$
View Full Code Here


      }
      annotationsTable.setCellEditors(cellEditors);
      annotationsTable.setColumnProperties(columns);
      List matchingAnnotations = new ArrayList(0);
      if (fTextEditor != null) {
        IAnnotationModel annotationModel = fTextEditor.getDocumentProvider().getAnnotationModel(fTextEditor.getEditorInput());
        if (annotationModel != null) {
          Iterator iterator = annotationModel.getAnnotationIterator();
          while (iterator.hasNext()) {
            Annotation element = (Annotation) iterator.next();
            if (true) {
              matchingAnnotations.add(element);
            }
View Full Code Here

      int line = -1;
      if (annotation instanceof MarkerAnnotation) {
        line = MarkerUtilities.getLineNumber(((MarkerAnnotation) annotation).getMarker());//$NON-NLS-1$
      }
      else {
        IAnnotationModel annotationModel = fTextEditor.getDocumentProvider().getAnnotationModel(fTextEditor.getEditorInput());
        Position p = annotationModel.getPosition(annotation);
        if (p != null && !p.isDeleted()) {
          try {
            // don't forget the +1
            line = fDocument.getLineOfOffset(p.getOffset()) + 1;
          }
View Full Code Here

   *
   * @return the marker annotation model
   */
  protected AbstractMarkerAnnotationModel getAnnotationModel() {
    IDocumentProvider provider = fTextEditor.getDocumentProvider();
    IAnnotationModel model = provider.getAnnotationModel(fTextEditor.getEditorInput());
    if (model instanceof AbstractMarkerAnnotationModel)
      return (AbstractMarkerAnnotationModel) model;
    return null;
  }
View Full Code Here

      semanticHighlightingStrategy.reconcile(new Region(0, document.getLength()));
    }

    if ((getTextViewer() instanceof ISourceViewer)) {
      ISourceViewer sourceViewer = (ISourceViewer) getTextViewer();
      IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
      for (int i = 0; i < fReconcileListeners.length; i++) {
        fReconcileListeners[i].reconciled(document, annotationModel, false, new NullProgressMonitor());
      }
    }
  }
View Full Code Here

    IDocument document = getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput());
    int endOfDocument = document.getLength();
    int distance = Integer.MAX_VALUE;

    IAnnotationModel model = getTextEditor().getDocumentProvider().getAnnotationModel(getTextEditor().getEditorInput());
    // external files may not have an annotation model
    if (model != null) {
      Iterator e = model.getAnnotationIterator();
      while (e.hasNext()) {
        Annotation a = (Annotation) e.next();
        if (!isNavigationTarget(a))
          continue;

        Position p = model.getPosition(a);
        if (p == null)
          continue;

        if (forward && p.offset == offset || !forward && p.offset + p.getLength() == offset + length) {
          if (containingAnnotation == null || (forward && p.length >= containingAnnotationPosition.length || !forward && p.length >= containingAnnotationPosition.length)) {
View Full Code Here

  public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext quickAssistContext) {
    ISourceViewer viewer = quickAssistContext.getSourceViewer();
    int documentOffset = quickAssistContext.getOffset();
    int length = viewer != null ? viewer.getSelectedRange().y : 0;

    IAnnotationModel model = viewer.getAnnotationModel();
    if (model == null)
      return null;

    List allProposals = new ArrayList();
    if (model instanceof IAnnotationModelExtension2) {
      Iterator iter = ((IAnnotationModelExtension2) model).getAnnotationIterator(documentOffset, length, true, true);
      while (iter.hasNext()) {
        List processors = new ArrayList();
        Annotation anno = (Annotation) iter.next();
        if (canFix(anno)) {
          // first check to see if annotation already has a quick
          // fix processor attached to it
          if (anno instanceof TemporaryAnnotation) {
            Object o = ((TemporaryAnnotation) anno).getAdditionalFixInfo();
            if (o instanceof IQuickAssistProcessor) {
              processors.add(o);
            }
          }

          // get all relevant quick fixes for this annotation
          QuickFixRegistry registry = QuickFixRegistry.getInstance();
          processors.addAll(Arrays.asList(registry.getQuickFixProcessors(anno)));

          // set up context
          Map attributes = null;
          if (anno instanceof TemporaryAnnotation) {
            attributes = ((TemporaryAnnotation) anno).getAttributes();
          }
          Position pos = model.getPosition(anno);
          StructuredTextInvocationContext sseContext = new StructuredTextInvocationContext(viewer, pos.getOffset(), pos.getLength(), attributes);

          // call each processor
          for (int i = 0; i < processors.size(); ++i) {
            List proposals = new ArrayList();
View Full Code Here

  }

  private TemporaryAnnotation[] getSpellingAnnotationsToRemove(IRegion region) {
    List toRemove = new ArrayList();
    IAnnotationModel annotationModel = getAnnotationModel();
    // can be null when closing the editor
    if (annotationModel != null) {
      Iterator i = null;
      boolean annotationOverlaps = false;
      if (annotationModel instanceof IAnnotationModelExtension2) {
        i = ((IAnnotationModelExtension2) annotationModel).getAnnotationIterator(region.getOffset(), region.getLength(), true, true);
        annotationOverlaps = true;
      }
      else {
        i = annotationModel.getAnnotationIterator();
      }

      while (i.hasNext()) {
        Object obj = i.next();
        if (!(obj instanceof TemporaryAnnotation))
View Full Code Here

  }

  public void reconcile() {
    IDocument document = getDocument();
    if (document != null) {
      IAnnotationModel annotationModel = getAnnotationModel();
      if (annotationModel != null) {
        IRegion documentRegion = new Region(0, document.getLength());
        spellCheck(documentRegion, documentRegion, annotationModel);
      }
    }
View Full Code Here

   */
  public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
    if (isCanceled())
      return;

    IAnnotationModel annotationModel = getAnnotationModel();

    IDocument document = getDocument();
    if (document != null) {
      long time0 = 0;
      if (_DEBUG_SPELLING) {
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.source.IAnnotationModel

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.