Examples of AnnotationSelection


Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

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

    ICasDocument document = editor.getDocument();
   
    CAS documentCAS = document.getCAS();

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

    document.removeFeatureStructures(annotations.toList());
    document.addFeatureStructure(mergedAnnotation);
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

    setEnabled(false);
  }

  @Override
  protected boolean updateSelection(IStructuredSelection selection) {
    AnnotationSelection annotation = new AnnotationSelection(selection);

    return annotation.size() == 1;
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

  /**
   * Increases the begin index of an annotation by one.
   */
  @Override
  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    AnnotationFS annotation = annotations.getFirst();

    lowerLeftAnnotationSide(editor.getDocument(), annotation);
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

    setEnabled(false);
  }

  @Override
  protected boolean updateSelection(IStructuredSelection selection) {
    AnnotationSelection annotation = new AnnotationSelection(selection);

    return annotation.size() == 1;
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

  /**
   * Decreases the begin index of an annotation by one.
   */
  @Override
  public void run() {
    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());

    AnnotationFS annotation = annotations.getFirst();
   
    wideLeftAnnotationSide(editor.getDocument(), annotation);
  }
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

   * @param selection
   */
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof StructuredSelection) {
     
      AnnotationSelection annotations = new AnnotationSelection((StructuredSelection) selection);

      // only process these selection if the annotations belong
      // to the current editor instance
      if (getSite().getPage().getActiveEditor() == this) {
       
        if (!annotations.isEmpty()) {
          highlight(annotations.getFirst().getBegin(), annotations.getLast().getEnd()
                  - annotations.getFirst().getBegin());
 
          // move caret to new position when selected outside of the editor
          if (AnnotationEditor.this != part) {
           
            // Note: The caret cannot be placed between line delimiters
            // See bug UIMA-1470
            int newCaretOffset = annotations.getLast().getEnd();
            String text = getSourceViewer().getTextWidget().getText();
           
            if (newCaretOffset > 0 && newCaretOffset < text.length()) {
              char beforeCaret = text.charAt(newCaretOffset -1);
              char afterCaret = text.charAt(newCaretOffset);
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

   * @param selection
   */
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof StructuredSelection) {
     
      AnnotationSelection annotations = new AnnotationSelection((StructuredSelection) selection);

      // only process these selection if the annotations belong
      // to the current editor instance
      if (getSite().getPage().getActiveEditor() == this) {
       
        if (!annotations.isEmpty()) {
          highlight(annotations.getFirst().getBegin(), annotations.getLast().getEnd()
                  - annotations.getFirst().getBegin());
 
          // move caret to new position when selected outside of the editor
          if (AnnotationEditor.this != part) {
           
            // Note: The caret cannot be placed between line delimiters
            // See bug UIMA-1470
            int newCaretOffset = annotations.getLast().getEnd();
            String text = getSourceViewer().getTextWidget().getText();
           
            if (newCaretOffset > 0 && newCaretOffset < text.length()) {
              char beforeCaret = text.charAt(newCaretOffset -1);
              char afterCaret = text.charAt(newCaretOffset);
View Full Code Here

Examples of org.apache.uima.caseditor.editor.util.AnnotationSelection

   * @param part
   * @param selection
   */
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof StructuredSelection) {
      AnnotationSelection annotations = new AnnotationSelection((StructuredSelection) selection);

      // only process these selection if the annotations belong
      // to the current editor instance
      if (getSite().getPage().getActiveEditor() == this && !annotations.isEmpty()) {
        highlight(annotations.getFirst().getBegin(), annotations.getLast().getEnd()
                - annotations.getFirst().getBegin());

        // move caret to new position when selected outside of the editor
        if (AnnotationEditor.this != part) {
         
          // Note: The caret cannot be placed between line delimiters
          // See bug UIMA-1470
          int newCaretOffset = annotations.getLast().getEnd();
          String text = getSourceViewer().getTextWidget().getText();
         
          if (newCaretOffset > 0 && newCaretOffset < text.length()) {
            char beforeCaret = text.charAt(newCaretOffset -1);
            char afterCaret = text.charAt(newCaretOffset);
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.