public class EMFGeneratorFragment extends AbstractGeneratorFragment
IGeneratorFragment
that saves the generated Ecore models and creates appropriate EMF generators. Then it
runs the EMF generator to create the EMF classes for the generated Ecore models.Modifier and Type | Class and Description |
---|---|
static class |
EMFGeneratorFragment.ToPlatformResourceDeresolvingURIHandler |
Constructor and Description |
---|
EMFGeneratorFragment() |
Modifier and Type | Method and Description |
---|---|
void |
addSaveMapping(org.eclipse.emf.mwe.utils.Mapping mapping)
Deprecated.
Save mappings are no longer supported. The EcoreGeneratorFragment will use the
uri that is given in the referenced genmodel or create a platform resource uri for new files.
|
void |
addToPluginXmlRt(Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx)
Used to add code to the plugin.xml of the runtime bundle.
|
protected org.eclipse.emf.ecore.resource.Resource |
createResourceForEPackages(Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx,
java.util.List<org.eclipse.emf.ecore.EPackage> packs,
org.eclipse.emf.ecore.resource.ResourceSet rs) |
protected void |
doGenerate(org.eclipse.emf.codegen.ecore.genmodel.GenModel genModel) |
void |
generate(Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx)
can be used to generate whatever necessary
|
java.lang.String |
getBasePackage(Grammar g) |
protected org.eclipse.emf.common.util.URI |
getEcoreFileUri(Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx) |
java.lang.String |
getEditDirectory(org.eclipse.xpand2.XpandExecutionContext ctx) |
java.lang.String |
getEditorDirectory(org.eclipse.xpand2.XpandExecutionContext ctx) |
protected java.lang.String |
getEditorPluginID(org.eclipse.xpand2.XpandExecutionContext ctx) |
java.lang.String |
getEditPluginID(org.eclipse.xpand2.XpandExecutionContext ctx) |
java.lang.String[] |
getExportedPackagesRt(Grammar grammar)
return the exported packages for the runtime bundle
|
java.lang.String |
getFileExtensions() |
java.lang.String |
getGeneratedEPackageName(Grammar g,
org.eclipse.emf.ecore.EPackage pack) |
protected java.util.List<org.eclipse.emf.ecore.EPackage> |
getGeneratedEPackages(Grammar grammar) |
protected org.eclipse.emf.codegen.ecore.genmodel.GenModel |
getGenModel(org.eclipse.emf.ecore.resource.ResourceSet rs,
Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx,
java.util.List<org.eclipse.emf.ecore.EPackage> packs) |
protected org.eclipse.emf.common.util.URI |
getGenModelUri(Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx) |
protected java.util.List<org.eclipse.emf.codegen.ecore.genmodel.GenPackage> |
getGenPackagesForPackages(org.eclipse.emf.codegen.ecore.genmodel.GenModel existingGenModel,
java.util.Collection<org.eclipse.emf.ecore.EPackage> packs) |
protected java.lang.String |
getJavaModelDirectory(org.eclipse.xpand2.XpandExecutionContext ctx) |
java.lang.String |
getJdkLevel() |
protected java.lang.String |
getModelName(Grammar grammar) |
java.lang.String |
getModelPluginID(org.eclipse.xpand2.XpandExecutionContext ctx) |
protected java.util.List<java.lang.Object> |
getParameters(Grammar grammar) |
protected java.util.Set<org.eclipse.emf.ecore.EPackage> |
getReferencedEPackages(java.util.List<org.eclipse.emf.ecore.EPackage> packs) |
java.lang.String[] |
getRequiredBundlesRt(Grammar grammar)
return the bundles this fragment requires at runtime
|
protected org.eclipse.emf.codegen.ecore.genmodel.GenModel |
getSaveAndReconcileGenModel(org.eclipse.emf.ecore.resource.ResourceSet rs,
Grammar grammar,
org.eclipse.xpand2.XpandExecutionContext ctx,
java.util.List<org.eclipse.emf.ecore.EPackage> packs) |
java.lang.String |
getXmiModelDirectory() |
protected java.lang.String |
getXmiModelDirectory(Grammar grammar,
java.lang.String javaPath,
org.eclipse.xpand2.XpandExecutionContext ctx) |
boolean |
isGenerateEdit() |
boolean |
isGenerateEditor() |
boolean |
isLongFileNames() |
boolean |
isSkipGenerate() |
boolean |
isSuppressLoadInitialization() |
boolean |
isUpdateBuildProperties() |
void |
setBasePackage(java.lang.String basePackage)
the java package the generated java classes shall be placed in.
|
void |
setEditDirectory(java.lang.String editDirectory)
Sets the target directory for the generated EMF-edit code.
|
void |
setEditorDirectory(java.lang.String editorDirectory)
Sets the target directory for the generated EMF-editor code.
|
void |
setEditorPluginID(java.lang.String editorPluginId)
Sets the plug-in ID of the generated EMF editor plug-in.
|
void |
setEditPluginID(java.lang.String editPluginId)
Sets the plug-in ID of the generated EMF edit plug-in.
|
void |
setEmfRuntimeVersion(java.lang.String emfRuntimeVersion)
Sets the target EMF runtime version to generate for to the specified value.
|
void |
setFileExtensions(java.lang.String fileExtensions) |
void |
setGenerateEdit(boolean gen)
If true, the EMF-edit code will be generated as well.
|
void |
setGenerateEditor(boolean gen)
If true, the EMF editor code will be generated as well.
|
void |
setGenModel(java.lang.String genModel) |
void |
setJavaModelDirectory(java.lang.String dir)
Sets the target directory for the generated EMF-model code.
|
void |
setJdkLevel(java.lang.String jdkLevel)
Set the JDK compatibility level.
|
void |
setLongFileNames(boolean longFileNames)
Whether to use a qualified name for the xmi files, e.g.
|
void |
setModelPluginID(java.lang.String modelPluginId)
Sets the ID of the generated EMF-model plug-in.
|
void |
setSkipGenerate(boolean skipGenerate)
Whether the Java class generation should be skipped.
|
void |
setSuppressLoadInitialization(boolean suppressLoadInitialization)
The generated package implementation uses 'load initialization' if it becomes very large, which means
that an additional ecore file is generated and the package content is loaded at runtime from that file.
|
void |
setUpdateBuildProperties(boolean updateBuildProperties)
Whether the build.properties should be updated.
|
void |
setXmiModelDirectory(java.lang.String dir) |
protected java.lang.String |
toGenModelProjectPath(java.lang.String path)
required to match the path format as expected from
GenModelImpl.getProjectPath(java.lang.String) |
protected static org.eclipse.emf.common.util.URI |
toPlatformResourceURI(org.eclipse.emf.common.util.URI uri) |
addToPluginXmlTests, addToPluginXmlUi, addToStandaloneSetup, getNaming, getTemplate, readFileIntoString, registerNaming, writeStringIntoFile
addToPluginXmlRt, addToPluginXmlUi, addToStandaloneSetup, checkConfiguration, generate, getExportedPackagesIde, getExportedPackagesTests, getExportedPackagesUi, getGuiceBindingsRt, getGuiceBindingsUi, getImportedPackagesIde, getImportedPackagesRt, getImportedPackagesTests, getImportedPackagesUi, getRequiredBundlesIde, getRequiredBundlesTests, getRequiredBundlesUi
protected org.eclipse.emf.ecore.resource.Resource createResourceForEPackages(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx, java.util.List<org.eclipse.emf.ecore.EPackage> packs, org.eclipse.emf.ecore.resource.ResourceSet rs)
protected void doGenerate(org.eclipse.emf.codegen.ecore.genmodel.GenModel genModel)
public void generate(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
IGeneratorFragment
generate
in interface IGeneratorFragment
generate
in class AbstractGeneratorFragment
ctx
- - the execution context to useprotected static org.eclipse.emf.common.util.URI toPlatformResourceURI(org.eclipse.emf.common.util.URI uri)
protected java.util.Set<org.eclipse.emf.ecore.EPackage> getReferencedEPackages(java.util.List<org.eclipse.emf.ecore.EPackage> packs)
protected java.util.List<org.eclipse.emf.codegen.ecore.genmodel.GenPackage> getGenPackagesForPackages(org.eclipse.emf.codegen.ecore.genmodel.GenModel existingGenModel, java.util.Collection<org.eclipse.emf.ecore.EPackage> packs)
public java.lang.String getBasePackage(Grammar g)
protected org.eclipse.emf.common.util.URI getEcoreFileUri(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
public java.lang.String getEditDirectory(org.eclipse.xpand2.XpandExecutionContext ctx)
public java.lang.String getEditorDirectory(org.eclipse.xpand2.XpandExecutionContext ctx)
protected java.lang.String getEditorPluginID(org.eclipse.xpand2.XpandExecutionContext ctx)
public java.lang.String getEditPluginID(org.eclipse.xpand2.XpandExecutionContext ctx)
public java.lang.String[] getExportedPackagesRt(Grammar grammar)
IGeneratorFragment
getExportedPackagesRt
in interface IGeneratorFragment
getExportedPackagesRt
in class DefaultGeneratorFragment
public java.lang.String getGeneratedEPackageName(Grammar g, org.eclipse.emf.ecore.EPackage pack)
protected java.util.List<org.eclipse.emf.ecore.EPackage> getGeneratedEPackages(Grammar grammar)
protected org.eclipse.emf.codegen.ecore.genmodel.GenModel getGenModel(org.eclipse.emf.ecore.resource.ResourceSet rs, Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx, java.util.List<org.eclipse.emf.ecore.EPackage> packs)
protected org.eclipse.emf.common.util.URI getGenModelUri(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
protected java.lang.String getJavaModelDirectory(org.eclipse.xpand2.XpandExecutionContext ctx)
protected java.lang.String getModelName(Grammar grammar)
public java.lang.String getModelPluginID(org.eclipse.xpand2.XpandExecutionContext ctx)
protected java.util.List<java.lang.Object> getParameters(Grammar grammar)
getParameters
in class AbstractGeneratorFragment
public void addToPluginXmlRt(Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx)
IGeneratorFragment
addToPluginXmlRt
in interface IGeneratorFragment
addToPluginXmlRt
in class AbstractGeneratorFragment
ctx
- - the execution context to use (the plugin.xml file is already opened)public java.lang.String[] getRequiredBundlesRt(Grammar grammar)
IGeneratorFragment
getRequiredBundlesRt
in interface IGeneratorFragment
getRequiredBundlesRt
in class DefaultGeneratorFragment
protected org.eclipse.emf.codegen.ecore.genmodel.GenModel getSaveAndReconcileGenModel(org.eclipse.emf.ecore.resource.ResourceSet rs, Grammar grammar, org.eclipse.xpand2.XpandExecutionContext ctx, java.util.List<org.eclipse.emf.ecore.EPackage> packs) throws org.eclipse.emf.mwe.core.ConfigurationException
org.eclipse.emf.mwe.core.ConfigurationException
public java.lang.String getXmiModelDirectory()
protected java.lang.String getXmiModelDirectory(Grammar grammar, java.lang.String javaPath, org.eclipse.xpand2.XpandExecutionContext ctx)
public boolean isGenerateEdit()
public boolean isGenerateEditor()
public boolean isSkipGenerate()
public void setBasePackage(java.lang.String basePackage)
public void setEmfRuntimeVersion(java.lang.String emfRuntimeVersion)
emfRuntimeVersion
- the EMF runtime version.public void setEditDirectory(java.lang.String editDirectory)
editDirectory
- public void setEditorDirectory(java.lang.String editorDirectory)
editorDirectory
- public void setEditorPluginID(java.lang.String editorPluginId)
editorPluginId
- public void setEditPluginID(java.lang.String editPluginId)
editPluginId
- public void setGenerateEdit(boolean gen)
gen
- setEditDirectory(String)
,
setEditPluginID(String)
public void setGenerateEditor(boolean gen)
gen
- setEditorDirectory(String)
,
setEditorPluginID(String)
public void setGenModel(java.lang.String genModel)
public void setJavaModelDirectory(java.lang.String dir)
dir
- public void setModelPluginID(java.lang.String modelPluginId)
modelPluginId
- public void setSkipGenerate(boolean skipGenerate)
true
only the ecore file is generated.public void setXmiModelDirectory(java.lang.String dir)
public void setLongFileNames(boolean longFileNames)
org_eclipse_xtext_Xtext.ecore
rather than Xtext.ecore
.public boolean isLongFileNames()
public void setUpdateBuildProperties(boolean updateBuildProperties)
public boolean isUpdateBuildProperties()
protected java.lang.String toGenModelProjectPath(java.lang.String path)
GenModelImpl.getProjectPath(java.lang.String)
@Deprecated public void addSaveMapping(org.eclipse.emf.mwe.utils.Mapping mapping)
public void setFileExtensions(java.lang.String fileExtensions)
fileExtensions
- a comma-separated list of fileExtensions for the generated packages.public java.lang.String getFileExtensions()
public void setSuppressLoadInitialization(boolean suppressLoadInitialization)
public boolean isSuppressLoadInitialization()
public void setJdkLevel(java.lang.String jdkLevel)
public java.lang.String getJdkLevel()