From: Benjamin B. <bg...@us...> - 2005-03-24 09:10:53
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17065/Plugin/com/ibm/ecute/plugins/output/funcionality Modified Files: RSAModelCreator.java Log Message: Changes to get aggregations and compositions the right way round in RSA Index: RSAModelCreator.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/RSAModelCreator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- RSAModelCreator.java 14 Feb 2005 11:41:03 -0000 1.7 +++ RSAModelCreator.java 24 Mar 2005 09:10:44 -0000 1.8 @@ -119,7 +119,7 @@ public int AddAssociation(String className1, String roleName1, String className2, String roleName2, Object diagram) { - //metamorphose lastClass to AssociationClass + //metamorphose lastClass to AssociationClass //System.out.println("metamorphose: " + lastClass.getName() + " to an AssociationClass"); Element element = lastClass; String s = EObjectUtil.getID(element); @@ -132,7 +132,6 @@ if (className1 == null || className2 == null) { if (lastRootClass != null) { - AssociationClass rootAssoc = (AssociationClass) lastRootClass; Property rootAssocProp1 = (Property) rootAssoc.getOwnedEnds().get(0); @@ -270,6 +269,7 @@ } } } + lastAssocProp1 = assocProp1; Property assocProp2 = associationclass.createOwnedEnd(UML2Package.eINSTANCE.getProperty()); @@ -298,6 +298,7 @@ } } + lastAssocProp2 = assocProp2; //TODO Add AssociationClass to Diagram @@ -430,7 +431,7 @@ public int CreateClass(String name, String rootClass, Object category, boolean replace) { -// System.out.println("CreateClass: " + name); + System.out.println("CreateClass: " + name); org.eclipse.uml2.Package package_ = (org.eclipse.uml2.Package) category; org.eclipse.uml2.Class theRoot = null; int result = OK; @@ -469,6 +470,7 @@ class_ = (org.eclipse.uml2.Class) package_.createOwnedMember(UML2Package.eINSTANCE.getClass_()); class_.setName(name); + System.out.println("CreateClass: " + name + " CREATED"); } lastClassComposition = false; lastCategory = package_; @@ -612,6 +614,7 @@ String thisTab = tab; Element theElement = lastElement; + Element otherElement = null; Stereotype cimStereotype = theElement.getAppliedStereotype("CIM::Qualifiers"); if(type == TCLASS){ @@ -621,11 +624,18 @@ } } + // because of the different role order in RSA theElement is + // lastAssocProp2 if type TLINK1 if (type == TLINK1) { - theElement = lastAssocProp1; + //theElement = lastAssocProp1; + theElement = lastAssocProp2; + otherElement = lastAssocProp1; } + // lastAssocProp1 if type TLINK2 if (type == TLINK2) { - theElement = lastAssocProp2; + //theElement = lastAssocProp2; + theElement = lastAssocProp1; + otherElement = lastAssocProp2; } if (name.equalsIgnoreCase("Description") && qualifiers) { @@ -644,10 +654,13 @@ } else if (name.equalsIgnoreCase("Aggregate") && (!value.equalsIgnoreCase("false"))) { if(theElement instanceof Property){ + // in RSA the attribute for aggregation has to be set on the other side + // than all the other attributes of a property, therefore otherElement + // is used instead of theElement if(lastClassComposition){ - ((Property) theElement).setAggregation(AggregationKind.COMPOSITE_LITERAL); + ((Property) otherElement).setAggregation(AggregationKind.COMPOSITE_LITERAL); }else{ - ((Property) theElement).setAggregation(AggregationKind.SHARED_LITERAL); + ((Property) otherElement).setAggregation(AggregationKind.SHARED_LITERAL); } // ChangeLineColor(lastDiagram, lastElement, aggregation); //TODO // setLineColor? |