Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Position


            /*
             * store the position and annotation - the position is needed to create the fold, while
             * the annotation is needed to remove it
             */
            Tuple t = new Tuple(new Position(offset, length), new ProjectionAnnotation(collapse));
            tuples.add(t);
        }
    }
View Full Code Here


    private void removeFolds(Set toRemove)
    {
        for (Iterator iter = folds.iterator(); iter.hasNext();)
        {
            Tuple t = (Tuple) iter.next();
            Position p = getAnnotations().getPosition(t.annotation);

            if ((p != null) && (p.isDeleted() || ! toRemove.contains(t)))
            {
                getAnnotations().removeAnnotation(t.annotation);
                iter.remove();
            }
            else
View Full Code Here

       
          String text=document.get(offset, length);
          org.jbehave.plugin.eclipse.model.StoryLine storyLine = org.jbehave.plugin.eclipse.model.StoryLine.parseLine(text);
          if ((storyLine!=null)){
            if (storyLine.getKeyWord().equals("Scenario:")){
            Position p= new Position(offset, length);
            document.addPosition(SEGMENTS, p);
            fContent.add(new Segment(storyLine.asText(), p)); //$NON-NLS-1$
            }
          }
         
View Full Code Here

      }
      if (widgetInsertionOffset == -1)
        return;

      // mark caret
      Position caret= new Position(insertionOffset, 0);
      document.addPosition(caret);
      st.setSelectionRange(widgetInsertionOffset, 0);

      // operate directly on the widget
      st.replaceTextRange(widgetInsertionOffset, 0, st.getLineDelimiter());

      // restore caret unless an auto-indenter has already moved the caret
      // then leave it alone
      document.removePosition(caret);
      if (updateCaret && st.getSelection().x == widgetInsertionOffset) {
        int widgetCaret= AbstractTextEditor.modelOffset2WidgetOffset(sv, caret.getOffset());
        if (widgetCaret != -1)
          st.setSelectionRange(widgetCaret, 0);
        st.showSelection();
      }
View Full Code Here

   * @see org.eclipse.ui.texteditor.IVerticalRulerListener#annotationDefaultSelected(org.eclipse.ui.texteditor.VerticalRulerEvent)
   */
  public void annotationDefaultSelected(VerticalRulerEvent event) {
    Annotation a= event.getSelectedAnnotation();
    IAnnotationModel model= getAnnotationModel();
    Position position= model.getPosition(a);
    if (position == null)
      return;

    getTextEditor().selectAndReveal(position.offset, position.length);
  }
View Full Code Here

      ITextSelection selection= (ITextSelection) s;
      if(selection.getOffset() == 0 && selection.getLength() == 0)
        return;

      IDocument document= getDocument(part);
      Position position= new Position(selection.getOffset(), selection.getLength());
      if (installOnDocument(document, position)) {
        fDocument= document;
        fPosition= position;
        if (!part.isDirty())
          fSavedPosition= new Position(fPosition.offset, fPosition.length);
      }
    }
  }
View Full Code Here

      Integer offset= memento.getInteger(TAG_X);
      Integer length= memento.getInteger(TAG_Y);
      String deleted= memento.getString(TAG_INFO);

      if (offset != null && length != null) {
        Position p= new Position(offset.intValue(), length.intValue());
        if (deleted != null)
          p.isDeleted= INFO_DELETED.equals(deleted) ? true : false;

        // activate
        if (installOnDocument(fDocument, p)) {
          fPosition= p;
          if (!part.isDirty())
            fSavedPosition= new Position(fPosition.offset, fPosition.length);
        }
      }
    }
  }
View Full Code Here

  public void partSaved(IEditorPart part) {
    // http://dev.eclipse.org/bugs/show_bug.cgi?id=25440
    if (fPosition == null || fPosition.isDeleted())
      fSavedPosition= null;
    else
      fSavedPosition= new Position(fPosition.offset, fPosition.length);
  }
View Full Code Here

      fPosition.offset= selection.getOffset();
      fPosition.length= selection.getLength();
      fPosition.isDeleted= false;

      if (!part.isDirty())
        fSavedPosition= new Position(fPosition.offset, fPosition.length);
    }
  }
View Full Code Here

        {
        throw new RuntimeException("CoreException creating IMarker", e);
        }
    MarkerAnnotation annotation = new MarkerAnnotation(marker);
    annotation.setType(getAnnotationType(a.details));
    Position position = new Position(a.selection.pos, a.selection.length);
    annotModel.addAnnotation(annotation, position);
    annotations.put(annotation,a);
    }
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.