Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.BadLocationException


   */
  public void addCommand(int commandOffset, int commandLength, String commandText, IDocumentListener commandOwner) throws BadLocationException {
    final Command command= new Command(commandOffset, commandLength, commandText, commandOwner);

    if (intersects(command))
      throw new BadLocationException();

    final int index= Collections.binarySearch(fCommands, command);

    // a command with exactly the same ranges exists already
    if (index >= 0)
      throw new BadLocationException();

    // binary search result is defined as (-(insertionIndex) - 1)
    final int insertionIndex= -(index + 1);

    // overlaps to the right?
    if (insertionIndex != fCommands.size() && intersects((Command) fCommands.get(insertionIndex), command))
      throw new BadLocationException();

    // overlaps to the left?
    if (insertionIndex != 0 && intersects((Command) fCommands.get(insertionIndex - 1), command))
      throw new BadLocationException();

    fCommands.add(insertionIndex, command);
  }
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.