Java Code Examples for org.eclipse.xtext.IGrammarAccess

The following examples show how to use org.eclipse.xtext.IGrammarAccess. These examples are extracted from open source projects. 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
/**
 * Finds the {@link IResourceServiceProvider} for a language by given its id.
 *
 * @param languageId
 *          the language id (grammar name)
 * @return the {@link IResourceServiceProvider} for the given language id
 */
public IResourceServiceProvider getResourceServiceProviderById(final String languageId) {
  ImmutableMap<Map<String, Object>, ? extends Function<String, IResourceServiceProvider>> resourceProvidersMap = getProviderMaps();
  for (Map.Entry<Map<String, Object>, ? extends Function<String, IResourceServiceProvider>> mapEntry : resourceProvidersMap.entrySet()) {
    Map<String, Object> map = mapEntry.getKey();
    for (Map.Entry<String, Object> entry : map.entrySet()) {
      try {
        IResourceServiceProvider resourceServiceProvider = mapEntry.getValue().apply(entry.getKey());
        if (resourceServiceProvider == null) {
          continue;
        }
        IGrammarAccess grammarAccess = resourceServiceProvider.get(IGrammarAccess.class);
        if (grammarAccess != null && grammarAccess.getGrammar().getName().equals(languageId)) {
          return resourceServiceProvider;
        }
        // CHECKSTYLE:OFF
      } catch (ConfigurationException ex) {
        // CHECKSTYLE:ON
        // ignore
      }
    }
  }
  return null;
}
 
