Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Position


  }

  private void addAnnotations(Map<Annotation, Position> annotationToPositionMap) {
    IAnnotationModel model = getDocumentProvider().getAnnotationModel(getEditorInput());
    for (Annotation a : annotationToPositionMap.keySet()) {
      Position p = annotationToPositionMap.get(a);
      model.addAnnotation(a, p);
    }
  }
View Full Code Here


        annotationLayer = annotationAccess.getLayer(annotation);
        if (annotationLayer < layer)
          continue;
      }

      Position position = model.getPosition(annotation);
      if (!includesRulerLine(position, document))
        continue;

      boolean isReadOnly = fTextEditor instanceof ITextEditorExtension
              && ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly();
View Full Code Here

  /*
   * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
   */
  public void documentAboutToBeChanged(DocumentEvent event) {
    if (active && activeRegion != null) {
      fRememberedPosition= new Position(activeRegion.getOffset(), activeRegion.getLength());
      try {
        event.getDocument().addPosition(fRememberedPosition);
      } catch (BadLocationException x) {
        fRememberedPosition= null;
      }
View Full Code Here

    final Iterator<AnnotationFS> mAnnotations = mDocument.getCAS().getAnnotationIndex()
            .iterator();

    while (mAnnotations.hasNext()) {
      AnnotationFS annotationFS = mAnnotations.next();
      annotationModel.addAnnotation(new EclipseAnnotationPeer(annotationFS), new Position(
              annotationFS.getBegin(), annotationFS.getEnd() - annotationFS.getBegin()));
    }
  }
View Full Code Here

      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      Map<Annotation, Position> addAnnotationMap = new HashMap<Annotation, Position>();
     
      for (AnnotationFS annotation : annotations) {
        addAnnotationMap.put(new EclipseAnnotationPeer(annotation), new Position(annotation.getBegin(),
                annotation.getEnd() - annotation.getBegin()));
      }
     
      annotationModel.replaceAnnotations(null, addAnnotationMap);
    }
View Full Code Here

      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      Map<Annotation, Position> addAnnotationMap = new HashMap<Annotation, Position>();
     
      for (AnnotationFS annotation : annotations) {
        addAnnotationMap.put(new EclipseAnnotationPeer(annotation), new Position(annotation.getBegin(),
                annotation.getEnd() - annotation.getBegin()));
      }
     
      annotationModel.replaceAnnotations(null, addAnnotationMap);
    }
View Full Code Here

     
      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider().getAnnotationModel(getEditorInput());
     
      for (AnnotationFS annotation : annotations) {
        annotationModel.modifyAnnotationPosition(new EclipseAnnotationPeer(annotation),
                new Position(annotation.getBegin(), annotation.getEnd() - annotation.getBegin()));
      }
     
      selectionChanged(getSite().getPage().getActivePart(), mFeatureStructureSelectionProvider.getSelection());
    }
View Full Code Here

    // TODO: Build first a map, and then pass all annotations at once
    Map annotationsToAdd = new HashMap();
   
    while (mAnnotations.hasNext()) {
      AnnotationFS annotationFS = mAnnotations.next();
      annotationsToAdd.put(new EclipseAnnotationPeer(annotationFS), new Position(
              annotationFS.getBegin(), annotationFS.getEnd() - annotationFS.getBegin()));
    }
   
    ((IAnnotationModelExtension) annotationModel).replaceAnnotations(null, annotationsToAdd);
  }
View Full Code Here

      IRegion region = frAdapter.find(0, ATTRIBUTE_REGEX, true, false, false, true);
      String attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = attributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("attribute", sig.group(1))));
        }
        region = frAdapter.find(offset+length, ATTRIBUTE_REGEX, true, false, false, true);
      }
      // do the virtual attributes
      region = frAdapter.find(0, VIRTUAL_ATTRIBUTE_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = virtualAttributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("virtual", sig.group(1))));
        }
        region = frAdapter.find(offset+length, VIRTUAL_ATTRIBUTE_REGEX, true, false, false, true);
      }
      // do the window attributes
      region = frAdapter.find(0, WINDOW_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = windowAttributePattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(1);
          fContent.add(new Segment(attributeLabel, p, "icons/window_attribute.gif"));
        }
        region = frAdapter.find(offset+length, WINDOW_REGEX, true, false, false, true);
      }
      // do the class constants
      region = frAdapter.find(0, CONSTANT_REGEX, true, false, false, true);
      attributeLabel = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        attributeLabel = document.get(region.getOffset(), region.getLength());
        Matcher sig = constantPattern.matcher(attributeLabel);
        if (sig.find()){
          attributeLabel = sig.group(2);
          fContent.add(new Segment(attributeLabel, p, makeIconString("constant", sig.group(1))));
        }
        region = frAdapter.find(offset+length, CONSTANT_REGEX, true, false, false, true);
      }
      // do the method implementations
      region = frAdapter.find(0, CEX_SIGNATURE_REGEX, true, false, false, true);
      String methodSignature = null;
      while (region != null){
        int offset = region.getOffset();
        int length = region.getLength();
        Position p = new Position(offset, length);
        document.addPosition(SEGMENTS, p);
        methodSignature = document.get(region.getOffset(), region.getLength());
        Matcher sig = cexSignaturePattern.matcher(methodSignature);
        if (sig.find()){
          methodSignature = sig.group(1);
View Full Code Here

    Matcher matcher = classConstanPattern.matcher(source);
    if (matcher.find()){
      this.publicc = (matcher.group(1).startsWith("public"));
      int start = matcher.start(1);
      int length = matcher.end(1)-matcher.start(1);
      visibilityPosition = new Position(start, length);
      document.addPosition(visibilityPosition);

      this.name = matcher.group(2);
      start = matcher.start(2);
      length = matcher.end(2)-matcher.start(2);
      namePosition = new Position(start, length);
      document.addPosition(namePosition);

      this.value = matcher.group(3);
      start = matcher.start(3);
      length = matcher.end(3)-matcher.start(3);
      valuePosition = new Position(start, length);
      document.addPosition(valuePosition);
    }

    matcher = planConstanPattern.matcher(source);
    if (matcher.find()){

      this.name = matcher.group(1);
      int start = matcher.start(1);
      int length = matcher.end(1)-matcher.start(1);
      namePosition = new Position(start, length);
      document.addPosition(namePosition);

      this.value = matcher.group(2);
      start = matcher.start(2);
      length = matcher.end(2)-matcher.start(2);
      valuePosition = new Position(start, length);
      document.addPosition(valuePosition);

    }
    document.addPositionUpdater(new ConstantPositionUpdater("value", valuePosition));
  }
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.