use of org.eclipse.xtext.ui.editor.findrefs.EditorResourceAccess in project xtext-eclipse by eclipse.
the class EditorResourceAccessTest method testAccess.
@Test
public void testAccess() throws Exception {
EditorResourceAccess access = TestsActivator.getInstance().getInjector(getEditorId()).getInstance(EditorResourceAccess.class);
IUnitOfWork<Boolean, ResourceSet> isEmpty = new IUnitOfWork<Boolean, ResourceSet>() {
@Override
public Boolean exec(ResourceSet state) throws Exception {
return state.getResources().get(0).getContents().isEmpty();
}
};
assertTrue(access.readOnly(uri, isEmpty));
XtextEditor editor = openEditor(file);
runAsyncJobs();
assertTrue(access.readOnly(uri, isEmpty));
editor.getDocument().set("A");
runAsyncJobs();
waitForReconciler(editor);
runAsyncJobs();
assertFalse(access.readOnly(uri, isEmpty));
editor.close(false);
runAsyncJobs();
assertTrue(access.readOnly(uri, isEmpty));
}
Aggregations