org.eclipse.xtext.ui.editor.syntaxcoloring
Class AttributedPosition

java.lang.Object
  extended by org.eclipse.jface.text.Position
      extended by org.eclipse.xtext.ui.editor.syntaxcoloring.AttributedPosition

public class AttributedPosition
extends org.eclipse.jface.text.Position


Field Summary
 
Fields inherited from class org.eclipse.jface.text.Position
isDeleted, length, offset
 
Constructor Summary
AttributedPosition(int offset, int length, org.eclipse.jface.text.TextAttribute attribute, java.lang.Object lock)
          Initialize the position with the given offset, length and foreground color.
 
Method Summary
 org.eclipse.swt.custom.StyleRange createStyleRange()
           
 void delete()
           
 org.eclipse.jface.text.TextAttribute getHighlighting()
           
 boolean isContained(int off, int len)
          Is this position contained in the given range (inclusive)? Synchronizes on position updater.
 boolean isEqual(int off, int len, org.eclipse.jface.text.TextAttribute other)
          Uses reference equality for the highlighting.
 void setLength(int length)
           
 void setOffset(int offset)
           
 void undelete()
           
 void update(int off, int len)
           
 
Methods inherited from class org.eclipse.jface.text.Position
equals, getLength, getOffset, hashCode, includes, isDeleted, overlapsWith, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributedPosition

public AttributedPosition(int offset,
                          int length,
                          org.eclipse.jface.text.TextAttribute attribute,
                          java.lang.Object lock)
Initialize the position with the given offset, length and foreground color.

Parameters:
offset - The position offset
length - The position length
attribute - The highlighting TextAttribute
lock - The lock object
Method Detail

createStyleRange

public org.eclipse.swt.custom.StyleRange createStyleRange()
Returns:
Returns a corresponding style range.

isEqual

public boolean isEqual(int off,
                       int len,
                       org.eclipse.jface.text.TextAttribute other)
Uses reference equality for the highlighting.

Parameters:
off - The offset
len - The length
other - The highlighting TextAttribute to compare with
Returns:
true if the given offset, length and highlighting are equal to the internal ones.

isContained

public boolean isContained(int off,
                           int len)
Is this position contained in the given range (inclusive)? Synchronizes on position updater.

Parameters:
off - The range offset
len - The range length
Returns:
true iff this position is not delete and contained in the given range.

update

public void update(int off,
                   int len)

setLength

public void setLength(int length)
Overrides:
setLength in class org.eclipse.jface.text.Position

setOffset

public void setOffset(int offset)
Overrides:
setOffset in class org.eclipse.jface.text.Position

delete

public void delete()
Overrides:
delete in class org.eclipse.jface.text.Position

undelete

public void undelete()
Overrides:
undelete in class org.eclipse.jface.text.Position

getHighlighting

public org.eclipse.jface.text.TextAttribute getHighlighting()
Returns:
Returns the highlighting.