Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2015-01-22 07:40:49 +0000
committerEd Merks2015-01-22 07:40:49 +0000
commit3bec4be6d1530902fb1794265ccfcb826b76a822 (patch)
treeb201f0e01d135c15f4eb62925d1ed0319a902217
parent3738eb06f1c0de3e34a6d4111d5aedb924c0b84b (diff)
downloadorg.eclipse.emf-3bec4be6d1530902fb1794265ccfcb826b76a822.tar.gz
org.eclipse.emf-3bec4be6d1530902fb1794265ccfcb826b76a822.tar.xz
org.eclipse.emf-3bec4be6d1530902fb1794265ccfcb826b76a822.zip
[458026] Improve the computation of used packages for circularityR2_10_2R2_10_maintenance
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.xtend93
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.java64
2 files changed, 88 insertions, 69 deletions
diff --git a/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.xtend b/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.xtend
index 334586447..d574316a2 100644
--- a/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.xtend
+++ b/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.xtend
@@ -170,8 +170,10 @@ class XcoreGenModelBuilder
val EPackage referencedEPackage = eCrossReference.getEPackage
if (referencedEPackage != null)
{
- ePackages.add(referencedEPackage)
- referencedEPackages.add(referencedEPackage)
+ if (ePackages.add(referencedEPackage))
+ {
+ referencedEPackages.add(referencedEPackage)
+ }
}
}
EStructuralFeature:
@@ -182,8 +184,10 @@ class XcoreGenModelBuilder
val EPackage referencedEPackage = eContainingClass.getEPackage
if (referencedEPackage != null)
{
- ePackages.add(referencedEPackage)
- referencedEPackages.add(referencedEPackage)
+ if (ePackages.add(referencedEPackage))
+ {
+ referencedEPackages.add(referencedEPackage)
+ }
}
}
}
@@ -195,65 +199,70 @@ class XcoreGenModelBuilder
for (referencedEPackage : referencedEPackages)
{
- if (genModel.findGenPackage(referencedEPackage) == null)
+ var usedGenPackage = genModel.findGenPackage(referencedEPackage);
+ if (usedGenPackage == null)
{
- var usedGenPackage = mapper.getGen(mapper.getToXcoreMapping(referencedEPackage).xcoreElement) as GenPackage
+ usedGenPackage = mapper.getGen(mapper.getToXcoreMapping(referencedEPackage).xcoreElement) as GenPackage
if (usedGenPackage == null)
{
usedGenPackage = findLocalGenPackage(referencedEPackage)
}
- if (usedGenPackage != null)
+ }
+
+ if (usedGenPackage != null)
+ {
+ if (usedGenPackage.eResource() != null)
{
genModel.usedGenPackages.add(usedGenPackage)
}
- else
+ }
+ else
+ {
+ val genModelResource = genModel.eResource
+ val resources = genModelResource.resourceSet.resources
+ i = 0
+ var boolean found = false
+ while (i < resources.size && !found)
{
- val genModelResource = genModel.eResource
- val resources = genModelResource.resourceSet.resources
- i = 0
- var boolean found = false
- while (i < resources.size && !found)
+ val resource = resources.get(i)
+ if (resource != genModelResource)
{
- val resource = resources.get(i)
- if (resource != genModelResource)
+ val fileExtension = resource.URI.fileExtension
+ if ("xcore".equals(fileExtension))
{
- val fileExtension = resource.URI.fileExtension
- if ("xcore".equals(fileExtension))
+ val contents = resource.contents;
+ if (!contents.empty)
{
- val contents = resource.contents;
- if (!contents.empty)
+ val GenModel usedGenModel = resource.contents.get(1) as GenModel
+ usedGenPackage = usedGenModel.findGenPackage(referencedEPackage)
+ if (usedGenPackage != null)
{
- val GenModel usedGenModel = resource.contents.get(1) as GenModel
- usedGenPackage = usedGenModel.findGenPackage(referencedEPackage)
- if (usedGenPackage != null)
- {
- genModel.usedGenPackages.add(usedGenPackage)
- found = true
- }
+ genModel.usedGenPackages.add(usedGenPackage)
+ found = true
}
}
- else if ("genmodel".equals(fileExtension))
+ }
+ else if ("genmodel".equals(fileExtension))
+ {
+ val contents = resource.contents;
+ if (!contents.empty)
{
- val contents = resource.contents;
- if (!contents.empty)
+ val GenModel usedGenModel = resource.contents.get(0) as GenModel
+ usedGenModel.reconcile
+ usedGenPackage = usedGenModel.findGenPackage(referencedEPackage)
+ if (usedGenPackage != null)
{
- val GenModel usedGenModel = resource.contents.get(0) as GenModel
- usedGenModel.reconcile
- usedGenPackage = usedGenModel.findGenPackage(referencedEPackage)
- if (usedGenPackage != null)
- {
- genModel.usedGenPackages.add(usedGenPackage)
- found = true
- }
+ genModel.usedGenPackages.add(usedGenPackage)
+ found = true
}
}
}
- i = i + 1
- }
- if (!found)
- {
- throw new RuntimeException("No GenPackage found for " + referencedEPackage)
}
+ i = i + 1
+ }
+ if (!found)
+ {
+ throw new RuntimeException("No GenPackage found for " + referencedEPackage)
}
}
}
diff --git a/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.java b/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.java
index bddbf4a45..7232ae0c3 100644
--- a/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.java
+++ b/plugins/org.eclipse.emf.ecore.xcore/xtend-gen/org/eclipse/emf/ecore/xcore/util/XcoreGenModelBuilder.java
@@ -251,8 +251,10 @@ public class XcoreGenModelBuilder {
final EPackage referencedEPackage = ((EClassifier)eCrossReference).getEPackage();
boolean _notEquals = (!Objects.equal(referencedEPackage, null));
if (_notEquals) {
- ePackages.add(referencedEPackage);
- referencedEPackages.add(referencedEPackage);
+ boolean _add = ePackages.add(referencedEPackage);
+ if (_add) {
+ referencedEPackages.add(referencedEPackage);
+ }
}
}
}
@@ -265,8 +267,10 @@ public class XcoreGenModelBuilder {
final EPackage referencedEPackage = eContainingClass.getEPackage();
boolean _notEquals_1 = (!Objects.equal(referencedEPackage, null));
if (_notEquals_1) {
- ePackages.add(referencedEPackage);
- referencedEPackages.add(referencedEPackage);
+ boolean _add = ePackages.add(referencedEPackage);
+ if (_add) {
+ referencedEPackages.add(referencedEPackage);
+ }
}
}
}
@@ -278,22 +282,28 @@ public class XcoreGenModelBuilder {
}
}
for (final EPackage referencedEPackage : referencedEPackages) {
- GenPackage _findGenPackage = genModel.findGenPackage(referencedEPackage);
- boolean _equals = Objects.equal(_findGenPackage, null);
- if (_equals) {
- ToXcoreMapping _toXcoreMapping = this.mapper.getToXcoreMapping(referencedEPackage);
- XNamedElement _xcoreElement = _toXcoreMapping.getXcoreElement();
- GenBase _gen = this.mapper.getGen(_xcoreElement);
- GenPackage usedGenPackage = ((GenPackage) _gen);
- boolean _equals_1 = Objects.equal(usedGenPackage, null);
- if (_equals_1) {
- GenPackage _findLocalGenPackage = this.findLocalGenPackage(referencedEPackage);
- usedGenPackage = _findLocalGenPackage;
+ {
+ GenPackage usedGenPackage = genModel.findGenPackage(referencedEPackage);
+ boolean _equals = Objects.equal(usedGenPackage, null);
+ if (_equals) {
+ ToXcoreMapping _toXcoreMapping = this.mapper.getToXcoreMapping(referencedEPackage);
+ XNamedElement _xcoreElement = _toXcoreMapping.getXcoreElement();
+ GenBase _gen = this.mapper.getGen(_xcoreElement);
+ usedGenPackage = ((GenPackage) _gen);
+ boolean _equals_1 = Objects.equal(usedGenPackage, null);
+ if (_equals_1) {
+ GenPackage _findLocalGenPackage = this.findLocalGenPackage(referencedEPackage);
+ usedGenPackage = _findLocalGenPackage;
+ }
}
boolean _notEquals = (!Objects.equal(usedGenPackage, null));
if (_notEquals) {
- EList<GenPackage> _usedGenPackages = genModel.getUsedGenPackages();
- _usedGenPackages.add(usedGenPackage);
+ Resource _eResource = usedGenPackage.eResource();
+ boolean _notEquals_1 = (!Objects.equal(_eResource, null));
+ if (_notEquals_1) {
+ EList<GenPackage> _usedGenPackages = genModel.getUsedGenPackages();
+ _usedGenPackages.add(usedGenPackage);
+ }
} else {
final Resource genModelResource = genModel.eResource();
ResourceSet _resourceSet = genModelResource.getResourceSet();
@@ -303,8 +313,8 @@ public class XcoreGenModelBuilder {
while (((i < resources.size()) && (!found))) {
{
final Resource resource = resources.get(i);
- boolean _notEquals_1 = (!Objects.equal(resource, genModelResource));
- if (_notEquals_1) {
+ boolean _notEquals_2 = (!Objects.equal(resource, genModelResource));
+ if (_notEquals_2) {
URI _uRI = resource.getURI();
final String fileExtension = _uRI.fileExtension();
boolean _equals_2 = "xcore".equals(fileExtension);
@@ -316,10 +326,10 @@ public class XcoreGenModelBuilder {
EList<EObject> _contents = resource.getContents();
EObject _get = _contents.get(1);
final GenModel usedGenModel = ((GenModel) _get);
- GenPackage _findGenPackage_1 = usedGenModel.findGenPackage(referencedEPackage);
- usedGenPackage = _findGenPackage_1;
- boolean _notEquals_2 = (!Objects.equal(usedGenPackage, null));
- if (_notEquals_2) {
+ GenPackage _findGenPackage = usedGenModel.findGenPackage(referencedEPackage);
+ usedGenPackage = _findGenPackage;
+ boolean _notEquals_3 = (!Objects.equal(usedGenPackage, null));
+ if (_notEquals_3) {
EList<GenPackage> _usedGenPackages_1 = genModel.getUsedGenPackages();
_usedGenPackages_1.add(usedGenPackage);
found = true;
@@ -336,10 +346,10 @@ public class XcoreGenModelBuilder {
EObject _get_1 = _contents_1.get(0);
final GenModel usedGenModel_1 = ((GenModel) _get_1);
usedGenModel_1.reconcile();
- GenPackage _findGenPackage_2 = usedGenModel_1.findGenPackage(referencedEPackage);
- usedGenPackage = _findGenPackage_2;
- boolean _notEquals_3 = (!Objects.equal(usedGenPackage, null));
- if (_notEquals_3) {
+ GenPackage _findGenPackage_1 = usedGenModel_1.findGenPackage(referencedEPackage);
+ usedGenPackage = _findGenPackage_1;
+ boolean _notEquals_4 = (!Objects.equal(usedGenPackage, null));
+ if (_notEquals_4) {
EList<GenPackage> _usedGenPackages_2 = genModel.getUsedGenPackages();
_usedGenPackages_2.add(usedGenPackage);
found = true;

Back to the top