Example 2
Source Project: n4js   Source File: N4JSSyntacticSequencer.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (N4JSGrammarAccess) access;
	match_AnnotatedN4MemberDeclaration_SemicolonKeyword_1_0_2_q = new TokenAlias(false, true, grammarAccess.getAnnotatedN4MemberDeclarationAccess().getSemicolonKeyword_1_0_2());
	match_AnnotatedN4MemberDeclaration_SemicolonKeyword_1_1_6_q = new TokenAlias(false, true, grammarAccess.getAnnotatedN4MemberDeclarationAccess().getSemicolonKeyword_1_1_6());
	match_AnnotatedN4MemberDeclaration_SemicolonKeyword_1_2_1_q = new TokenAlias(false, true, grammarAccess.getAnnotatedN4MemberDeclarationAccess().getSemicolonKeyword_1_2_1());
	match_AnnotatedPropertyAssignment_SemicolonKeyword_1_3_1_q = new TokenAlias(false, true, grammarAccess.getAnnotatedPropertyAssignmentAccess().getSemicolonKeyword_1_3_1());
	match_AnnotationNoAtSign___LeftParenthesisKeyword_1_0_RightParenthesisKeyword_1_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getAnnotationNoAtSignAccess().getLeftParenthesisKeyword_1_0()), new TokenAlias(false, false, grammarAccess.getAnnotationNoAtSignAccess().getRightParenthesisKeyword_1_2()));
	match_ArrayBindingPattern_CommaKeyword_3_2_0_q = new TokenAlias(false, true, grammarAccess.getArrayBindingPatternAccess().getCommaKeyword_3_2_0());
	match_ArrowFunctionTypeExpression_FunctionTypeExpressionOLD_LeftParenthesisKeyword_0_0_1_or___LeftCurlyBracketKeyword_1_FunctionKeyword_3_LeftParenthesisKeyword_5__ = new AlternativeAlias(false, false, new GroupAlias(false, false, new TokenAlias(false, false, grammarAccess.getFunctionTypeExpressionOLDAccess().getLeftCurlyBracketKeyword_1()), new TokenAlias(false, false, grammarAccess.getFunctionTypeExpressionOLDAccess().getFunctionKeyword_3()), new TokenAlias(false, false, grammarAccess.getFunctionTypeExpressionOLDAccess().getLeftParenthesisKeyword_5())), new TokenAlias(false, false, grammarAccess.getArrowFunctionTypeExpressionAccess().getLeftParenthesisKeyword_0_0_1()));
	match_DoStatement_SemiParserRuleCall_6_q = new TokenAlias(false, true, grammarAccess.getDoStatementAccess().getSemiParserRuleCall_6());
	match_ExportClause_CommaKeyword_1_2_q = new TokenAlias(false, true, grammarAccess.getExportClauseAccess().getCommaKeyword_1_2());
	match_FunctionDeclaration_SemiParserRuleCall_1_q = new TokenAlias(false, true, grammarAccess.getFunctionDeclarationAccess().getSemiParserRuleCall_1());
	match_ImportSpecifiersExceptDefault_CommaKeyword_1_1_2_q = new TokenAlias(false, true, grammarAccess.getImportSpecifiersExceptDefaultAccess().getCommaKeyword_1_1_2());
	match_InterfaceExtendsList_ExtendsKeyword_0_0_or_ImplementsKeyword_0_1 = new AlternativeAlias(false, false, new TokenAlias(false, false, grammarAccess.getInterfaceExtendsListAccess().getExtendsKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getInterfaceExtendsListAccess().getImplementsKeyword_0_1()));
	match_N4CallableConstructorDeclaration_SemicolonKeyword_1_q = new TokenAlias(false, true, grammarAccess.getN4CallableConstructorDeclarationAccess().getSemicolonKeyword_1());
	match_N4GetterDeclaration_SemicolonKeyword_2_q = new TokenAlias(false, true, grammarAccess.getN4GetterDeclarationAccess().getSemicolonKeyword_2());
	match_N4MethodDeclaration_SemicolonKeyword_1_q = new TokenAlias(false, true, grammarAccess.getN4MethodDeclarationAccess().getSemicolonKeyword_1());
	match_N4SetterDeclaration_SemicolonKeyword_6_q = new TokenAlias(false, true, grammarAccess.getN4SetterDeclarationAccess().getSemicolonKeyword_6());
	match_NoLineTerminator_NO_LINE_TERMINATORTerminalRuleCall_q = new TokenAlias(false, true, grammarAccess.getNoLineTerminatorAccess().getNO_LINE_TERMINATORTerminalRuleCall());
	match_ObjectLiteral_CommaKeyword_2_2_q = new TokenAlias(false, true, grammarAccess.getObjectLiteralAccess().getCommaKeyword_2_2());
	match_PrimaryTypeExpression_LeftParenthesisKeyword_3_0_a = new TokenAlias(true, true, grammarAccess.getPrimaryTypeExpressionAccess().getLeftParenthesisKeyword_3_0());
	match_PrimaryTypeExpression_LeftParenthesisKeyword_3_0_p = new TokenAlias(true, false, grammarAccess.getPrimaryTypeExpressionAccess().getLeftParenthesisKeyword_3_0());
	match_PropertyMethodDeclaration_SemicolonKeyword_1_q = new TokenAlias(false, true, grammarAccess.getPropertyMethodDeclarationAccess().getSemicolonKeyword_1());
	match_TStructMemberList___CommaKeyword_1_1_1_or_SemicolonKeyword_1_1_0__q = new AlternativeAlias(false, true, new TokenAlias(false, false, grammarAccess.getTStructMemberListAccess().getCommaKeyword_1_1_1()), new TokenAlias(false, false, grammarAccess.getTStructMemberListAccess().getSemicolonKeyword_1_1_0()));
}
 
Example 3
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (XtendGrammarAccess) access;
	match_AnnotationField_SemicolonKeyword_2_0_2_q = new TokenAlias(false, true, grammarAccess.getAnnotationFieldAccess().getSemicolonKeyword_2_0_2());
	match_AnnotationField_SemicolonKeyword_2_3_6_q = new TokenAlias(false, true, grammarAccess.getAnnotationFieldAccess().getSemicolonKeyword_2_3_6());
	match_File_SemicolonKeyword_0_2_q = new TokenAlias(false, true, grammarAccess.getFileAccess().getSemicolonKeyword_0_2());
	match_Member_SemicolonKeyword_2_0_4_q = new TokenAlias(false, true, grammarAccess.getMemberAccess().getSemicolonKeyword_2_0_4());
	match_Member_SemicolonKeyword_2_1_9_2_q = new TokenAlias(false, true, grammarAccess.getMemberAccess().getSemicolonKeyword_2_1_9_2());
	match_Member_SemicolonKeyword_2_5_6_q = new TokenAlias(false, true, grammarAccess.getMemberAccess().getSemicolonKeyword_2_5_6());
	match_Type_SemicolonKeyword_2_2_6_q = new TokenAlias(false, true, grammarAccess.getTypeAccess().getSemicolonKeyword_2_2_6());
	match_XAnnotation___LeftParenthesisKeyword_3_0_RightParenthesisKeyword_3_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXAnnotationAccess().getLeftParenthesisKeyword_3_0()), new TokenAlias(false, false, grammarAccess.getXAnnotationAccess().getRightParenthesisKeyword_3_2()));
	match_XBlockExpression_SemicolonKeyword_2_1_q = new TokenAlias(false, true, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
	match_XExpressionInClosure_SemicolonKeyword_1_1_q = new TokenAlias(false, true, grammarAccess.getXExpressionInClosureAccess().getSemicolonKeyword_1_1());
	match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()));
	match_XImportDeclaration_SemicolonKeyword_2_q = new TokenAlias(false, true, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
	match_XTryCatchFinallyExpression_SemicolonKeyword_2_0_3_q = new TokenAlias(false, true, grammarAccess.getXTryCatchFinallyExpressionAccess().getSemicolonKeyword_2_0_3());
}
 
