use of org.eclipse.xtext.ui.editor.model.DocumentTokenSource in project xtext-eclipse by eclipse.
the class AbstractDamagerRepairerTest method createDocument.
protected Document createDocument(String before) throws Exception {
DocumentTokenSource source = new DocumentTokenSource();
source.setLexer(new Provider<Lexer>() {
@Override
public Lexer get() {
return createLexer();
}
});
XtextDocument document = new XtextDocument(source, null, outdatedStateManager, operationCanceledManager);
document.set(before);
return document;
}
use of org.eclipse.xtext.ui.editor.model.DocumentTokenSource in project xtext-eclipse by eclipse.
the class BacktrackingLexerPresentationDamagerTest method createDocument.
@Override
protected Document createDocument(String before) throws Exception {
DocumentTokenSource source = new BacktrackingLexerDocumentTokenSource();
source.setLexer(new Provider<Lexer>() {
@Override
public Lexer get() {
return createLexer();
}
});
XtextDocument document = new XtextDocument(source, null, outdatedStateManager, operationCanceledManager);
document.set(before);
return document;
}
use of org.eclipse.xtext.ui.editor.model.DocumentTokenSource in project xtext-eclipse by eclipse.
the class AbstractDamagerRepairerTest method createDocument.
protected Document createDocument(String before) throws Exception {
DocumentTokenSource source = new DocumentTokenSource();
source.setLexer(new Provider<Lexer>() {
@Override
public Lexer get() {
return createLexer();
}
});
XtextDocument document = new XtextDocument(source, null, outdatedStateManager, operationCanceledManager);
document.set(before);
return document;
}
use of org.eclipse.xtext.ui.editor.model.DocumentTokenSource in project xtext-eclipse by eclipse.
the class OutlineTreeProviderTest method createXtextDocument.
protected XtextDocument createXtextDocument(String modelAsText) throws Exception {
final XtextResource resource = getResource(modelAsText, "test.outlinetestlanguage");
DocumentTokenSource tokenSource = new DocumentTokenSource();
tokenSource.setLexer(new Provider<Lexer>() {
@Override
public Lexer get() {
return new InternalXtextLexer();
}
});
XtextDocument xtextDocument = new XtextDocument(tokenSource, null, new OutdatedStateManager(), new OperationCanceledManager());
xtextDocument.setInput(resource);
xtextDocument.set(modelAsText);
return xtextDocument;
}
use of org.eclipse.xtext.ui.editor.model.DocumentTokenSource in project xtext-eclipse by eclipse.
the class AbstractXtextDocumentTest method getDocument.
public XtextDocument getDocument(String s) {
TerminalsTokenTypeToPartitionMapper mapper = new TerminalsTokenTypeToPartitionMapper() {
{
setTokenDefProvider(new AntlrTokenDefProvider() {
{
setAntlrTokenFileProvider(new XtextAntlrTokenFileProvider());
}
});
}
};
PartitionTokenScanner scanner = new PartitionTokenScanner();
scanner.setMapper(mapper);
DocumentPartitioner partitioner = new DocumentPartitioner(scanner, mapper);
DocumentTokenSource tokenSource = new DocumentTokenSource();
tokenSource.setLexer(new Provider<Lexer>() {
@Override
public Lexer get() {
return new org.eclipse.xtext.parser.antlr.internal.InternalXtextLexer();
}
});
XtextDocument document = new XtextDocument(tokenSource, null, outdatedStateManager, operationCanceledManager);
document.setDocumentPartitioner(partitioner);
partitioner.connect(document);
document.set(s);
return document;
}
Aggregations