Class XtextGeneratorLanguage

  • All Implemented Interfaces:
    IGuiceAwareGeneratorComponent, IXtextGeneratorFragment, IXtextGeneratorLanguage
    Direct Known Subclasses:
    StandardLanguage

    public class XtextGeneratorLanguage
    extends CompositeGeneratorFragment2
    implements IXtextGeneratorLanguage
    Configuration for an Xtext language. Use this class if you need to specify exactly which generator fragments you want to include, or alternatively StandardLanguage to work with the standard fragments.

    The most important property is name, which should be set to the language name exactly as specified in the grammar file. If the default grammar resolution based on the name does not work in your particular scenario, set the grammarUri property instead. Furthermore, use fileExtensions to specify the file extensions for your language.

    Generator fragments can be added with the fragment property. See StandardLanguage for a list of useful fragments.

    Noextend:
    This class should not be extended by clients.
    • Constructor Detail

      • XtextGeneratorLanguage

        public XtextGeneratorLanguage()
    • Method Detail

      • setGrammarUri

        public void setGrammarUri​(java.lang.String uri)
        The URI of the grammar file. Use this property if the automatic grammar resolution based on setName(String) does not work in your particular scenario.
      • getGrammarUri

        public java.lang.String getGrammarUri()
      • setName

        public void setName​(java.lang.String name)
        The language name exactly as specified in the grammar.
      • getName

        public final java.lang.String getName()
        Since:
        2.26
      • setFileExtensions

        public void setFileExtensions​(java.lang.String fileExtensions)
        Either a single file extension or a comma-separated list of extensions for which the language shall be registered.
      • addReferencedResource

        public void addReferencedResource​(java.lang.String referencedResource)
        Add a resource to be included in the resource set that will be used to load the grammar file. This is often necessary if additional Ecore models are referenced by the grammar.
      • initialize

        public void initialize​(org.eclipse.xtext.Grammar grammar)
      • validateGrammar

        protected void validateGrammar​(org.eclipse.xtext.Grammar grammar)
      • validateAllImports

        protected void validateAllImports​(org.eclipse.xtext.Grammar grammar)
      • validateReferencedMetamodel

        protected void validateReferencedMetamodel​(org.eclipse.xtext.ReferencedMetamodel ref)
      • getRuleNames

        public org.eclipse.xtext.xtext.RuleNames getRuleNames()
      • getReferencedResources

        public java.util.List<java.lang.String> getReferencedResources()
      • setResourceSet

        public void setResourceSet​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      • getGuiceModule

        public com.google.inject.Module getGuiceModule()
      • setGuiceModule

        public void setGuiceModule​(com.google.inject.Module guiceModule)