[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [henshin-dev] Export Henshin to AGG
|
Hey Christian, Sorry, I am a bit new to SVN and this patch thing. And another sorry for not point out explicitly what I had changed/inserted. I had checked out the Exporter before Frank worked on this patch and since then worked on my own. So, comparing to Frank’s patch: Yes, his part is (re)moved in my solution. My patch is in the attached file. Cheers, Florian Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause Gesendet: Freitag, 7. Februar 2014 20:55 An: Henshin developers mailing list Betreff: Re: [henshin-dev] Export Henshin to AGG Could you please use the "Team -> Create Patch..." context menu action to create a patch? Also, I am wondering whether you then add the inheritance code twice. Did you maybe remove Frank's part? 2014-02-07 20:40 GMT+01:00 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>: Hey Christian, Alright. This is my solution; right after the “Nodes and attribute types” part: // Set Inheritance: for (EPackage epackage : module.getImports()) { for (EClassifier eclassifier : epackage.getEClassifiers()) { if (eclassifier instanceof EClass) { EClass eclass = (EClass) eclassifier; EList<EClass> parents = eclass.getESuperTypes(); if(parents != null) { for(EClass parent : parents) { String childID = nodeTypeIDs.get(eclass); String parentID = nodeTypeIDs.get(parent); Element parentElem = newElement("Parent", document.getElementById(childID), false); parentElem.setAttribute("pID", parentID); //Parent nodes have to appear before child node in XML document //so only move if necessary if(Integer.parseInt(childID.substring(1)) < Integer.parseInt(parentID.substring(1))) { typesElem.insertBefore(document.getElementById(parentID), document.getElementById(childID)); } } } } } } Basically, it is the same as Frank’s patch except for the if-clause and its own surrounding for-loop. Regards, Florian Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause Gesendet: Freitag, 7. Februar 2014 20:23 An: Henshin developers mailing list Betreff: Re: [henshin-dev] Export Henshin to AGG
Hi Florian, thanks for pointing this out. If you have a solution, I would be happy to incorporate it. You can just send me a patch. 2014-02-07 19:33 GMT+01:00 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>: Hey! Thanks for this patch. But if I get this patch right, it does not consider the fact that parent nodes have to appear BEFORE their child nodes inside the resulting XML document. Otherwise AGG will throw an error. This problem occurs when you have got an existing model and add a parent node afterwards. Thus the parent node gets an higher ID and therefore will be added into the XML document after the child node. The solution I am working with supports this case. I just wanted to test it out some more but I can make it available for you right now – if you want to (how?) Cheers, Florian Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause Gesendet: Mittwoch, 5. Februar 2014 18:58 An: Henshin developers mailing list Betreff: Re: [henshin-dev] Export Henshin to AGG
Hi, the AGG exporter now supports inheritance: Thanks for submitting the patch, Frank. 2013-12-17 Florian Heß <hessflorian@xxxxxxxxxxxxxxxxxxxxxxxxx>: Hello Christian, thank you for the reply. I will take a deeper look into the exporter and try my best to add inheritance to the exporter. Regards, Florian Von: henshin-dev-bounces@xxxxxxxxxxx [mailto:henshin-dev-bounces@xxxxxxxxxxx] Im Auftrag von Christian Krause Gesendet: Montag, 16. Dezember 2013 22:23 An: Henshin developers mailing list Betreff: Re: [henshin-dev] Export Henshin to AGG Hello Florian, inheritance is currently not supported by the AGG exporter. If you are interested in having this feature, maybe you can take a look at the exporter and try to add it yourself. If it works, we could add it to Henshin so that others can also make use of it. Maybe just take a look at the exporter to get a feeling of what is currently supported: _______________________________________________ henshin-dev mailing list henshin-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/henshin-dev
_______________________________________________ henshin-dev mailing list henshin-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/henshin-dev
_______________________________________________ henshin-dev mailing list henshin-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/henshin-dev
|
### Eclipse Workspace Patch 1.0
#P org.eclipse.emf.henshin.model_SVN
Index: src/org/eclipse/emf/henshin/model/exporters/HenshinAGGExporter.java
===================================================================
--- src/org/eclipse/emf/henshin/model/exporters/HenshinAGGExporter.java (revision 1976)
+++ src/org/eclipse/emf/henshin/model/exporters/HenshinAGGExporter.java (working copy)
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
@@ -178,20 +179,6 @@
nodeElem.setAttribute("type", nodeTypeIDs.get(eclass));
nodeIDs.put(eclass, nodeElem.getAttribute("ID"));
- // Inheritance:
- if(eclass.getESuperTypes().size()==1){
- // handle the case of one super type
- EClass parentEClass=eclass.getESuperTypes().get(0);
- Element parentElem = newElement("Parent", nodeTypeElem, false);
- String parentNodeTypeID = nodeTypeIDs.get(parentEClass);
- parentElem.setAttribute("pID", parentNodeTypeID);
- // parent element XML node does not have an own ID in AGG
- }
- else if (eclass.getESuperTypes().size()>1){
- warnings.add(" - multiple inheritance for " + eclass.getName() +
- " not supported");
- }
-
// Attributes:
for (EAttribute attribute : eclass.getEAttributes()) {
if (isSupportedPrimitiveType(attribute.getEType())) {
@@ -208,6 +195,37 @@
}
}
}
+
+
+ // Set Inheritance:
+ for (EPackage epackage : module.getImports()) {
+ for (EClassifier eclassifier : epackage.getEClassifiers()) {
+ if (eclassifier instanceof EClass) {
+ EClass eclass = (EClass) eclassifier;
+ EList<EClass> parents = eclass.getESuperTypes();
+
+ if(parents != null) {
+ for(EClass parent : parents) {
+ String childID = nodeTypeIDs.get(eclass);
+ String parentID = nodeTypeIDs.get(parent);
+
+ Element parentElem = newElement("Parent", document.getElementById(childID), false);
+ parentElem.setAttribute("pID", parentID);
+
+ //Parent nodes have to appear before child node in XML document
+ //so only move if necessary
+ if(Integer.parseInt(childID.substring(1)) < Integer.parseInt(parentID.substring(1))) {
+
+ typesElem.insertBefore(document.getElementById(parentID), document.getElementById(childID));
+ }
+
+
+ }
+ }
+ }
+ }
+ }
+
// Check whether the reference names are unique:
boolean hasUniqureRefNames = hasUniqueEReferenceNames(module);