org.eclipse.xtext.ui.editor.model
Class DocumentUtil

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.model.DocumentUtil

public class DocumentUtil
extends java.lang.Object

Author:
Sven Efftinge - Initial contribution and API

Constructor Summary
DocumentUtil()
           
 
Method Summary
 int findNextOffSetInPartition(org.eclipse.jface.text.IDocument doc, int partitionOffSet, int minIndex)
           
 boolean isSameLine(org.eclipse.jface.text.IDocument doc, int offset, int offset2)
           
protected  java.lang.String preProcessSearchString(java.lang.String string)
           
 org.eclipse.jface.text.IRegion searchBackwardsInSamePartition(java.lang.String toFind, org.eclipse.jface.text.IDocument document, int endOffset)
          searches backwards for the given string within the same partition type
 org.eclipse.jface.text.IRegion searchInSamePartition(java.lang.String toFind, org.eclipse.jface.text.IDocument document, int startOffset)
          searches for the given string within the same partition type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentUtil

public DocumentUtil()
Method Detail

searchBackwardsInSamePartition

public org.eclipse.jface.text.IRegion searchBackwardsInSamePartition(java.lang.String toFind,
                                                                     org.eclipse.jface.text.IDocument document,
                                                                     int endOffset)
                                                              throws org.eclipse.jface.text.BadLocationException
searches backwards for the given string within the same partition type

Returns:
the region of the match or null if no match were found
Throws:
org.eclipse.jface.text.BadLocationException

preProcessSearchString

protected java.lang.String preProcessSearchString(java.lang.String string)

searchInSamePartition

public org.eclipse.jface.text.IRegion searchInSamePartition(java.lang.String toFind,
                                                            org.eclipse.jface.text.IDocument document,
                                                            int startOffset)
                                                     throws org.eclipse.jface.text.BadLocationException
searches for the given string within the same partition type

Returns:
the region of the match or null if no match were found
Throws:
org.eclipse.jface.text.BadLocationException

isSameLine

public boolean isSameLine(org.eclipse.jface.text.IDocument doc,
                          int offset,
                          int offset2)
                   throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

findNextOffSetInPartition

public int findNextOffSetInPartition(org.eclipse.jface.text.IDocument doc,
                                     int partitionOffSet,
                                     int minIndex)
                              throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException