org.eclipse.xtext.generator
Class AntlrDelegatingFragment

java.lang.Object
  extended by org.eclipse.xtext.generator.DefaultGeneratorFragment
      extended by org.eclipse.xtext.generator.AntlrDelegatingFragment
All Implemented Interfaces:
IGeneratorFragment, NamingAware

public class AntlrDelegatingFragment
extends DefaultGeneratorFragment
implements NamingAware

Delegates to an AntLR generator fragment on the classpath. Issues a warning if it cannot be located.

Author:
Sven Efftinge - Initial contribution and API

Constructor Summary
AntlrDelegatingFragment()
           
 
Method Summary
 void addToPluginXmlRt(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
          Used to add code to the plugin.xml of the runtime bundle.
 void addToPluginXmlUi(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
          Used to add code to the plugin.xml of the ui bundle.
 void addToStandaloneSetup(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
          Used to add code to the generated 'public void register(Injector injector)'-method
 void checkConfiguration(org.eclipse.emf.mwe.core.issues.Issues issues)
          Called by the container after configuration so the component can validate the configuration before invocation.
 void generate(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
          can be used to generate whatever necessary
 java.lang.String[] getExportedPackagesRt(Grammar grammar)
          return the exported packages for the runtime bundle
 java.lang.String[] getExportedPackagesUi(Grammar grammar)
          return the exported packages for the ui bundle
 java.util.Set<Binding> getGuiceBindingsRt(Grammar grammar)
          return a map containing the contributed guice bindings created in this generator fragment
 java.util.Set<Binding> getGuiceBindingsUi(Grammar grammar)
          return a map containing the contributed guice bindings for the ui part created in this generator fragment
 java.lang.String[] getRequiredBundlesRt(Grammar grammar)
          return the bundles this fragment requires at runtime
 java.lang.String[] getRequiredBundlesUi(Grammar grammar)
          return the bundles this fragment requires in ui
 void registerNaming(Naming naming)
           
 void setFragment(java.lang.String fragment)
          Set the class name of the generator fragment.
 
Methods inherited from class org.eclipse.xtext.generator.DefaultGeneratorFragment
getImportedPackagesRt, getImportedPackagesUi
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntlrDelegatingFragment

public AntlrDelegatingFragment()
Method Detail

setFragment

public void setFragment(java.lang.String fragment)
Set the class name of the generator fragment.

Parameters:
fragment -

checkConfiguration

public void checkConfiguration(org.eclipse.emf.mwe.core.issues.Issues issues)
Description copied from interface: IGeneratorFragment
Called by the container after configuration so the component can validate the configuration before invocation.

Specified by:
checkConfiguration in interface IGeneratorFragment
Overrides:
checkConfiguration in class DefaultGeneratorFragment
Parameters:
issues - implementors should report configuration issues to this.

addToPluginXmlRt

public void addToPluginXmlRt(Grammar grammar,
                             org.eclipse.xpand2.XpandExecutionContext ctx)
Description copied from interface: IGeneratorFragment
Used to add code to the plugin.xml of the runtime bundle. The surrounding tags are added automatically

Specified by:
addToPluginXmlRt in interface IGeneratorFragment
Overrides:
addToPluginXmlRt in class DefaultGeneratorFragment
ctx - - the execution context to use (the plugin.xml file is already opened)

addToPluginXmlUi

public void addToPluginXmlUi(Grammar grammar,
                             org.eclipse.xpand2.XpandExecutionContext ctx)
Description copied from interface: IGeneratorFragment
Used to add code to the plugin.xml of the ui bundle. The surrounding tags are added automatically

Specified by:
addToPluginXmlUi in interface IGeneratorFragment
Overrides:
addToPluginXmlUi in class DefaultGeneratorFragment
ctx - - the execution context to use (the plugin.xml file is already opened)

addToStandaloneSetup

public void addToStandaloneSetup(Grammar grammar,
                                 org.eclipse.xpand2.XpandExecutionContext ctx)
Description copied from interface: IGeneratorFragment
Used to add code to the generated 'public void register(Injector injector)'-method

Specified by:
addToStandaloneSetup in interface IGeneratorFragment
Overrides:
addToStandaloneSetup in class DefaultGeneratorFragment
ctx - - the execution context to use (the file is already opened, content goes into the register method)

generate

public void generate(Grammar grammar,
                     org.eclipse.xpand2.XpandExecutionContext ctx)
Description copied from interface: IGeneratorFragment
can be used to generate whatever necessary

Specified by:
generate in interface IGeneratorFragment
Overrides:
generate in class DefaultGeneratorFragment
ctx - - the execution context to use

getExportedPackagesRt

public java.lang.String[] getExportedPackagesRt(Grammar grammar)
Description copied from interface: IGeneratorFragment
return the exported packages for the runtime bundle

Specified by:
getExportedPackagesRt in interface IGeneratorFragment
Overrides:
getExportedPackagesRt in class DefaultGeneratorFragment

getExportedPackagesUi

public java.lang.String[] getExportedPackagesUi(Grammar grammar)
Description copied from interface: IGeneratorFragment
return the exported packages for the ui bundle

Specified by:
getExportedPackagesUi in interface IGeneratorFragment
Overrides:
getExportedPackagesUi in class DefaultGeneratorFragment

getGuiceBindingsRt

public java.util.Set<Binding> getGuiceBindingsRt(Grammar grammar)
Description copied from interface: IGeneratorFragment
return a map containing the contributed guice bindings created in this generator fragment

Specified by:
getGuiceBindingsRt in interface IGeneratorFragment
Overrides:
getGuiceBindingsRt in class DefaultGeneratorFragment

getGuiceBindingsUi

public java.util.Set<Binding> getGuiceBindingsUi(Grammar grammar)
Description copied from interface: IGeneratorFragment
return a map containing the contributed guice bindings for the ui part created in this generator fragment

Specified by:
getGuiceBindingsUi in interface IGeneratorFragment
Overrides:
getGuiceBindingsUi in class DefaultGeneratorFragment

getRequiredBundlesRt

public java.lang.String[] getRequiredBundlesRt(Grammar grammar)
Description copied from interface: IGeneratorFragment
return the bundles this fragment requires at runtime

Specified by:
getRequiredBundlesRt in interface IGeneratorFragment
Overrides:
getRequiredBundlesRt in class DefaultGeneratorFragment

getRequiredBundlesUi

public java.lang.String[] getRequiredBundlesUi(Grammar grammar)
Description copied from interface: IGeneratorFragment
return the bundles this fragment requires in ui

Specified by:
getRequiredBundlesUi in interface IGeneratorFragment
Overrides:
getRequiredBundlesUi in class DefaultGeneratorFragment

registerNaming

public void registerNaming(Naming naming)
Specified by:
registerNaming in interface NamingAware