use of org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder in project xtext-core by eclipse.
the class ElementFinderTest method testFindRuleCalls.
@Test
public void testFindRuleCalls() {
AbstractGrammarElementFinder f = grammarFinder();
AbstractRule r = GrammarUtil.findRuleForName(f.getGrammar(), "FinderKeywords");
assertEquals(2, f.findRuleCalls(r).size());
}
use of org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder in project xtext-core by eclipse.
the class ElementFinderTest method testFindCrossReferences.
@Test
public void testFindCrossReferences() {
AbstractGrammarElementFinder f = grammarFinder();
AbstractRule r = GrammarUtil.findRuleForName(f.getGrammar(), "FQN");
assertNotNull(r);
assertEquals(1, f.findCrossReferences(r).size());
EClass type = (EClass) GrammarUtil.findRuleForName(f.getGrammar(), "Type").getType().getClassifier();
assertNotNull(type);
assertEquals(1, f.findCrossReferences(type).size());
}
use of org.eclipse.xtext.service.AbstractElementFinder.AbstractGrammarElementFinder in project xtext-core by eclipse.
the class ElementFinderTest method grammarFinder.
private AbstractGrammarElementFinder grammarFinder() {
final String file = "classpath:/org/eclipse/xtext/generator/grammarAccess/ElementFinderTestLanguage.xtext";
XtextResourceSet rs = get(XtextResourceSet.class);
rs.setClasspathURIContext(getClass());
final Resource r = rs.getResource(URI.createURI(file), true);
return new AbstractGrammarElementFinder() {
@Override
public Grammar getGrammar() {
return (Grammar) r.getContents().get(0);
}
};
}
Aggregations