Examples of AnnotationFS


Examples of org.apache.uima.cas.text.AnnotationFS

   */
  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
          Color color) {
    if (length > 0) {
      if ((annotation instanceof EclipseAnnotationPeer)) {
        AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();

        if (gc != null) {
          Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);

          gc.setForeground(color);

          boolean isDrawOpenBracket = annotationFS.getBegin() == offset;
          if (isDrawOpenBracket) {
            gc.drawLine(bounds.x, bounds.y + bounds.height - 1, bounds.x + BRACKET_WIDTH, bounds.y
                    + bounds.height - 1);

            gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);

            gc.drawLine(bounds.x, bounds.y, bounds.x + BRACKET_WIDTH, bounds.y);
          }

          boolean isDrawCloseBracket = annotationFS.getEnd() == offset + length;
          if (isDrawCloseBracket) {
            gc.drawLine(bounds.x + bounds.width, bounds.y + bounds.height - 1, bounds.x
                    + bounds.width - BRACKET_WIDTH, bounds.y + bounds.height - 1);

            gc.drawLine(bounds.x + bounds.width - 1, bounds.y, bounds.x + bounds.width - 1, bounds.y
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

   */
  @Override
  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    AnnotationFS annotation = annotations.getFirst();

    Type annotationType = annotation.getType();
    Feature endFeature = annotationType.getFeatureByBaseName("end");

    if (annotation.getBegin() < annotation.getEnd()) {
      annotation.setIntValue(endFeature, annotation.getEnd() - 1);
    }

    mDocument.update(annotation);
  }
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

        Type annotationType = (Type) selection.getFirstElement();

        if (annotationType != null) {
          Point textSelection = editor.getSelection();

          AnnotationFS annotation = editor.getDocument().getCAS().createAnnotation(annotationType,
                  textSelection.x, textSelection.y);

          editor.getDocument().addFeatureStructure(annotation);

          if (annotation.getType().equals(editor.getAnnotationMode())) {
            editor.setAnnotationSelection(annotation);
          }
        }

        QuickTypeSelectionDialog.this.close();
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

   */
  @Override
  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    AnnotationFS annotation = annotations.getFirst();

    Type annotationType = annotation.getType();
    Feature endFeature = annotationType.getFeatureByBaseName("end");

    if (annotation.getEnd() < mDocument.getText().length()) {
      annotation.setIntValue(endFeature, annotation.getEnd() + 1);
    }

    mDocument.update(annotation);
  }
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

  }

  private Collection<AnnotationFS> fsIteratorToCollection(FSIterator iterator) {
    LinkedList<AnnotationFS> annotations = new LinkedList<AnnotationFS>();
    while (iterator.hasNext()) {
      AnnotationFS annotation = (AnnotationFS) iterator.next();

      annotations.addFirst(annotation);
    }

    return annotations;
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    CAS documentCAS = mDocument.getCAS();

    AnnotationFS mergedAnnotation = documentCAS.createAnnotation(annotations.getFirst().getType(),
            annotations.getFirst().getBegin(), annotations.getLast().getEnd());

    mDocument.removeAnnotations(annotations.toList());
    mDocument.addFeatureStructure(mergedAnnotation);
  }
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

   */
  public boolean match(FeatureStructure featureStructure) {
    boolean result = false;

    if ((featureStructure instanceof AnnotationFS)) {
      AnnotationFS annotation = (AnnotationFS) featureStructure;

      for (AnnotationFS containingAnnotation : mContainingAnnotations) {
        if (isContaining(annotation, containingAnnotation)) {
          result = true;
          break;
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

   */
  @Override
  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    AnnotationFS annotation = annotations.getFirst();

    Type annotationType = annotation.getType();
    Feature beginFeature = annotationType.getFeatureByBaseName("begin");

    if (annotation.getBegin() < annotation.getEnd()) {
      annotation.setIntValue(beginFeature, annotation.getBegin() + 1);
    }

    mDocument.update(annotation);
  }
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

   */
  @Override
  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    AnnotationFS annotation = annotations.getFirst();

    Type annotationType = annotation.getType();
    Feature beginFeature = annotationType.getFeatureByBaseName("begin");

    if (annotation.getBegin() > 0) {
      annotation.setIntValue(beginFeature, annotation.getBegin() - 1);
    }

    mDocument.update(annotation);
  }
View Full Code Here

Examples of org.apache.uima.cas.text.AnnotationFS

    if (columnIndex != 0) {
      // ... just return null
      return null;
    }

    AnnotationFS annotation = (AnnotationFS) ((IAdaptable) element).getAdapter(AnnotationFS.class);

    return getStringWithoutNewLine(annotation.getCoveredText());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.