use of org.eclipse.xtext.ui.editor.model.edit.ITextEditComposer in project xtext-eclipse by eclipse.
the class DocumentLockerTest method testModifySetsOutdatedFalse.
@Test
public void testModifySetsOutdatedFalse() {
DocumentTokenSource _createTokenSource = this.createTokenSource();
ITextEditComposer _createTextEditComposer = this.createTextEditComposer();
final XtextDocument document = new XtextDocument(_createTokenSource, _createTextEditComposer, this.outdatedStateManager, this.operationCanceledManager);
XtextResource _xtextResource = new XtextResource();
final Procedure1<XtextResource> _function = (XtextResource it) -> {
EList<Resource> _resources = new XtextResourceSet().getResources();
_resources.add(it);
};
final XtextResource resource = ObjectExtensions.<XtextResource>operator_doubleArrow(_xtextResource, _function);
document.setInput(resource);
final IUnitOfWork<Object, XtextResource> _function_1 = (XtextResource it) -> {
Object _xblockexpression = null;
{
Assert.assertFalse(document.getCancelIndicator().isCanceled());
_xblockexpression = null;
}
return _xblockexpression;
};
document.<Object>internalModify(_function_1);
final CancelIndicator indicator = document.getCancelIndicator();
Assert.assertFalse(indicator.isCanceled());
document.set("fupp");
Assert.assertTrue(indicator.isCanceled());
final IUnitOfWork<Object, XtextResource> _function_2 = (XtextResource it) -> {
Object _xblockexpression = null;
{
Assert.assertFalse(document.getCancelIndicator().isCanceled());
_xblockexpression = null;
}
return _xblockexpression;
};
document.<Object>internalModify(_function_2);
}
use of org.eclipse.xtext.ui.editor.model.edit.ITextEditComposer in project xtext-eclipse by eclipse.
the class DocumentLockerTest method testNoUpdateContentProcessOnReentrant.
@Test
public void testNoUpdateContentProcessOnReentrant() {
final ArrayList<String> s = CollectionLiterals.<String>newArrayList();
DocumentTokenSource _createTokenSource = this.createTokenSource();
ITextEditComposer _createTextEditComposer = this.createTextEditComposer();
final XtextDocument document = new XtextDocument(_createTokenSource, _createTextEditComposer, this.outdatedStateManager, this.operationCanceledManager) {
@Override
protected boolean updateContentBeforeRead() {
return s.add("x");
}
};
XtextResource _xtextResource = new XtextResource();
final Procedure1<XtextResource> _function = (XtextResource it) -> {
EList<Resource> _resources = new XtextResourceSet().getResources();
_resources.add(it);
};
XtextResource _doubleArrow = ObjectExtensions.<XtextResource>operator_doubleArrow(_xtextResource, _function);
document.setInput(_doubleArrow);
Assert.assertEquals(0, s.size());
final IUnitOfWork<Object, XtextResource> _function_1 = (XtextResource it) -> {
Assert.assertEquals(1, s.size());
final IUnitOfWork<Object, XtextResource> _function_2 = (XtextResource it_1) -> {
Assert.assertEquals(1, s.size());
final IUnitOfWork<Object, XtextResource> _function_3 = (XtextResource it_2) -> {
Assert.assertEquals(1, s.size());
return null;
};
document.<Object>readOnly(_function_3);
return null;
};
document.<Object>readOnly(_function_2);
return null;
};
document.<Object>readOnly(_function_1);
Assert.assertEquals(1, s.size());
}
Aggregations