Class XtextGeneratorLanguage
- java.lang.Object
-
- org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2
-
- org.eclipse.xtext.xtext.generator.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 alternativelyStandardLanguage
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 thegrammarUri
property instead. Furthermore, usefileExtensions
to specify the file extensions for your language.Generator fragments can be added with the
fragment
property. SeeStandardLanguage
for a list of useful fragments.- Noextend:
- This class should not be extended by clients.
-
-
Constructor Summary
Constructors Constructor Description XtextGeneratorLanguage()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.GuiceModuleAccess
getEclipsePluginGenModule()
java.util.List<java.lang.String>
getFileExtensions()
org.eclipse.xtext.Grammar
getGrammar()
java.lang.String
getGrammarUri()
com.google.inject.Module
getGuiceModule()
GuiceModuleAccess
getIdeGenModule()
protected java.util.List<? extends IXtextGeneratorFragment>
getImplicitFragments()
java.lang.String
getName()
java.util.List<java.lang.String>
getReferencedResources()
org.eclipse.emf.ecore.resource.ResourceSet
getResourceSet()
org.eclipse.xtext.xtext.RuleNames
getRuleNames()
GuiceModuleAccess
getRuntimeGenModule()
StandaloneSetupAccess
getRuntimeGenSetup()
GuiceModuleAccess
getWebGenModule()
void
initialize(com.google.inject.Injector injector)
void
initialize(org.eclipse.xtext.Grammar grammar)
boolean
isGenerateXtendStubs()
Deprecated.UseCodeConfig.isPreferXtendStubs()
insteadvoid
setFileExtensions(java.lang.String fileExtensions)
Either a single file extension or a comma-separated list of extensions for which the language shall be registered.void
setGenerateXtendStubs(java.lang.Boolean generateXtendStubs)
Deprecated.UseCodeConfig.setPreferXtendStubs(boolean)
insteadvoid
setGrammarUri(java.lang.String uri)
The URI of the grammar file.void
setGuiceModule(com.google.inject.Module guiceModule)
void
setName(java.lang.String name)
The language name exactly as specified in the grammar.void
setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
protected void
validateAllImports(org.eclipse.xtext.Grammar grammar)
protected void
validateGrammar(org.eclipse.xtext.Grammar grammar)
protected void
validateReferencedMetamodel(org.eclipse.xtext.ReferencedMetamodel ref)
-
Methods inherited from class org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2
addFragment, checkConfiguration, generate, getFragments
-
-
-
-
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 onsetName(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.
-
getFileExtensions
public java.util.List<java.lang.String> getFileExtensions()
- Specified by:
getFileExtensions
in interfaceIXtextGeneratorLanguage
-
setGenerateXtendStubs
@Deprecated public void setGenerateXtendStubs(java.lang.Boolean generateXtendStubs)
Deprecated.UseCodeConfig.setPreferXtendStubs(boolean)
instead
-
isGenerateXtendStubs
@Deprecated public boolean isGenerateXtendStubs()
Deprecated.UseCodeConfig.isPreferXtendStubs()
instead- Specified by:
isGenerateXtendStubs
in interfaceIXtextGeneratorLanguage
-
initialize
public void initialize(com.google.inject.Injector injector)
- Specified by:
initialize
in interfaceIGuiceAwareGeneratorComponent
- Overrides:
initialize
in classCompositeGeneratorFragment2
-
getImplicitFragments
protected java.util.List<? extends IXtextGeneratorFragment> getImplicitFragments()
-
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)
-
getGrammar
public org.eclipse.xtext.Grammar getGrammar()
- Specified by:
getGrammar
in interfaceIXtextGeneratorLanguage
-
getRuleNames
public org.eclipse.xtext.xtext.RuleNames getRuleNames()
-
getReferencedResources
public java.util.List<java.lang.String> getReferencedResources()
-
getResourceSet
public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
- Specified by:
getResourceSet
in interfaceIXtextGeneratorLanguage
-
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)
-
getRuntimeGenSetup
public StandaloneSetupAccess getRuntimeGenSetup()
- Specified by:
getRuntimeGenSetup
in interfaceIXtextGeneratorLanguage
-
getRuntimeGenModule
public GuiceModuleAccess getRuntimeGenModule()
- Specified by:
getRuntimeGenModule
in interfaceIXtextGeneratorLanguage
-
getIdeGenModule
public GuiceModuleAccess getIdeGenModule()
- Specified by:
getIdeGenModule
in interfaceIXtextGeneratorLanguage
-
getEclipsePluginGenModule
public GuiceModuleAccess getEclipsePluginGenModule()
- Specified by:
getEclipsePluginGenModule
in interfaceIXtextGeneratorLanguage
-
getWebGenModule
public GuiceModuleAccess getWebGenModule()
- Specified by:
getWebGenModule
in interfaceIXtextGeneratorLanguage
-
-