int start = invalidFilters[i].getStartToken().getOffset();
int stop = invalidFilters[i].getStopToken() != null ? invalidFilters[i].getStopToken().getOffset()
+ invalidFilters[i].getStopToken().getLength() : start
+ invalidFilters[i].getStartToken().getLength();
Annotation annotation = new Annotation( "DEFAULT", true, invalidFilters[i].toString() ); //$NON-NLS-1$
Position position = new Position( start, stop - start );
positionList.add( position );
sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
}
}
for ( int i = 0; i < tokens.length; i++ )
{
if ( tokens[i].getType() == LdapFilterToken.ERROR )
{
boolean overlaps = false;
for ( int k = 0; k < positionList.size(); k++ )
{
Position pos = positionList.get( k );
if ( pos.overlapsWith( tokens[i].getOffset(), tokens[i].getLength() ) )
{
overlaps = true;
break;
}
}
if ( !overlaps )
{
Annotation annotation = new Annotation( "DEFAULT", true, tokens[i].getValue() ); //$NON-NLS-1$
Position position = new Position( tokens[i].getOffset(), tokens[i].getLength() );
sourceViewer.getAnnotationModel().addAnnotation( annotation, position );
}
}
}