Commit 14bebfbc authored by Marco Konersmann's avatar Marco Konersmann

Merge branch '74-unused-never-referenced-classes'

Resolved Conflict:
	Core/java.embed.transformation/src/main/java/de/mkonersmann/advert/java/embed/transformation/ModelCodeTransformationRegistry.java
parents 83bbf469 cc4ea322
package de.mkonersmann.henshin.tgg.api.impl.actions;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl;
import org.eclipse.emf.henshin.interpreter.util.HenshinEGraph;
import de.tub.tfs.henshin.tgg.TNode;
import de.tub.tfs.henshin.tgg.TripleGraph;
public class ExportModelInstanceAction {
TripleGraph graph;
Map<TNode, EObject> tNode2instance;
public ExportModelInstanceAction(TripleGraph graph,
Map<TNode, EObject> tNode2instance) {
this.graph = graph;
this.tNode2instance = tNode2instance;
}
public List<EObject> execute() {
// TODO: This seems to create new eobjects. I would like them to be
// changed instead.
HenshinEGraph gr = new HenshinEGraph(graph);
// Set default values of attributes to "" where necessary
for (EObject eObject : gr.getRoots()) {
EList<EStructuralFeature> features = eObject.eClass()
.getEAllStructuralFeatures();
for (EStructuralFeature feature : features) {
if (feature.getDefaultValueLiteral() == null) {
((EStructuralFeatureImpl) feature)
.setDefaultValueLiteral("");
}
}
}
List<EObject> ret = gr.getRoots();
// Reset the changed attributes to null where necessary
for (EObject eObject : gr.getRoots()) {
EList<EStructuralFeature> features = eObject.eClass()
.getEAllStructuralFeatures();
for (EStructuralFeature feature : features) {
if (feature.getDefaultValueLiteral() == null) {
feature.setDefaultValueLiteral(null);
}
}
}
return ret;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment