org.eclipse.xtext.ui.editor.folding
Class DefaultFoldedPosition

java.lang.Object
  extended by org.eclipse.jface.text.Position
      extended by org.eclipse.xtext.ui.editor.folding.FoldedPosition
          extended by org.eclipse.xtext.ui.editor.folding.DefaultFoldedPosition
All Implemented Interfaces:
org.eclipse.jface.text.source.projection.IProjectionPosition

public class DefaultFoldedPosition
extends FoldedPosition

Default implementation of folded position. It uses a relative offset to determine the significant content and its length.

Author:
Sebastian Zarnekow - Initial contribution and API

Field Summary
 
Fields inherited from class org.eclipse.jface.text.Position
isDeleted, length, offset
 
Constructor Summary
DefaultFoldedPosition(int offset, int length, int contentStart, int contentLength)
           
 
Method Summary
 int computeCaptionOffset(org.eclipse.jface.text.IDocument document)
          Returns the offset of the caption (the anchor region) of this projection position.
 org.eclipse.jface.text.IRegion[] computeProjectionRegions(org.eclipse.jface.text.IDocument document)
          Returns an array of regions that should be collapsed when the annotation belonging to this position is collapsed.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 
Methods inherited from class org.eclipse.jface.text.Position
delete, getLength, getOffset, includes, isDeleted, overlapsWith, setLength, setOffset, toString, undelete
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultFoldedPosition

public DefaultFoldedPosition(int offset,
                             int length,
                             int contentStart,
                             int contentLength)
Method Detail

computeProjectionRegions

public org.eclipse.jface.text.IRegion[] computeProjectionRegions(org.eclipse.jface.text.IDocument document)
                                                          throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.source.projection.IProjectionPosition
Returns an array of regions that should be collapsed when the annotation belonging to this position is collapsed. May return null instead of an empty array.

Parameters:
document - the document that this position is attached to
Returns:
the foldable regions for this position
Throws:
org.eclipse.jface.text.BadLocationException - if accessing the document fails

computeCaptionOffset

public int computeCaptionOffset(org.eclipse.jface.text.IDocument document)
                         throws org.eclipse.jface.text.BadLocationException
Description copied from interface: org.eclipse.jface.text.source.projection.IProjectionPosition
Returns the offset of the caption (the anchor region) of this projection position. The returned offset is relative to the receivers offset into the document.

Parameters:
document - the document that this position is attached to
Returns:
the caption offset relative to the position's offset
Throws:
org.eclipse.jface.text.BadLocationException - if accessing the document fails

hashCode

public int hashCode()
Overrides:
hashCode in class org.eclipse.jface.text.Position

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class org.eclipse.jface.text.Position