Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.BadLocationException


    Node node = null;
    if ((0 <= offset) && (offset <= getDocument().getLength())) {
      node = (Node) fTextEditor.getModel().getIndexedRegion(offset);
    }
    else {
      throw new BadLocationException();
    }
    return node;
  }
View Full Code Here


    Position[] positions= getPositions(fDocument);

    if (positions != null) {
      for (int i = 0; i < positions.length; i++)
        if (collides(positions[i], offset, length))
          throw new BadLocationException(LinkedPositionMessages.getString(("LinkedPositionManager.error.position.collision"))); //$NON-NLS-1$
    }
   
    String type= fDocument.get(offset, length);   

    if (containsLineDelimiters(type))
      throw new BadLocationException(LinkedPositionMessages.getString(("LinkedPositionManager.error.contains.line.delimiters"))); //$NON-NLS-1$

    try {
      fDocument.addPosition(LINKED_POSITION, new TypedPosition(offset, length, type));
    } catch (BadPositionCategoryException e) {
      //PHPeclipsePlugin.log(e);
View Full Code Here

  /*
   * @see org.eclipse.jface.text.source.ILineDiffer#revertLine(int)
   */
  public synchronized void revertLine(int line) throws BadLocationException {
    if (!isInitialized())
      throw new BadLocationException(QuickDiffMessages.quickdiff_nonsynchronized);

    DiffRegion region= (DiffRegion) getLineInfo(line);
    if (region == null || fRightDocument == null || fLeftDocument == null)
      return;

View Full Code Here

  /*
   * @see org.eclipse.jface.text.source.ILineDiffer#revertBlock(int)
   */
  public synchronized void revertBlock(int line) throws BadLocationException {
    if (!isInitialized())
      throw new BadLocationException(QuickDiffMessages.quickdiff_nonsynchronized);

    DiffRegion region= (DiffRegion) getLineInfo(line);
    if (region == null || fRightDocument == null || fLeftDocument == null)
      return;

View Full Code Here

  /*
   * @see org.eclipse.jface.text.source.ILineDiffer#revertSelection(int, int)
   */
  public synchronized void revertSelection(int line, int nLines) throws BadLocationException {
    if (!isInitialized())
      throw new BadLocationException(QuickDiffMessages.quickdiff_nonsynchronized);

    if (fRightDocument == null || fLeftDocument == null)
      return;

    int rOffset= -1, rLength= -1, lOffset= -1, lLength= -1;
View Full Code Here

  /*
   * @see org.eclipse.jface.text.source.ILineDiffer#restoreAfterLine(int)
   */
  public synchronized int restoreAfterLine(int line) throws BadLocationException {
    if (!isInitialized())
      throw new BadLocationException(QuickDiffMessages.quickdiff_nonsynchronized);

    DiffRegion region= (DiffRegion) getLineInfo(line);
    if (region == null || fRightDocument == null || fLeftDocument == null)
      return 0;

View Full Code Here

            top = Math.max(0, Math.min(lines - 1, top));
            bottom = Math.max(0, Math.min(lines - 1, bottom));

            int start = document.getLineOffset(top);
            if (start == -1)
                throw new BadLocationException("Start line -1");
            int end = document.getLineOffset(bottom);
            if (end == -1 || end < start)
                throw new BadLocationException("End line -1 or less than start");
            SarosAnnotation annotation = new ViewportAnnotation(source);
            Position position = new Position(start, end - start);
            model.addAnnotation(annotation, position);
        } catch (BadLocationException e) {
            log.warn("Internal Error:", e);
View Full Code Here

  private int findSegmentIndex(int offset) throws BadLocationException {
    Position[] segments= getSegments();
    if (segments.length == 0) {
      if (offset > 0)
        throw new BadLocationException();
      return -1;
    }

    try {
      int index= fSlaveDocument.computeIndexInCategory(fSegmentsCategory, offset);
      if (index == segments.length && offset > exclusiveEnd(segments[index-1]))
        throw new BadLocationException();

      if (index < segments.length && offset == segments[index].offset)
        return index;

      if (index > 0)
View Full Code Here

  private final void checkOriginRegion(IRegion originRegion) throws BadLocationException {
    int offset= originRegion.getOffset();
    int endOffset= inclusiveEnd(originRegion);
    int max= fMasterDocument.getLength();
    if (offset < 0 || offset > max || endOffset < 0 || endOffset > max)
      throw new BadLocationException();
  }
View Full Code Here

      throw new BadLocationException();
  }

  private final void checkOriginOffset(int originOffset) throws BadLocationException {
    if (originOffset < 0 || originOffset > fMasterDocument.getLength())
      throw new BadLocationException();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.BadLocationException

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.