Package org.eclipse.jface.text.source.projection

Examples of org.eclipse.jface.text.source.projection.ProjectionAnnotation


      StringBuffer sb = new StringBuffer();
      Iterator iter = model.getAnnotationIterator();
      int positions = 0;
      while (iter.hasNext()) {
        positions++;
        ProjectionAnnotation annotation = (ProjectionAnnotation) iter.next();
        Position position = model.getPosition(annotation);
        sb.append(position.offset + "," + position.length + ",");
        sb.append((annotation.isCollapsed())?1:0);
        sb.append("\n");
      }
      if (positions < 300) {
        try {
          if (resource.isAccessible()) {
View Full Code Here


        Iterator iter;
        HashMap aHashMap = new HashMap();
        for (StoredFold fold : storedFolds) {
          iter = model.getAnnotationIterator(fold.offset, fold.length, false, false);
          if (iter.hasNext()) {
            ProjectionAnnotation p = (ProjectionAnnotation) iter.next();
            if (fold.collapsed!=0) {
              model.collapse(p);
            } else {
              model.expand(p);
            }
View Full Code Here

            int viewerLineStart = this.fViewer.widgetOffset2ModelOffset(widgetLineStart);
          
            ProjectionAnnotationModel model = this.fViewer.getProjectionAnnotationModel();
            Iterator i = model.getAnnotationIterator();
            while (i.hasNext()) {
                ProjectionAnnotation annotation = (ProjectionAnnotation)i.next();
                Position pos = model.getPosition(annotation);
                /* Check if the line is the start line of a collapsed
                 * region.
                 */
                if (pos.offset == viewerLineStart
                        && annotation.isCollapsed()) {
                    int selectionLength = viewerLineStart - this.selectionStart + pos.length;
                    // Grab the current caret position so we can put it back after changing the selection
                    Point oldCaret = this.textWidget.getCaret().getLocation();
                    TextSelection sel = new TextSelection(this.fViewer.getDocument(),this.selectionStart,selectionLength);
                    this.fViewer.setSelection(sel,false);
View Full Code Here

       
       
        while (i.hasNext()) {
            Object o = i.next();
            if (o instanceof ProjectionAnnotation) {
                ProjectionAnnotation annotation = (ProjectionAnnotation)o;
                Position pos = pModel.getPosition(annotation);
               
                // The annotation is completely inside the selection
                if (pos.offset >= selectionOffset
                        && pos.offset <= selectionOffset + length) {
                    boolean collapsed = annotation.isCollapsed();
                    pModel.expand(annotation);
                    Position newPos = new Position(pos.offset-selectionOffset,pos.length);
                    annotationList.add(new AnnotationPosition(annotation,newPos,collapsed));
                   
                    // Remove the annotation for now.
View Full Code Here

        }

        for ( Iterator iter = positionToAnnotationMap.keySet().iterator(); iter.hasNext(); )
        {
            Position position = ( Position ) iter.next();
            ProjectionAnnotation annotation = ( ProjectionAnnotation ) positionToAnnotationMap.get( position );
            annotationsToAddMap.put( annotation, position );
        }
    }
View Full Code Here

                        if ( line.isFolded() )
                        {
                            Position position = new Position( line.getOffset(), line.getLength() );
                            // ProjectionAnnotation annotation = new
                            // ProjectionAnnotation(true);
                            ProjectionAnnotation annotation = new ProjectionAnnotation( FOLD_WRAPPEDLINES );
                            positionToAnnotationMap.put( position, annotation );
                        }
                    }
                }

                if ( containerStartLine < containerEndLine )
                {
                    int start = document.getLineOffset( containerStartLine );
                    int end = document.getLineOffset( containerEndLine ) + document.getLineLength( containerEndLine );
                    Position position = new Position( start, end - start );
                    // ProjectionAnnotation annotation = new
                    // ProjectionAnnotation(container instanceof
                    // LdifCommentContainer);
                    ProjectionAnnotation annotation = new ProjectionAnnotation( FOLD_RECORDS
                        || ( FOLD_COMMENTS && container instanceof LdifCommentContainer ) );
                    positionToAnnotationMap.put( position, annotation );
                }
            }
        }
View Full Code Here

   */
  private void updateSectionFoldingAnnotations2(IDocument doc, List<Header> headers,
      Map<Annotation, Position> newAnnotations, int endParent) {
    for (int i=0; i<headers.size(); i++) {
      Header header = headers.get(i);
      ProjectionAnnotation annotation = new ProjectionAnnotation();
      try {
        int line = header.getLineNumber();
        int start = doc.getLineOffset(line);
        int end = (i==headers.size()-1)? endParent
            : doc.getLineOffset(headers.get(i+1).getLineNumber());
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.source.projection.ProjectionAnnotation

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.