@Override
public void setPartialRange(IDocument document, int offset, int length, String contentType, int partitionOffset) {
if (offset == 0) {
/* let us believe that offset == 0 is exactly "the beginning" of the document
* where the [#ftl] or <#ftl> directive can only be located */
SyntaxMode newMode = DocumentProvider.findMode(document);
if (newMode != this.syntaxMode) {
syntaxModeChanged(newMode);
/* if the syntaxMode has really changed we should somehow trigger
* the reparsing of the whole document. Not sure if expanding
* offset and length to the whole document is safe enough */