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

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.syntaxcoloring.MergingHighlightedPositionAcceptor
All Implemented Interfaces:
IHighlightedPositionAcceptor, ISemanticHighlightingCalculator

public class MergingHighlightedPositionAcceptor
extends java.lang.Object
implements IHighlightedPositionAcceptor, ISemanticHighlightingCalculator

Accepts a bunch of positions and creates a list of positions from them that do not overlap.

Author:
Sebastian Zarnekow - Initial contribution and API

Constructor Summary
MergingHighlightedPositionAcceptor(ISemanticHighlightingCalculator delegate)
           
 
Method Summary
 void addPosition(int offset, int length, java.lang.String... ids)
          Associates a text range with a style.
 java.util.List<LightweightPosition> getPositions()
           
 void mergePositions()
           
 void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergingHighlightedPositionAcceptor

public MergingHighlightedPositionAcceptor(ISemanticHighlightingCalculator delegate)
Method Detail

addPosition

public void addPosition(int offset,
                        int length,
                        java.lang.String... ids)
Description copied from interface: IHighlightedPositionAcceptor
Associates a text range with a style.

Specified by:
addPosition in interface IHighlightedPositionAcceptor
Parameters:
offset - the offset of the range.
length - the length of the range.
ids - the ids of the highlighting style, that should be applied.

provideHighlightingFor

public void provideHighlightingFor(XtextResource resource,
                                   IHighlightedPositionAcceptor acceptor)
Specified by:
provideHighlightingFor in interface ISemanticHighlightingCalculator
Parameters:
resource - the resource that will be highlighted. May be null in some rare cases.
acceptor - used to announce the mapping from text-range to the style's id. The acceptor will never be null.

mergePositions

public void mergePositions()

getPositions

public java.util.List<LightweightPosition> getPositions()