Example 4
Source Project: xtext-core   Source File: GrammarAccessFragment2.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void generate() {
  final GuiceModuleAccess.BindingFactory bindingFactory = new GuiceModuleAccess.BindingFactory();
  String _name = this.getLanguage().getGrammar().getName();
  boolean _notEquals = (!Objects.equal(_name, "org.eclipse.xtext.common.Terminals"));
  if (_notEquals) {
    TypeReference _typeRef = TypeReference.typeRef(ClassLoader.class);
    StringConcatenationClient _client = new StringConcatenationClient() {
      @Override
      protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
        _builder.append("getClass().getClassLoader()");
      }
    };
    bindingFactory.addTypeToInstance(_typeRef, _client);
  }
  bindingFactory.addTypeToType(TypeReference.typeRef(IGrammarAccess.class), this._grammarAccessExtensions.getGrammarAccess(this.getLanguage().getGrammar())).contributeTo(this.getLanguage().getRuntimeGenModule());
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
    String _runtimeBasePackage_1 = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar());
    String _plus = (_runtimeBasePackage_1 + ".services");
    this.getProjectConfig().getRuntime().getManifest().getExportedPackages().addAll(
      Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList(_runtimeBasePackage, _plus)));
  }
  this.doGenerateGrammarAccess();
  this.writeGrammar();
}
 
Example 5
protected void collectKeywordsFromRule(IGrammarAccess grammarAccess, String ruleName, ImmutableSet.Builder<Keyword> builder) {
	AbstractRule rule = GrammarUtil.findRuleForName(grammarAccess.getGrammar(), ruleName);
	if (!(rule instanceof TerminalRule)) { // if someone decides to override ValidID with a terminal rule
		Iterator<EObject> i = rule.eAllContents();
		while (i.hasNext()) {
			EObject o = i.next();
			if (o instanceof Keyword) {
				builder.add((Keyword) o);
			}
		}
	}
}
 
Example 6
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (XtextTerminalsTestLanguageGrammarAccess) access;
	match_ParenthesizedAssignableElement_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getParenthesizedAssignableElementAccess().getLeftParenthesisKeyword_0());
	match_ParenthesizedAssignableElement_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getParenthesizedAssignableElementAccess().getLeftParenthesisKeyword_0());
	match_ParenthesizedElement_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getParenthesizedElementAccess().getLeftParenthesisKeyword_0());
	match_ParenthesizedElement_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getParenthesizedElementAccess().getLeftParenthesisKeyword_0());
	match_ParenthesizedTerminalElement_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getParenthesizedTerminalElementAccess().getLeftParenthesisKeyword_0());
	match_ParenthesizedTerminalElement_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getParenthesizedTerminalElementAccess().getLeftParenthesisKeyword_0());
}
 
Example 7
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (Bug462047LangGrammarAccess) access;
	match_XBlockExpression_SemicolonKeyword_2_1_q = new TokenAlias(false, true, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
	match_XExpressionInClosure_SemicolonKeyword_1_1_q = new TokenAlias(false, true, grammarAccess.getXExpressionInClosureAccess().getSemicolonKeyword_1_1());
	match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()));
	match_XImportDeclaration_SemicolonKeyword_2_q = new TokenAlias(false, true, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
}
 
