Commit 924446d0 authored by Marco Konersmann's avatar Marco Konersmann

Default implementation for doCreateChildTransformationsToCode of ReferenceMechanismTransformations

parent 3973624f
...@@ -14,7 +14,6 @@ import org.codeling.lang.cocome.transformation.ServerTransformation; ...@@ -14,7 +14,6 @@ import org.codeling.lang.cocome.transformation.ServerTransformation;
import org.codeling.mechanisms.transformations.ClassMechanismTransformation; import org.codeling.mechanisms.transformations.ClassMechanismTransformation;
import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation; import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation;
import org.codeling.utils.CodelingException; import org.codeling.utils.CodelingException;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragment;
...@@ -26,8 +25,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor ...@@ -26,8 +25,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor
public class ComponentsTransformation extends NinjaSingletonContainmentTransformation<Architecture, Component> { public class ComponentsTransformation extends NinjaSingletonContainmentTransformation<Architecture, Component> {
public ComponentsTransformation( public ComponentsTransformation(ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
super(parentTransformation, CoCoMEPackage.eINSTANCE.getArchitecture_Components()); super(parentTransformation, CoCoMEPackage.eINSTANCE.getArchitecture_Components());
} }
...@@ -39,19 +37,14 @@ public class ComponentsTransformation extends NinjaSingletonContainmentTransform ...@@ -39,19 +37,14 @@ public class ComponentsTransformation extends NinjaSingletonContainmentTransform
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) { if (modelElement.eClass() == CoCoMEPackage.eINSTANCE.getServer())
ClassMechanismTransformation<? extends EObject, IType> t = null; return new ServerTransformation(this);
if (modelElement.eClass() == CoCoMEPackage.eINSTANCE.getServer()) else if (modelElement.eClass() == CoCoMEPackage.eINSTANCE.getConsole())
t = new ServerTransformation(this); return new ConsoleTransformation(this);
else if (modelElement.eClass() == CoCoMEPackage.eINSTANCE.getConsole()) else
t = new ConsoleTransformation(this); return new ModelTransformation(this);
if (modelElement.eClass() == CoCoMEPackage.eINSTANCE.getModel())
t = new ModelTransformation(this);
t.setModelElement(target);
result.add(t);
}
} }
@Override @Override
......
...@@ -37,9 +37,9 @@ public class ChildrenTransformation<OWNINGCOMPONENTTYPE extends Component, TARGE ...@@ -37,9 +37,9 @@ public class ChildrenTransformation<OWNINGCOMPONENTTYPE extends Component, TARGE
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -33,9 +33,9 @@ public class DispatchedTransformation<COMPONENTTYPE extends Component, OWNERCLAS ...@@ -33,9 +33,9 @@ public class DispatchedTransformation<COMPONENTTYPE extends Component, OWNERCLAS
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -34,9 +34,9 @@ public class EventsTransformation<COMPONENTTYPE extends Component, OWNERTYPE ext ...@@ -34,9 +34,9 @@ public class EventsTransformation<COMPONENTTYPE extends Component, OWNERTYPE ext
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -33,9 +33,9 @@ public class HandledTransformation<COMPONENTTYPE extends Component, OWNERCLASS ...@@ -33,9 +33,9 @@ public class HandledTransformation<COMPONENTTYPE extends Component, OWNERCLASS
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -31,9 +31,9 @@ public class ProvidesTransformation<COMPONENTTYPE extends Component> ...@@ -31,9 +31,9 @@ public class ProvidesTransformation<COMPONENTTYPE extends Component>
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -35,9 +35,9 @@ public class RequiresTransformation<COMPONENTTYPE extends Component> extends Ref ...@@ -35,9 +35,9 @@ public class RequiresTransformation<COMPONENTTYPE extends Component> extends Ref
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -28,8 +28,9 @@ public class OperationsTransformation extends ContainmentOperationTransformation ...@@ -28,8 +28,9 @@ public class OperationsTransformation extends ContainmentOperationTransformation
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
return null;
} }
@Override @Override
......
...@@ -31,9 +31,9 @@ public class InitialStateTransformation extends ReferenceMechanismTransformation ...@@ -31,9 +31,9 @@ public class InitialStateTransformation extends ReferenceMechanismTransformation
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -34,9 +34,9 @@ public class StatesTransformation extends ReferenceMechanismTransformation<Model ...@@ -34,9 +34,9 @@ public class StatesTransformation extends ReferenceMechanismTransformation<Model
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -29,9 +29,9 @@ public class TransitionsTransformation extends ContainmentOperationTransformatio ...@@ -29,9 +29,9 @@ public class TransitionsTransformation extends ContainmentOperationTransformatio
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -22,8 +22,7 @@ public class TransferObjectsTransformation extends ReferenceMechanismTransformat ...@@ -22,8 +22,7 @@ public class TransferObjectsTransformation extends ReferenceMechanismTransformat
LinkedList<String> targetNames = new LinkedList<>(); LinkedList<String> targetNames = new LinkedList<>();
public TransferObjectsTransformation( public TransferObjectsTransformation(ClassMechanismTransformation<Server, IType> parentTransformation) {
ClassMechanismTransformation<Server, IType> parentTransformation) {
super(parentTransformation, CoCoMEPackage.eINSTANCE.getServer_TransferObjects()); super(parentTransformation, CoCoMEPackage.eINSTANCE.getServer_TransferObjects());
} }
...@@ -34,9 +33,9 @@ public class TransferObjectsTransformation extends ReferenceMechanismTransformat ...@@ -34,9 +33,9 @@ public class TransferObjectsTransformation extends ReferenceMechanismTransformat
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -27,9 +27,9 @@ public class TargetTransformation extends ReferenceMechanismTransformation<Trans ...@@ -27,9 +27,9 @@ public class TargetTransformation extends ReferenceMechanismTransformation<Trans
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
// TODO Auto-generated method stub return null;
} }
@Override @Override
......
...@@ -5,6 +5,7 @@ import java.util.Iterator; ...@@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EModelElement; import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
...@@ -21,8 +22,7 @@ public abstract class ReferenceMechanismTransformation<OWNERECLASS extends EObje ...@@ -21,8 +22,7 @@ public abstract class ReferenceMechanismTransformation<OWNERECLASS extends EObje
protected EReference eReference = null; protected EReference eReference = null;
protected List<TARGETECLASS> targetObjects = null; protected List<TARGETECLASS> targetObjects = null;
public ReferenceMechanismTransformation( public ReferenceMechanismTransformation(ClassMechanismTransformation<OWNERECLASS, JAVAELEMENT> parentTransformation,
ClassMechanismTransformation<OWNERECLASS, JAVAELEMENT> parentTransformation,
EReference eReference) { EReference eReference) {
super(parentTransformation); super(parentTransformation);
this.eReference = eReference; this.eReference = eReference;
...@@ -96,6 +96,50 @@ public abstract class ReferenceMechanismTransformation<OWNERECLASS extends EObje ...@@ -96,6 +96,50 @@ public abstract class ReferenceMechanismTransformation<OWNERECLASS extends EObje
this.targetObjects = targetObjects; this.targetObjects = targetObjects;
} }
abstract protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
EObject targetModelElement);
@Override
protected void doCreateChildTransformationsToCode(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) {
try {
AbstractModelCodeTransformation<?, ?> t = createSpecificTransformation(target);
if (t == null)
continue;
if (idRegistry.knowsImplementationModelElement(target)) {
String priorID = idRegistry.getIDFromImplementationModelElement(target);
EObject oldElement = priorIDRegistry.resolveImplementationModelElement(priorID,
EcoreUtil.getRootContainer(modelElement));
if (oldElement != null)
t.setPriorModelElement(oldElement);
}
t.setModelElement(target);
result.add(t);
} catch (Throwable t) {
addError("Could not create target transformation.", t);
}
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
try {
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.resolveImplementationModelElement(priorID,
EcoreUtil.getRootContainer(modelElement));
if (newElement == null) {
AbstractModelCodeTransformation<?, ?> t = createSpecificTransformation(target);
if (t == null)
continue;
t.setPriorModelElement(target);
result.add(t);
}
} catch (Throwable t) {
addError("Could not create target transformation.", t);
}
}
}
@Override @Override
public boolean canHandle(EModelElement metaModelElement) { public boolean canHandle(EModelElement metaModelElement) {
return metaModelElement == eReference; return metaModelElement == eReference;
......
...@@ -6,12 +6,9 @@ import org.codeling.lang.jee7.mm.JEE7.Architecture; ...@@ -6,12 +6,9 @@ import org.codeling.lang.jee7.mm.JEE7.Architecture;
import org.codeling.lang.jee7.mm.JEE7.Archive; import org.codeling.lang.jee7.mm.JEE7.Archive;
import org.codeling.lang.jee7.mm.JEE7.JEE7Package; import org.codeling.lang.jee7.mm.JEE7.JEE7Package;
import org.codeling.lang.jee7.transformation.ArchiveTransformation; import org.codeling.lang.jee7.transformation.ArchiveTransformation;
import org.codeling.lang.jee7.transformation.NamespaceTransformation;
import org.codeling.mechanisms.transformations.ClassMechanismTransformation; import org.codeling.mechanisms.transformations.ClassMechanismTransformation;
import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation; import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IJavaProject;
...@@ -19,8 +16,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor ...@@ -19,8 +16,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor
public class ArchivesTransformation extends NinjaSingletonContainmentTransformation<Architecture, Archive> { public class ArchivesTransformation extends NinjaSingletonContainmentTransformation<Architecture, Archive> {
public ArchivesTransformation( public ArchivesTransformation(ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
super(parentTransformation, JEE7Package.eINSTANCE.getArchitecture_Archives()); super(parentTransformation, JEE7Package.eINSTANCE.getArchitecture_Archives());
} }
...@@ -30,22 +26,9 @@ public class ArchivesTransformation extends NinjaSingletonContainmentTransformat ...@@ -30,22 +26,9 @@ public class ArchivesTransformation extends NinjaSingletonContainmentTransformat
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) { return new ArchiveTransformation(this);
AbstractModelCodeTransformation<?, ?> t = new ArchiveTransformation(this);
t.setModelElement(target);
result.add(t);
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.resolveImplementationModelElement(priorID, EcoreUtil.getRootContainer(modelElement));
if (newElement == null) {
AbstractModelCodeTransformation<?, ?> t = new NamespaceTransformation(this);
t.setPriorModelElement(target);
result.add(t);
}
}
} }
@Override @Override
......
...@@ -13,9 +13,7 @@ import org.codeling.lang.jee7.transformation.FacesBeanTransformation; ...@@ -13,9 +13,7 @@ import org.codeling.lang.jee7.transformation.FacesBeanTransformation;
import org.codeling.lang.jee7.transformation.SessionBeanTransformation; import org.codeling.lang.jee7.transformation.SessionBeanTransformation;
import org.codeling.mechanisms.transformations.ClassMechanismTransformation; import org.codeling.mechanisms.transformations.ClassMechanismTransformation;
import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation; import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.IType;
...@@ -38,23 +36,10 @@ public class BeansTransformation extends NinjaSingletonContainmentTransformation ...@@ -38,23 +36,10 @@ public class BeansTransformation extends NinjaSingletonContainmentTransformation
@Override @Override
protected void doCreateChildTransformationsToCode( protected void doCreateChildTransformationsToCode(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) { super.doCreateChildTransformationsToCode(result);
AbstractModelCodeTransformation<?, ?> t = createSpecificTransformation(target);
t.setModelElement(target);
result.add(t);
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.resolveImplementationModelElement(priorID, EcoreUtil.getRootContainer(modelElement));
if (newElement == null) {
AbstractModelCodeTransformation<?, ?> t = createSpecificTransformation(target);
t.setPriorModelElement(target);
result.add(t);
}
}
} }
private AbstractModelCodeTransformation<?, IType> createSpecificTransformation(EObject modelElement) { protected ClassMechanismTransformation<? extends Bean, IType> createSpecificTransformation(EObject modelElement) {
if (modelElement instanceof CDIBean) if (modelElement instanceof CDIBean)
return new CDIBeanTransformation(this); return new CDIBeanTransformation(this);
else if (modelElement instanceof SessionBean) else if (modelElement instanceof SessionBean)
......
...@@ -8,9 +8,7 @@ import org.codeling.lang.jee7.mm.JEE7.JEE7Package; ...@@ -8,9 +8,7 @@ import org.codeling.lang.jee7.mm.JEE7.JEE7Package;
import org.codeling.lang.jee7.transformation.EntityTransformation; import org.codeling.lang.jee7.transformation.EntityTransformation;
import org.codeling.mechanisms.transformations.ClassMechanismTransformation; import org.codeling.mechanisms.transformations.ClassMechanismTransformation;
import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation; import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.IType;
...@@ -19,8 +17,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor ...@@ -19,8 +17,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor
public class EntitiesTransformation extends NinjaSingletonContainmentTransformation<Architecture, Entity> { public class EntitiesTransformation extends NinjaSingletonContainmentTransformation<Architecture, Entity> {
public EntitiesTransformation( public EntitiesTransformation(ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
super(parentTransformation, JEE7Package.eINSTANCE.getArchitecture_Entities()); super(parentTransformation, JEE7Package.eINSTANCE.getArchitecture_Entities());
} }
...@@ -32,22 +29,9 @@ public class EntitiesTransformation extends NinjaSingletonContainmentTransformat ...@@ -32,22 +29,9 @@ public class EntitiesTransformation extends NinjaSingletonContainmentTransformat
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) { return new EntityTransformation(this);
AbstractModelCodeTransformation<?, ?> t = new EntityTransformation(this);
t.setModelElement(target);
result.add(t);
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.resolveImplementationModelElement(priorID, EcoreUtil.getRootContainer(modelElement));
if (newElement == null) {
AbstractModelCodeTransformation<?, ?> t = new EntityTransformation(this);
t.setPriorModelElement(target);
result.add(t);
}
}
} }
@Override @Override
......
...@@ -8,9 +8,7 @@ import org.codeling.lang.jee7.mm.JEE7.Namespace; ...@@ -8,9 +8,7 @@ import org.codeling.lang.jee7.mm.JEE7.Namespace;
import org.codeling.lang.jee7.transformation.NamespaceTransformation; import org.codeling.lang.jee7.transformation.NamespaceTransformation;
import org.codeling.mechanisms.transformations.ClassMechanismTransformation; import org.codeling.mechanisms.transformations.ClassMechanismTransformation;
import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation; import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragment;
...@@ -19,8 +17,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor ...@@ -19,8 +17,7 @@ import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransfor
public class NamespacesTransformation extends NinjaSingletonContainmentTransformation<Architecture, Namespace> { public class NamespacesTransformation extends NinjaSingletonContainmentTransformation<Architecture, Namespace> {
public NamespacesTransformation( public NamespacesTransformation(ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
ClassMechanismTransformation<Architecture, IJavaElement> parentTransformation) {
super(parentTransformation, JEE7Package.eINSTANCE.getArchitecture_Namespaces()); super(parentTransformation, JEE7Package.eINSTANCE.getArchitecture_Namespaces());
} }
...@@ -32,22 +29,9 @@ public class NamespacesTransformation extends NinjaSingletonContainmentTransform ...@@ -32,22 +29,9 @@ public class NamespacesTransformation extends NinjaSingletonContainmentTransform
} }
@Override @Override
protected void doCreateChildTransformationsToCode( protected ClassMechanismTransformation<? extends EObject, ? extends IJavaElement> createSpecificTransformation(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) { EObject targetModelElement) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) { return new NamespaceTransformation(this);
AbstractModelCodeTransformation<?, ?> t = new NamespaceTransformation(this);
t.setModelElement(target);
result.add(t);
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.resolveImplementationModelElement(priorID, EcoreUtil.getRootContainer(modelElement</