Package org.eclipse.jface.text.source

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


 
  @SuppressWarnings("unchecked")
  public static MarkerAnnotation findMarkerAnnotationByTypeAndOffset(String type, int offset, ISourceViewer sourceViewer) {
    Iterator<Annotation> annotations = sourceViewer.getAnnotationModel().getAnnotationIterator();
    while (annotations.hasNext()) {
      Annotation tmpAnnotation = annotations.next();
      if (tmpAnnotation instanceof MarkerAnnotation) {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation) tmpAnnotation;
        try {
          if (markerAnnotation.getMarker().getType().equals(type)) {
            Integer charStart = markerAnnotation.getMarker().getAttribute(IMarker.CHAR_START, -1);
View Full Code Here


    Iterator iter = model.getAnnotationIterator();
    int layer = Integer.MIN_VALUE;

    while (iter.hasNext()) {
      Annotation annotation = (Annotation) iter.next();
      if (annotation.isMarkedDeleted())
        continue;

      int annotationLayer = annotationAccess.getLayer(annotation);
      if (annotationAccess != null)
        if (annotationLayer < layer)
View Full Code Here

        IAnnotationModel model = viewer.getAnnotationModel();

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
            Annotation annotation = (Annotation) iter.next();
            if (annotation instanceof MarkerAnnotation && canFix(annotation)) {
                Position position = model.getPosition(annotation);
                if (isAtPosition(context.getOffset(), position)) {
                    IMarker marker = ((MarkerAnnotation) annotation).getMarker();
                    String errorType = marker.getAttribute("$bndType", null);
View Full Code Here

        IAnnotationModel model = viewer.getAnnotationModel();

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
            Annotation annotation = (Annotation) iter.next();
            if (annotation instanceof MarkerAnnotation && canFix(annotation)) {
                Position position = model.getPosition(annotation);
                if (isAtPosition(context.getOffset(), position)) {
                    IMarker marker = ((MarkerAnnotation) annotation).getMarker();
                    String errorType = marker.getAttribute("$bndType", null);
View Full Code Here

                editor.getAdapter(ProjectionAnnotationModel.class);
           
            List lines = new ArrayList();
            for (Iterator i = model.getAnnotationIterator(); i.hasNext();)
            {
                Annotation a = (Annotation) i.next();
                Position p = model.getPosition(a);
               
                StringBuffer buf = new StringBuffer();
                buf.append(p.getOffset());
                buf.append(':');
                buf.append(p.getLength());
                buf.append(':');
                buf.append(a.getType());
                lines.add(buf.toString());
            }
            Collections.sort(lines);
           
            StringBuffer buf = new StringBuffer();
View Full Code Here

        final ISourceViewer sourceViewer = invocationContext.getSourceViewer();
        final Iterator<Annotation> iter = sourceViewer.getAnnotationModel()
                .getAnnotationIterator();
        final List<ICompletionProposal> result = Lists.newArrayList();
        while (iter.hasNext()) {
            final Annotation annotation = iter.next();
            if (annotation instanceof MarkerAnnotation) {
                final MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
                final IMarker marker = markerAnnotation.getMarker();
                try {
                    if (!marker.getType().equals(MarkerUtils.PROBLEM_MARKER)) {
View Full Code Here

        skip();
    }

    private void skip() {
        while (fIterator.hasNext()) {
            final Annotation next = (Annotation) fIterator.next();
            if (next instanceof IErlangAnnotation) {
                if (fSkipIrrelevants) {
                    if (!next.isMarkedDeleted()) {
                        fNext = next;
                        return;
                    }
                } else {
                    fNext = next;
View Full Code Here

                final String description = ref.getDescription();
                final String annotationType = ref.isDef() ? "org.erlide.ui.occurrences.definition" //$NON-NLS-1$
                        : "org.erlide.ui.occurrences";

                annotationMap.put(new Annotation(annotationType, false, description),
                        position);
            }

            if (isCanceled(progressMonitor)) {
                return Status.CANCEL_STATUS;
View Full Code Here

                    continue;
                }

                log.info(lr.getLineNum());
                if (coverage.containsAnnotation(editor.getTitle(), lr)) {
                    final Annotation ann = coverage.getAnnotation(editor.getTitle(), lr);
                    annMod.removeAnnotation(ann);
                    coverage.removeAnnotation(editor.getTitle(), lr);
                }
            }
        }
View Full Code Here

            final IRegion reg = doc.getLineInformation(lr.getLineNum() - 1);
            final int length = reg.getLength();
            final int offset = reg.getOffset();
            final Position pos = new Position(offset, length);

            Annotation annotation;
            if (lr.called()) {
                annotation = CoverageAnnotationFactory
                        .create(CoverageTypes.FULL_COVERAGE);
            } else {
                annotation = CoverageAnnotationFactory.create(CoverageTypes.NO_COVERAGE);
            }

            final Annotation lastAnn = coverage.getAnnotation(editor.getTitle(), lr);

            log.info(lastAnn);

            if (lastAnn == null) {
                annMod.addAnnotation(annotation, pos);
                coverage.addAnnotation(editor.getTitle(), lr, annotation);
            } else if (annMod.getPosition(lastAnn) == null) {
                annMod.addAnnotation(lastAnn, pos);
            } else if (lastAnn.getType().equals(CoverageTypes.NO_COVERAGE)
                    && annotation.getType().equals(CoverageTypes.FULL_COVERAGE)) {

                annMod.removeAnnotation(lastAnn);
                annMod.addAnnotation(annotation, pos);
                coverage.addAnnotation(editor.getTitle(), lr, annotation);
View Full Code Here

TOP

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

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.