Example 8
Source Project: xtext-core   Source File: FormatterTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected void serializeToTokenBuffer(String model, ITokenStream out) throws Exception {
	EObject semanticObject = get(ParseHelper.class).parse(model);
	ISerializationDiagnostic.Acceptor errors = ISerializationDiagnostic.EXCEPTION_THROWING_ACCEPTOR;
	ISemanticSequencer semantic = get(ISemanticSequencer.class);
	ISyntacticSequencer syntactic = get(ISyntacticSequencer.class);
	IHiddenTokenSequencer hidden = get(IHiddenTokenSequencer.class);
	TokenStreamSequenceAdapter tokenstream = new TokenStreamSequenceAdapter(out, getGrammarAccess().getGrammar(), errors);
	semantic.init((ISemanticSequenceAcceptor) syntactic, errors);
	ISerializationContext context = new SerializationContext.RuleContext(null, (ParserRule) get(IGrammarAccess.class).getGrammar().getRules().get(0));
	syntactic.init(context, semanticObject, (ISyntacticSequenceAcceptor) hidden, errors);
	hidden.init(context, semanticObject, tokenstream, errors);
	tokenstream.init(context);
	semantic.createSequence(context, semanticObject);
}
 
Example 9
@Inject
protected void setXtendGrammarAccess(IGrammarAccess grammarAccess) {
	ImmutableSet.Builder<Keyword> builder = ImmutableSet.builder();
	collectKeywordsFromRule(grammarAccess, "ValidID", builder);
	collectKeywordsFromRule(grammarAccess, "FeatureCallID", builder);
	collectKeywordsFromRule(grammarAccess, "InnerVarID", builder);
	contextualKeywords = builder.build();
}
 
Example 10
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (EntitiesGrammarAccess) access;
	match_XBlockExpression_SemicolonKeyword_2_1_q = new TokenAlias(false, true, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
	match_XExpressionInClosure_SemicolonKeyword_1_1_q = new TokenAlias(false, true, grammarAccess.getXExpressionInClosureAccess().getSemicolonKeyword_1_1());
	match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()));
	match_XImportDeclaration_SemicolonKeyword_2_q = new TokenAlias(false, true, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
}
 
Example 11
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (CheckCfgGrammarAccess) access;
	match_CheckConfiguration___LeftCurlyBracketKeyword_5_0_RightCurlyBracketKeyword_5_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getCheckConfigurationAccess().getLeftCurlyBracketKeyword_5_0()), new TokenAlias(false, false, grammarAccess.getCheckConfigurationAccess().getRightCurlyBracketKeyword_5_2()));
	match_XBlockExpression_SemicolonKeyword_2_1_q = new TokenAlias(false, true, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
	match_XExpressionInClosure_SemicolonKeyword_1_1_q = new TokenAlias(false, true, grammarAccess.getXExpressionInClosureAccess().getSemicolonKeyword_1_1());
	match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()));
	match_XImportDeclaration_SemicolonKeyword_2_q = new TokenAlias(false, true, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
}
 
Example 12
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (RuleEngineGrammarAccess) access;
	match_XBlockExpression_SemicolonKeyword_2_1_q = new TokenAlias(false, true, grammarAccess.getXBlockExpressionAccess().getSemicolonKeyword_2_1());
	match_XExpressionInClosure_SemicolonKeyword_1_1_q = new TokenAlias(false, true, grammarAccess.getXExpressionInClosureAccess().getSemicolonKeyword_1_1());
	match_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()), new TokenAlias(false, false, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()));
	match_XImportDeclaration_SemicolonKeyword_2_q = new TokenAlias(false, true, grammarAccess.getXImportDeclarationAccess().getSemicolonKeyword_2());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_a = new TokenAlias(true, true, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
	match_XParenthesizedExpression_LeftParenthesisKeyword_0_p = new TokenAlias(true, false, grammarAccess.getXParenthesizedExpressionAccess().getLeftParenthesisKeyword_0());
}
 
Example 13
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return FormatterTestLanguageGrammarAccess.class;
}
 
Example 14
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return XtextTerminalsTestLanguageGrammarAccess.class;
}
 
Example 15
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (ContextFinderTestLanguageGrammarAccess) access;
}
 
Example 16
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return PartialSerializationTestLanguageGrammarAccess.class;
}
 
Example 17
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return Bug301935TestLanguageGrammarAccess.class;
}
 
Example 18
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (HelloWorldGrammarAccess) access;
}
 
Example 19
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return SyntacticSequencerTestLanguageGrammarAccess.class;
}
 
Example 20
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return UnicodeTestLanguageGrammarAccess.class;
}
 
Example 21
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (NestedRefsTestLanguageGrammarAccess) access;
}
 
