org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Bug297909Test.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testReconcileDocument() throws Exception {
	Injector injector = doGetSetup().createInjectorAndDoEMFRegistration();
	XtextDocument document = injector.getInstance(XtextDocument.class);
	document.setValidationJob(new Job("Job") {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			return Status.OK_STATUS;
		}
	});
	XtextResource resource = injector.getInstance(XtextResource.class);
	XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
	resourceSet.getResources().add(resource);
	resource.load(new StringInputStream(""), Collections.singletonMap(XtextResource.OPTION_ENCODING, Charset.defaultCharset().name()));
	document.setInput(resource);
	document.set("abstract rules firstRule");
	XtextDocumentReconcileStrategy strategy = injector.getInstance(XtextDocumentReconcileStrategy.class);
	strategy.setDocument(document);
	strategy.setResource(resource);
	try {
		strategy.reconcile(new ReconcilerReplaceRegion(0, document.getLength(), document.get()));
		fail("Expected ParseException");
	} catch(ParseException expected) {
		assertTrue(expected.getMessage().contains("Make sure the EPackage has been registered"));
	}
}
 
Example #2
Source File: N4JSReconciler.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/** Creates a new instance. */
@Inject
public N4JSReconciler(XtextDocumentReconcileStrategy strategy) {
	super(strategy);
}
 
Example #3
Source File: GamlReconciler.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param strategy
 */
@Inject
public GamlReconciler(final XtextDocumentReconcileStrategy strategy) {
	super(strategy);
	setDelay(800);
}
 
Example #4
Source File: NoSpellingReconciler.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Inject
public NoSpellingReconciler(XtextDocumentReconcileStrategy strategy) {
	super(strategy);
	setReconcilingStrategy(new NoSpellingReconcileStrategy());
}