From: Benjamin B. <bg...@us...> - 2005-03-30 07:37:45
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15034/Plugin/com/ibm/ecute/rsa/core/internal/properties Modified Files: QualifiersPropertySection.java Log Message: 1) aggregation qualifier in association properties fixed 2) aggregation qualifier can now also be set from true to false 3) eCUTE version number is shown in the RSA import dialog Index: QualifiersPropertySection.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties/QualifiersPropertySection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- QualifiersPropertySection.java 14 Feb 2005 17:38:06 -0000 1.8 +++ QualifiersPropertySection.java 30 Mar 2005 07:37:34 -0000 1.9 @@ -214,7 +214,7 @@ public void refresh() { - qualifiersTable.removeAll(); + qualifiersTable.removeAll(); defaultValueQualifiers.clear(); defaultValueButton.setEnabled(false); removeButton.setEnabled(false); @@ -301,8 +301,14 @@ //Qualifiers with AssociationClass Scope if(element instanceof AssociationClass){ qualifierName = "Association"; + // check if the qualifier has already been added to the table + // qualifiers which are defined as stereotypes are added first + boolean exists = existsQualifierInTable(qualifierName); Qualifier qualifierObject = qualifiersList.GetElement(qualifierName); - addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + if(!exists){ + // if the qualifier doesn't exists then it is added to the table + addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + } allAvailableQualifers.remove(qualifierObject); AssociationClass assocClass = (AssociationClass)element; EList ends = assocClass.getOwnedEnds(); @@ -311,18 +317,33 @@ Property prop = (Property)iter.next(); if(prop.getAggregation().getValue()== AggregationKind.SHARED){ qualifierName = "Aggregation"; + // check if the qualifier has already been added to the table + // qualifiers which are defined as stereotypes are added first + exists = existsQualifierInTable(qualifierName); qualifierObject = qualifiersList.GetElement(qualifierName); - addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + if(!exists){ + addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + } allAvailableQualifers.remove(qualifierObject); break; }else if(prop.getAggregation().getValue()== AggregationKind.COMPOSITE){ qualifierName = "Aggregation"; qualifierObject = qualifiersList.GetElement(qualifierName); - addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + // check if the qualifier has already been added to the table + // qualifiers which are defined as stereotypes are added first + exists = existsQualifierInTable(qualifierName); + if(!exists){ + addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + } allAvailableQualifers.remove(qualifierObject); qualifierName = "Composition"; qualifierObject = qualifiersList.GetElement(qualifierName); - addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + // check if the qualifier has already been added to the table + // qualifiers which are defined as stereotypes are added first + exists = existsQualifierInTable(qualifierName); + if(!exists){ + addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); + } allAvailableQualifers.remove(qualifierObject); break; } @@ -378,15 +399,38 @@ } //Qualifiers with Property Scope + if(element instanceof Property){ Property prop = (Property)element; + Property oppositeProp = null; + // get the property of the other association end + AssociationClass parentClass = (AssociationClass)prop.getOwner(); + List ends = parentClass.getOwnedEnds(); + if ((Property)ends.get(0) == prop){ + oppositeProp = (Property)ends.get(1); + } + if ((Property)ends.get(1) == prop){ + oppositeProp = (Property)ends.get(0); + } + //Qualifier: Aggregate qualifierName = "Aggregate"; - if(prop.getAggregation().getValue()== AggregationKind.SHARED - || prop.getAggregation().getValue()== AggregationKind.COMPOSITE){ + // to get an aggregation or composition in RSA + // the association property with the diamond has to have the aggregation type NONE + // the opposite side (the side without the diamond) has to have aggregation type + // SHARED or COMPOSITE + // so the aggregation kind of the opposite side has to be checked to set the aggregation + // qualifier of the aggregation property correct + + if(oppositeProp.getAggregation().getValue()== AggregationKind.SHARED + || oppositeProp.getAggregation().getValue()== AggregationKind.COMPOSITE){ Qualifier qualifierObject = qualifiersList.GetElement(qualifierName); addQualiferToTable(qualifierName, "true", definedIn, qualifierObject, -1, false); allAvailableQualifers.remove(qualifierObject); + } else { + Qualifier qualifierObject = qualifiersList.GetElement(qualifierName); + addQualiferToTable(qualifierName, "false", definedIn, qualifierObject, -1, false); + allAvailableQualifers.remove(qualifierObject); } //Qualifier: Key qualifierName = "Key"; @@ -511,6 +555,23 @@ packColumns(); return null; } + + /** + * @param qualifierName + * @return + */ + private boolean existsQualifierInTable(String qualifierName) { + boolean exists = false; + int tableLength = qualifiersTable.getItemCount(); + for (int b = 0; b < tableLength; b++){ + QualifierValueObject qualifier = (QualifierValueObject)qualifiersTable.getItem(b).getData(); + if (qualifier.name == qualifierName){ + exists = true; + b = tableLength; + } + } + return exists; + } }); packColumns(); @@ -722,6 +783,7 @@ }; tableitem.setText(as); tableitem.setData(new QualifierValueObject(name, qualifierValue, defaultValue, index)); + System.out.println("Qulifier " + name + " with value " + qualifierValue.toString() + " added"); // if(showAllButton.getSelection()){ // if(!isDefaultQualifier){ // tableitem.setFont(boldFont); |