Example 22
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return BmTestLanguageGrammarAccess.class;
}
 
Example 23
Source Project: xtext-core   Source File: CrossRefTest.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Test public void testGetMultiValuedLinkText() throws Exception {
	with(LazyLinkingTestLanguageStandaloneSetup.class);
	crossRefSerializer =  get(ICrossReferenceSerializer.class);
	final LazyLinkingTestLanguageGrammarAccess g =  (LazyLinkingTestLanguageGrammarAccess) get(IGrammarAccess.class);
	
	final XtextResource r = CrossRefTest.this.getResourceFromStringAndExpect("type TypeA {} type TypeB { TypeA TypeC TypeB p1; }", 1);
	LogCapture log = LoggingTester.captureLogging(Level.ERROR, LazyLinkingResource.class, new Runnable() {
		@Override
		public void run() {
			Model model = (Model) r.getContents().get(0);
			assertEquals(2, model.getTypes().size());
			
			org.eclipse.xtext.linking.lazy.lazyLinking.Type type = model.getTypes().get(1);
			assertEquals("TypeB", type.getName());
			assertEquals(1, type.getProperties().size());
	
			Property prop = type.getProperties().get(0);
			assertEquals("p1", prop.getName());
			assertEquals(3, prop.getType().size());
	
			org.eclipse.xtext.linking.lazy.lazyLinking.Type propType = prop.getType().get(0);
			assertFalse(propType.eIsProxy());
			String linkText = crossRefSerializer.serializeCrossRef(prop,g.getPropertyAccess().getTypeTypeCrossReference_0_0(), propType, null);
			assertEquals("TypeA", linkText);
	
			propType = prop.getType().get(1);
			assertTrue(propType.eIsProxy());
			INode node = getCrossReferenceNode(prop, GrammarUtil.getReference(g.getPropertyAccess().getTypeTypeCrossReference_0_0()), propType);
			linkText = crossRefSerializer.serializeCrossRef(prop,g.getPropertyAccess().getTypeTypeCrossReference_0_0(), propType, node);
			assertEquals("TypeC", linkText);
	
			propType = prop.getType().get(2);
			assertFalse(propType.eIsProxy());
			node = getCrossReferenceNode(prop, GrammarUtil.getReference(g.getPropertyAccess().getTypeTypeCrossReference_0_0()), propType);
			linkText = crossRefSerializer.serializeCrossRef(prop,g.getPropertyAccess().getTypeTypeCrossReference_0_0(), propType, null);
			assertEquals("TypeB", linkText);
	
			Adapter adapter = (Adapter) NodeModelUtils.getNode(prop);
			prop.eAdapters().remove(adapter);
			propType = prop.getType().get(1);
			assertTrue(propType.eIsProxy());
			linkText = crossRefSerializer.serializeCrossRef(prop,g.getPropertyAccess().getTypeTypeCrossReference_0_0(), propType, null);
			assertNull(linkText);
		}
	});
	log.assertNumberOfLogEntries(2);
}
 
Example 24
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (SequencerTestLanguageGrammarAccess) access;
}
 
Example 25
public Class<? extends IGrammarAccess> bindIGrammarAccess() {
	return BacktrackingBug325745TestLanguageGrammarAccess.class;
}
 
Example 26
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (BacktrackingContentAssistTestLanguageGrammarAccess) access;
	match_Definition___LeftParenthesisKeyword_5_0_RightParenthesisKeyword_5_2__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getDefinitionAccess().getLeftParenthesisKeyword_5_0()), new TokenAlias(false, false, grammarAccess.getDefinitionAccess().getRightParenthesisKeyword_5_2()));
}
 
Example 27
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (IndentationAwareTestLanguageGrammarAccess) access;
}
 
Example 28
/**
 * Returns the {@link IGrammarAccess}.
 * 
 * @return the {@link IGrammarAccess}, never {@code null}
 */
protected IGrammarAccess getGrammarAccess() {
  final IGrammarAccess grammarAccess = getXtextTestUtil().get(IGrammarAccess.class);
  assertNotNull("The IGrammarAccess must be registered in order to test the IValueConverterService.", grammarAccess);
  return grammarAccess;
}
 
Example 29
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (IgnoreCaseNamespacesTestLanguageGrammarAccess) access;
}
 
Example 30
@Inject
protected void init(IGrammarAccess access) {
	grammarAccess = (Bug289524TestLanguageGrammarAccess) access;
}