Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Position


           
            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);
View Full Code Here


    }
    return newLines;
  }

  protected void emitPosition(int startOffset, int length) {
    fPositions.add(new Position(startOffset, length));
  }
View Full Code Here

     *
     * @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode#addChild(org.eclipse.compare.structuremergeviewer.DocumentRangeNode)
     */
    @Override
    public void addChild(final DocumentRangeNode node) {
        final Position p = rangeUnion(getRange(), node.getRange());
        final Position r = getRange();
        r.setOffset(p.getOffset());
        r.setLength(p.getLength());
        super.addChild(node);
    }
View Full Code Here

    private Position rangeUnion(final Position a, final Position b) {
        final int offsetA = a.getOffset(), offsetB = b.getOffset();
        final int endA = offsetA + a.getLength(), endB = offsetB + b.getLength();
        final int end = Math.max(endA, endB);
        final int offset = Math.min(offsetA, offsetB);
        return new Position(offset, end - offset);
    }
View Full Code Here

            createProjection = true;
        }
        if (createProjection) {
            final IRegion region = computeProjectionRanges(element);
            if (region != null) {
                final Position position = createProjectionPosition(region, element);
                if (position != null) {
                    map.put(new ErlangProjectionAnnotation(element, collapse
                            && fFirstTimeInitialCollapse, element instanceof IErlComment),
                            position);
                }
View Full Code Here

            for (final Entry<ErlangProjectionAnnotation, Position> entry : updated
                    .entrySet()) {
                final ErlangProjectionAnnotation newAnnotation = entry.getKey();
                final IErlElement element = newAnnotation.getElement();
                final Position newPosition = entry.getValue();

                final List<Tuple> annotations = previous.get(element);
                if (annotations == null) {

                    additions.put(newAnnotation, newPosition);

                } else {
                    final Iterator<Tuple> x = annotations.iterator();
                    boolean matched = false;
                    while (x.hasNext()) {
                        final Tuple tuple = x.next();
                        final ErlangProjectionAnnotation existingAnnotation = tuple.annotation;
                        final Position existingPosition = tuple.position;
                        if (newAnnotation.isComment() == existingAnnotation.isComment()) {
                            if (existingPosition != null
                                    && !newPosition.equals(existingPosition)) {
                                existingPosition.setOffset(newPosition.getOffset());
                                existingPosition.setLength(newPosition.getLength());
                                updates.add(existingAnnotation);
                            }
                            matched = true;
                            x.remove();
                            break;
View Full Code Here

        final Iterator<ErlangProjectionAnnotation> deletionIterator = deletions
                .iterator();
        while (deletionIterator.hasNext()) {
            final ErlangProjectionAnnotation deleted = deletionIterator.next();
            final Position deletedPosition = fCachedModel.getPosition(deleted);
            if (deletedPosition == null) {
                continue;
            }

            final Tuple deletedTuple = new Tuple(deleted, deletedPosition);

            Tuple match = findMatch(deletedTuple, changes, null);
            boolean addToDeletions = true;
            if (match == null) {
                match = findMatch(deletedTuple, additions.keySet(), additions);
                addToDeletions = false;
            }

            if (match != null) {
                final IErlElement element = match.annotation.getElement();
                deleted.setElement(element);
                deletedPosition.setLength(match.position.getLength());
                if (deletedPosition instanceof ErlangElementPosition
                        && element instanceof IErlMember) {
                    final ErlangElementPosition eep = (ErlangElementPosition) deletedPosition;
                    eep.setMember((IErlMember) element);
                }
View Full Code Here

            final Map<ErlangProjectionAnnotation, Position> positionMap) {
        final Iterator<ErlangProjectionAnnotation> it = annotations.iterator();
        while (it.hasNext()) {
            final ErlangProjectionAnnotation annotation = it.next();
            if (tuple.annotation.isComment() == annotation.isComment()) {
                final Position position = positionMap == null ? fCachedModel
                        .getPosition(annotation) : positionMap.get(annotation);
                if (position == null) {
                    continue;
                }

                if (tuple.position.getOffset() == position.getOffset()) {
                    it.remove();
                    return new Tuple(annotation, position);
                }
            }
        }
View Full Code Here

        final Iterator<?> e = model.getAnnotationIterator();
        while (e.hasNext()) {
            final Object annotation = e.next();
            if (annotation instanceof ErlangProjectionAnnotation) {
                final ErlangProjectionAnnotation epa = (ErlangProjectionAnnotation) annotation;
                final Position position = model.getPosition(epa);
                List<Tuple> list = map.get(epa.getElement());
                if (list == null) {
                    list = new ArrayList<Tuple>(2);
                    map.put(epa.getElement(), list);
                }
View Full Code Here

            for (final MarkOccurencesSupport.ErlangRef ref : fRefs) {
                if (isCanceled(progressMonitor)) {
                    return Status.CANCEL_STATUS;
                }

                final Position position = new Position(ref.getOffset(), ref.getLength());

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

TOP

Related Classes of org.eclipse.jface.text.Position

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.