summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Efftinge2011-09-13 05:42:16 (EDT)
committerEd Merks2011-09-13 05:42:16 (EDT)
commitc2979daddf0c4a57a83460f6d6a44f528c34fb71 (patch)
tree802c6329919ac182407a848b6f9d193e3bf25f85
parent541bdab1a8ffbb3c5df0a32f71ac4ce27a7470a2 (diff)
downloadorg.eclipse.emf-c2979daddf0c4a57a83460f6d6a44f528c34fb71.zip
org.eclipse.emf-c2979daddf0c4a57a83460f6d6a44f528c34fb71.tar.gz
org.eclipse.emf-c2979daddf0c4a57a83460f6d6a44f528c34fb71.tar.bz2
updated to work with latest changes in Xbase
-rw-r--r--org.eclipse.emf.ecore.xcore.ui/src-gen/org/eclipse/emf/ecore/xcore/ui/AbstractXcoreUiModule.java10
-rw-r--r--org.eclipse.emf.ecore.xcore/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.emf.ecore.xcore/src-gen/org/eclipse/emf/ecore/xcore/AbstractXcoreRuntimeModule.java40
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java20
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/linking/XcoreLazyLinker.java21
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java18
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java32
-rw-r--r--org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java234
8 files changed, 295 insertions, 81 deletions
diff --git a/org.eclipse.emf.ecore.xcore.ui/src-gen/org/eclipse/emf/ecore/xcore/ui/AbstractXcoreUiModule.java b/org.eclipse.emf.ecore.xcore.ui/src-gen/org/eclipse/emf/ecore/xcore/ui/AbstractXcoreUiModule.java
index 5e3d153..9e419b2 100644
--- a/org.eclipse.emf.ecore.xcore.ui/src-gen/org/eclipse/emf/ecore/xcore/ui/AbstractXcoreUiModule.java
+++ b/org.eclipse.emf.ecore.xcore.ui/src-gen/org/eclipse/emf/ecore/xcore/ui/AbstractXcoreUiModule.java
@@ -124,6 +124,16 @@ public abstract class AbstractXcoreUiModule extends DefaultUiModule {
}
// contributed by org.eclipse.xtext.ui.generator.refactoring.RefactorElementNameFragment
+ public Class<? extends org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage> bindLanguageRootPreferencePage() {
+ return org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferencePage.class;
+ }
+
+ // contributed by org.eclipse.xtext.ui.generator.refactoring.RefactorElementNameFragment
+ public void configureIPreferenceStoreInitializer(com.google.inject.Binder binder) {
+ binder.bind(org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer.class).annotatedWith(com.google.inject.name.Names.named("RefactoringPreferences")).to(org.eclipse.xtext.ui.refactoring.ui.RefactoringPreferences.Initializer.class);
+ }
+
+ // contributed by org.eclipse.xtext.ui.generator.refactoring.RefactorElementNameFragment
public Class<? extends org.eclipse.xtext.ui.refactoring.IRenameRefactoringProvider> bindIRenameRefactoringProvider() {
return org.eclipse.xtext.common.types.ui.refactoring.JvmRenameRefactoringProvider.class;
}
diff --git a/org.eclipse.emf.ecore.xcore/META-INF/MANIFEST.MF b/org.eclipse.emf.ecore.xcore/META-INF/MANIFEST.MF
index 9022df7..be91db1 100644
--- a/org.eclipse.emf.ecore.xcore/META-INF/MANIFEST.MF
+++ b/org.eclipse.emf.ecore.xcore/META-INF/MANIFEST.MF
@@ -28,7 +28,6 @@ Export-Package: org.eclipse.emf.ecore.xcore,
org.eclipse.emf.ecore.xcore.generator,
org.eclipse.emf.ecore.xcore.impl,
org.eclipse.emf.ecore.xcore.interpreter,
- org.eclipse.emf.ecore.xcore.linking,
org.eclipse.emf.ecore.xcore.mappings,
org.eclipse.emf.ecore.xcore.parser.antlr,
org.eclipse.emf.ecore.xcore.parser.antlr.internal,
diff --git a/org.eclipse.emf.ecore.xcore/src-gen/org/eclipse/emf/ecore/xcore/AbstractXcoreRuntimeModule.java b/org.eclipse.emf.ecore.xcore/src-gen/org/eclipse/emf/ecore/xcore/AbstractXcoreRuntimeModule.java
index 8c6e46e..7cf5078 100644
--- a/org.eclipse.emf.ecore.xcore/src-gen/org/eclipse/emf/ecore/xcore/AbstractXcoreRuntimeModule.java
+++ b/org.eclipse.emf.ecore.xcore/src-gen/org/eclipse/emf/ecore/xcore/AbstractXcoreRuntimeModule.java
@@ -85,20 +85,10 @@ public abstract class AbstractXcoreRuntimeModule extends DefaultRuntimeModule {
}
// contributed by org.eclipse.xtext.generator.scoping.AbstractScopingFragment
- public Class<? extends org.eclipse.xtext.scoping.IScopeProvider> bindIScopeProvider() {
- return org.eclipse.emf.ecore.xcore.scoping.XcoreScopeProvider.class;
- }
-
- // contributed by org.eclipse.xtext.generator.scoping.AbstractScopingFragment
public void configureIgnoreCaseLinking(com.google.inject.Binder binder) {
binder.bindConstant().annotatedWith(org.eclipse.xtext.scoping.IgnoreCaseLinking.class).to(false);
}
- // contributed by org.eclipse.xtext.generator.exporting.QualifiedNamesFragment
- public Class<? extends org.eclipse.xtext.naming.IQualifiedNameProvider> bindIQualifiedNameProvider() {
- return org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider.class;
- }
-
// contributed by org.eclipse.xtext.generator.formatting.FormatterFragment
public Class<? extends org.eclipse.xtext.formatting.IFormatter> bindIFormatter() {
return org.eclipse.emf.ecore.xcore.formatting.XcoreFormatter.class;
@@ -165,6 +155,11 @@ public abstract class AbstractXcoreRuntimeModule extends DefaultRuntimeModule {
}
// contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
+ public Class<? extends org.eclipse.xtext.naming.IQualifiedNameProvider> bindIQualifiedNameProvider() {
+ return org.eclipse.xtext.xbase.scoping.XbaseQualifiedNameProvider.class;
+ }
+
+ // contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public Class<? extends org.eclipse.xtext.xbase.typing.ITypeProvider> bindITypeProvider() {
return org.eclipse.xtext.xbase.typing.XbaseTypeProvider.class;
}
@@ -185,6 +180,11 @@ public abstract class AbstractXcoreRuntimeModule extends DefaultRuntimeModule {
}
// contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
+ public Class<? extends org.eclipse.xtext.scoping.IScopeProvider> bindIScopeProvider() {
+ return org.eclipse.xtext.xbase.scoping.XbaseScopeProvider.class;
+ }
+
+ // contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public Class<? extends org.eclipse.xtext.common.types.util.TypeConformanceComputer> bindTypeConformanceComputer() {
return org.eclipse.xtext.xbase.typing.XbaseTypeConformanceComputer.class;
}
@@ -205,6 +205,11 @@ public abstract class AbstractXcoreRuntimeModule extends DefaultRuntimeModule {
}
// contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
+ public Class<? extends org.eclipse.xtext.resource.ILateInitialization> bindILateInitialization() {
+ return org.eclipse.xtext.xbase.resource.JvmModelInferringInitializer.class;
+ }
+
+ // contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public Class<? extends org.eclipse.xtext.resource.ILocationInFileProvider> bindILocationInFileProvider() {
return org.eclipse.xtext.xbase.jvmmodel.JvmLocationInFileProvider.class;
}
@@ -215,21 +220,6 @@ public abstract class AbstractXcoreRuntimeModule extends DefaultRuntimeModule {
}
// contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
- public Class<? extends org.eclipse.xtext.linking.ILinker> bindILinker() {
- return org.eclipse.xtext.xbase.jvmmodel.JvmModelXbaseLazyLinker.class;
- }
-
- // contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
- public Class<? extends org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociations> bindIJvmModelAssociations() {
- return org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator.class;
- }
-
- // contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
- public Class<? extends org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociator> bindIJvmModelAssociator() {
- return org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator.class;
- }
-
- // contributed by org.eclipse.xtext.generator.xbase.XbaseGeneratorFragment
public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
return org.eclipse.xtext.xbase.jvmmodel.JvmGlobalScopeProvider.class;
}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java
index 37915bb..10737b2 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java
@@ -6,7 +6,6 @@ package org.eclipse.emf.ecore.xcore;
import org.eclipse.emf.ecore.util.Diagnostician;
import org.eclipse.emf.ecore.xcore.conversion.FixedQualifiedNameValueConverter;
import org.eclipse.emf.ecore.xcore.conversion.ValueConverterService;
-import org.eclipse.emf.ecore.xcore.linking.XcoreLazyLinker;
import org.eclipse.emf.ecore.xcore.resource.XcoreResource;
import org.eclipse.emf.ecore.xcore.scoping.XcoreIdentifableSimpleNameProvider;
import org.eclipse.emf.ecore.xcore.scoping.XcoreImportedNamespaceAwareScopeProvider;
@@ -17,10 +16,10 @@ import org.eclipse.emf.ecore.xcore.validation.XcoreDiagnosticConverter;
import org.eclipse.emf.ecore.xcore.validation.XcoreDiagnostician;
import org.eclipse.xtext.conversion.IValueConverterService;
import org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter;
-import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
+import org.eclipse.xtext.resource.ILateInitialization;
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.scoping.IScopeProvider;
@@ -39,11 +38,6 @@ import com.google.inject.name.Names;
*/
public class XcoreRuntimeModule extends org.eclipse.emf.ecore.xcore.AbstractXcoreRuntimeModule
{
- @Override
- public Class<? extends ILinker> bindILinker()
- {
- return XcoreLazyLinker.class;
- }
@Override
public Class<? extends ISerializer> bindISerializer()
@@ -74,6 +68,12 @@ public class XcoreRuntimeModule extends org.eclipse.emf.ecore.xcore.AbstractXcor
binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(XcoreImportedNamespaceAwareScopeProvider.class);
}
+ @Override
+ public Class<? extends IScopeProvider> bindIScopeProvider()
+ {
+ return org.eclipse.emf.ecore.xcore.scoping.XcoreScopeProvider.class;
+ }
+
public Class<? extends IResourceDescription.Manager> bindIResourceDescriptionManager()
{
return XcoreResourceDescriptionManager.class;
@@ -110,4 +110,10 @@ public class XcoreRuntimeModule extends org.eclipse.emf.ecore.xcore.AbstractXcor
public Class<? extends QualifiedNameValueConverter> bindFixedQualifiedNameValueConverter() {
return FixedQualifiedNameValueConverter.class;
}
+
+ @Override
+ public Class<? extends ILateInitialization> bindILateInitialization()
+ {
+ return org.eclipse.emf.ecore.xcore.resource.LateInferrer.class;
+ }
}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/linking/XcoreLazyLinker.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/linking/XcoreLazyLinker.java
deleted file mode 100644
index f43830b..0000000
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/linking/XcoreLazyLinker.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.emf.ecore.xcore.linking;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.xtext.diagnostics.IDiagnosticConsumer;
-import org.eclipse.xtext.xbase.jvmmodel.JvmModelXbaseLazyLinker;
-
-public class XcoreLazyLinker extends JvmModelXbaseLazyLinker
-{
- @Override
- protected void beforeModelLinked(EObject model, IDiagnosticConsumer diagnosticsConsumer)
- {
- // Do nothing.
- }
-
-
- @Override
- protected void afterModelLinked(EObject model, IDiagnosticConsumer diagnosticsConsumer)
- {
- // do nothing
- }
-}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java
new file mode 100644
index 0000000..c73dc6e
--- /dev/null
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java
@@ -0,0 +1,18 @@
+package org.eclipse.emf.ecore.xcore.resource;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.resource.ILateInitialization;
+
+public class LateInferrer implements ILateInitialization
+{
+
+ public void doLateInitialization(EList<EObject> resourcesContentsList)
+ {
+ }
+
+ public void discardLateInitialization(EList<EObject> resourcesContentsList)
+ {
+ }
+
+}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java
index 6fc345d..aa28dcd 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java
@@ -3,14 +3,12 @@ package org.eclipse.emf.ecore.xcore.resource;
import java.util.Iterator;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xcore.XModelElement;
import org.eclipse.emf.ecore.xcore.XPackage;
import org.eclipse.emf.ecore.xcore.mappings.XcoreMapper;
import org.eclipse.emf.ecore.xcore.scoping.LazyCreationProxyUriConverter;
@@ -21,7 +19,6 @@ import org.eclipse.xtext.common.types.JvmGenericType;
import org.eclipse.xtext.common.types.TypesPackage;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;
-import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.IScopeProvider;
@@ -54,26 +51,10 @@ public class XcoreResource extends XbaseResource {
@Inject
private XcoreMapper mapper;
- protected boolean fullyInitialized;
-
- @Override
- public EList<EObject> getContents() {
- if (!isLoading && !isUpdating && !fullyInitialized) {
- try {
- eSetDeliver(false);
- isLoading = true;
- lateInitialize();
- fullyInitialized = true;
- } finally {
- isLoading = false;
- eSetDeliver(true);
- }
- }
- return super.getContents();
- }
-
- @Override
- protected void updateInternalState(IParseResult parseResult) {
+
+ @Override
+ protected void discardLateInitializedState()
+ {
EList<EObject> contents = getContents();
int size = contents.size();
if (size > 1)
@@ -90,13 +71,10 @@ public class XcoreResource extends XbaseResource {
mapper.unsetMapping((XPackage)eObject);
}
}
- contents.clear();
}
- fullyInitialized = false;
- super.updateInternalState(parseResult);
}
- protected void lateInitialize()
+ protected void installLateInitializedState()
{
if (getParseResult() != null && getParseResult().getRootASTElement() instanceof XPackage)
{
diff --git a/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java b/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java
new file mode 100644
index 0000000..b4928ca
--- /dev/null
+++ b/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/generator/XcoreGenerator.java
@@ -0,0 +1,234 @@
+package org.eclipse.emf.ecore.xcore.generator;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage;
+import org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xcore.XDataType;
+import org.eclipse.emf.ecore.xcore.XOperation;
+import org.eclipse.emf.ecore.xcore.XPackage;
+import org.eclipse.emf.ecore.xcore.XStructuralFeature;
+import org.eclipse.emf.ecore.xcore.generator.XcoreAppendable;
+import org.eclipse.emf.ecore.xcore.generator.XcoreGeneratorImpl;
+import org.eclipse.emf.ecore.xcore.mappings.XDataTypeMapping;
+import org.eclipse.emf.ecore.xcore.mappings.XFeatureMapping;
+import org.eclipse.emf.ecore.xcore.mappings.XOperationMapping;
+import org.eclipse.emf.ecore.xcore.mappings.XcoreMapper;
+import org.eclipse.xtext.common.types.JvmDeclaredType;
+import org.eclipse.xtext.common.types.JvmFormalParameter;
+import org.eclipse.xtext.common.types.JvmOperation;
+import org.eclipse.xtext.common.types.util.TypeReferences;
+import org.eclipse.xtext.generator.IFileSystemAccess;
+import org.eclipse.xtext.generator.IGenerator;
+import org.eclipse.xtext.xbase.XBlockExpression;
+import org.eclipse.xtext.xbase.compiler.XbaseCompiler;
+import org.eclipse.xtext.xbase.lib.BooleanExtensions;
+import org.eclipse.xtext.xbase.lib.IntegerExtensions;
+import org.eclipse.xtext.xbase.lib.IterableExtensions;
+import org.eclipse.xtext.xbase.lib.ObjectExtensions;
+import org.eclipse.xtext.xtend2.lib.EObjectExtensions;
+
+@SuppressWarnings("all")
+public class XcoreGenerator implements IGenerator {
+
+ @Inject
+ private XcoreMapper mappings;
+
+ @Inject
+ private XbaseCompiler compiler;
+
+ @Inject
+ private Provider<XcoreGeneratorImpl> xcoreGeneratorImplProvider;
+
+ @Inject
+ private TypeReferences typeReferences;
+
+ public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
+ {
+ EList<EObject> _contents = resource.getContents();
+ EObject _head = IterableExtensions.<EObject>head(_contents);
+ final XPackage pack = ((XPackage) _head);
+ Iterable<EObject> _allContentsIterable = EObjectExtensions.allContentsIterable(pack);
+ Iterable<XOperation> _filter = IterableExtensions.<XOperation>filter(_allContentsIterable, org.eclipse.emf.ecore.xcore.XOperation.class);
+ for (final XOperation op : _filter) {
+ {
+ XOperationMapping _mapping = this.mappings.getMapping(op);
+ EOperation _eOperation = _mapping.getEOperation();
+ final EOperation eOperation = _eOperation;
+ XBlockExpression _body = op.getBody();
+ final XBlockExpression body = _body;
+ boolean _operator_notEquals = ObjectExtensions.operator_notEquals(body, null);
+ if (_operator_notEquals) {
+ {
+ XcoreAppendable _createAppendable = this.createAppendable();
+ final XcoreAppendable appendable = _createAppendable;
+ XOperationMapping _mapping_1 = this.mappings.getMapping(op);
+ JvmOperation _jvmOperation = _mapping_1.getJvmOperation();
+ JvmDeclaredType _declaringType = _jvmOperation.getDeclaringType();
+ appendable.declareVariable(_declaringType, "this");
+ this.compiler.compile(body, appendable, null);
+ String _string = appendable.toString();
+ String _extractBody = this.extractBody(_string);
+ EcoreUtil.setAnnotation(eOperation, GenModelPackage.eNS_URI, "body", _extractBody);
+ }
+ }
+ }
+ }
+ Iterable<EObject> _allContentsIterable_1 = EObjectExtensions.allContentsIterable(pack);
+ Iterable<XStructuralFeature> _filter_1 = IterableExtensions.<XStructuralFeature>filter(_allContentsIterable_1, org.eclipse.emf.ecore.xcore.XStructuralFeature.class);
+ for (final XStructuralFeature feature : _filter_1) {
+ {
+ XFeatureMapping _mapping_2 = this.mappings.getMapping(feature);
+ EStructuralFeature _eStructuralFeature = _mapping_2.getEStructuralFeature();
+ final EStructuralFeature eStructuralFeature = _eStructuralFeature;
+ XBlockExpression _getBody = feature.getGetBody();
+ final XBlockExpression getBody = _getBody;
+ boolean _operator_notEquals_1 = ObjectExtensions.operator_notEquals(getBody, null);
+ if (_operator_notEquals_1) {
+ {
+ XFeatureMapping _mapping_3 = this.mappings.getMapping(feature);
+ JvmOperation _getter = _mapping_3.getGetter();
+ final JvmOperation getter = _getter;
+ XcoreAppendable _createAppendable_1 = this.createAppendable();
+ final XcoreAppendable appendable_1 = _createAppendable_1;
+ JvmDeclaredType _declaringType_1 = getter.getDeclaringType();
+ appendable_1.declareVariable(_declaringType_1, "this");
+ this.compiler.compile(getBody, appendable_1, null);
+ String _string_1 = appendable_1.toString();
+ String _extractBody_1 = this.extractBody(_string_1);
+ EcoreUtil.setAnnotation(eStructuralFeature, GenModelPackage.eNS_URI, "get", _extractBody_1);
+ }
+ }
+ }
+ }
+ Iterable<EObject> _allContentsIterable_2 = EObjectExtensions.allContentsIterable(pack);
+ Iterable<XDataType> _filter_2 = IterableExtensions.<XDataType>filter(_allContentsIterable_2, org.eclipse.emf.ecore.xcore.XDataType.class);
+ for (final XDataType dataType : _filter_2) {
+ {
+ XDataTypeMapping _mapping_4 = this.mappings.getMapping(dataType);
+ EDataType _eDataType = _mapping_4.getEDataType();
+ final EDataType eDataType = _eDataType;
+ XBlockExpression _createBody = dataType.getCreateBody();
+ final XBlockExpression createBody = _createBody;
+ XDataTypeMapping _mapping_5 = this.mappings.getMapping(dataType);
+ JvmOperation _creator = _mapping_5.getCreator();
+ final JvmOperation creator = _creator;
+ boolean _operator_and = false;
+ boolean _operator_notEquals_2 = ObjectExtensions.operator_notEquals(createBody, null);
+ if (!_operator_notEquals_2) {
+ _operator_and = false;
+ } else {
+ boolean _operator_notEquals_3 = ObjectExtensions.operator_notEquals(creator, null);
+ _operator_and = BooleanExtensions.operator_and(_operator_notEquals_2, _operator_notEquals_3);
+ }
+ if (_operator_and) {
+ {
+ XcoreAppendable _createAppendable_2 = this.createAppendable();
+ final XcoreAppendable appendable_2 = _createAppendable_2;
+ EList<JvmFormalParameter> _parameters = creator.getParameters();
+ JvmFormalParameter _get = _parameters.get(0);
+ appendable_2.declareVariable(_get, "it");
+ this.compiler.compile(createBody, appendable_2, null);
+ String _string_2 = appendable_2.toString();
+ String _extractBody_2 = this.extractBody(_string_2);
+ EcoreUtil.setAnnotation(eDataType, GenModelPackage.eNS_URI, "create", _extractBody_2);
+ }
+ }
+ XBlockExpression _convertBody = dataType.getConvertBody();
+ final XBlockExpression convertBody = _convertBody;
+ XDataTypeMapping _mapping_6 = this.mappings.getMapping(dataType);
+ JvmOperation _converter = _mapping_6.getConverter();
+ final JvmOperation converter = _converter;
+ boolean _operator_and_1 = false;
+ boolean _operator_notEquals_4 = ObjectExtensions.operator_notEquals(convertBody, null);
+ if (!_operator_notEquals_4) {
+ _operator_and_1 = false;
+ } else {
+ boolean _operator_notEquals_5 = ObjectExtensions.operator_notEquals(converter, null);
+ _operator_and_1 = BooleanExtensions.operator_and(_operator_notEquals_4, _operator_notEquals_5);
+ }
+ if (_operator_and_1) {
+ {
+ XcoreAppendable _createAppendable_3 = this.createAppendable();
+ final XcoreAppendable appendable_3 = _createAppendable_3;
+ EList<JvmFormalParameter> _parameters_1 = converter.getParameters();
+ JvmFormalParameter _get_1 = _parameters_1.get(0);
+ appendable_3.declareVariable(_get_1, "it");
+ this.compiler.compile(convertBody, appendable_3, null);
+ String _string_3 = appendable_3.toString();
+ String _extractBody_3 = this.extractBody(_string_3);
+ EcoreUtil.setAnnotation(eDataType, GenModelPackage.eNS_URI, "convert", _extractBody_3);
+ }
+ }
+ }
+ }
+ EList<EObject> _contents_1 = resource.getContents();
+ Iterable<GenModel> _filter_3 = IterableExtensions.<GenModel>filter(_contents_1, org.eclipse.emf.codegen.ecore.genmodel.GenModel.class);
+ GenModel _head_1 = IterableExtensions.<GenModel>head(_filter_3);
+ this.generateGenModel(_head_1, fsa);
+ }
+ }
+
+ public XcoreAppendable createAppendable() {
+ XcoreAppendable _xcoreAppendable = new XcoreAppendable();
+ return _xcoreAppendable;
+ }
+
+ public String extractBody(final String body) {
+ String _xblockexpression = null;
+ {
+ String _xifexpression = null;
+ boolean _startsWith = body.startsWith("\n");
+ if (_startsWith) {
+ String _substring = body.substring(1);
+ _xifexpression = _substring;
+ } else {
+ _xifexpression = body;
+ }
+ String result = _xifexpression;
+ String _xifexpression_1 = null;
+ boolean _startsWith_1 = result.startsWith("{\n");
+ if (_startsWith_1) {
+ String _xblockexpression_1 = null;
+ {
+ String _replace = result.replace("\n\t", "\n");
+ result = _replace;
+ int _length = result.length();
+ int _operator_minus = IntegerExtensions.operator_minus(((Integer)_length), ((Integer)2));
+ String _substring_1 = result.substring(1, _operator_minus);
+ _xblockexpression_1 = (_substring_1);
+ }
+ _xifexpression_1 = _xblockexpression_1;
+ } else {
+ _xifexpression_1 = result;
+ }
+ _xblockexpression = (_xifexpression_1);
+ }
+ return _xblockexpression;
+ }
+
+ public Diagnostic generateGenModel(final GenModel genModel, final IFileSystemAccess fsa) {
+ Diagnostic _xblockexpression = null;
+ {
+ genModel.setCanGenerate(true);
+ XcoreGeneratorImpl _get = this.xcoreGeneratorImplProvider.get();
+ final XcoreGeneratorImpl generator = _get;
+ generator.setInput(genModel);
+ generator.setFileSystemAccess(fsa);
+ BasicMonitor _basicMonitor = new BasicMonitor();
+ Diagnostic _generate = generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, _basicMonitor);
+ _xblockexpression = (_generate);
+ }
+ return _xblockexpression;
+ }
+} \ No newline at end of file