From: Benjamin B. <bg...@us...> - 2005-07-20 15:22:11
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21123/Plugin/com/ibm/ecute/rsa/core/internal/properties Modified Files: ValuesTableHelper.java QualifiersPropertySection.java EffectiveInheritedValue.java FlavorsHelper.java Log Message: flavors presentation rule implemented for values table in properties section and effectiveInheritedQualifier method implemented Index: FlavorsHelper.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties/FlavorsHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FlavorsHelper.java 19 Jul 2005 16:10:47 -0000 1.3 +++ FlavorsHelper.java 20 Jul 2005 15:21:46 -0000 1.4 @@ -28,6 +28,7 @@ import org.eclipse.uml2.ParameterDirectionKind; import org.eclipse.uml2.Property; import org.eclipse.uml2.Stereotype; +import org.eclipse.uml2.Type; import org.eclipse.uml2.UML2Package; import com.ibm.ecute.EcuteEclipsePlugin; @@ -39,7 +40,7 @@ import com.ibm.xtools.modeler.UMLModeler; /** - * Copyright (c) 2003, International Business Machines + * Copyright (c) 2005, International Business Machines * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES @@ -49,7 +50,9 @@ * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * @author Benjamin Bender <be...@de...> + * */ + public class FlavorsHelper { // Copyright private static final String COPYRIGHT = License.COPYRIGHT; @@ -484,7 +487,7 @@ // ABSTRACT if(qualifierName.equalsIgnoreCase("Abstract")){ return null; - //AGGREGATE + //AGGREGATE } else if(qualifierName.equalsIgnoreCase("Aggregate")){ if(element instanceof Property && propertyIsOwnedEnd((Property)element) && override(element)){ Property property = (Property)element; @@ -512,21 +515,21 @@ } else { return null; } - // AGGREGATION + // AGGREGATION } else if(qualifierName.equalsIgnoreCase("Aggregation")){ if(element instanceof AssociationClass){ Class parent = getParentClass((AssociationClass)element); if(parent != null && parent instanceof AssociationClass){ - AssociationClass aClass = (AssociationClass)parent; - EList ends = aClass.getOwnedEnds(); - Iterator iter = ends.iterator(); - while(iter.hasNext()){ - Property prop = (Property)iter.next(); - if(prop.getAggregation().getValue()== AggregationKind.SHARED || - prop.getAggregation().getValue()== AggregationKind.COMPOSITE){ - return (new EffectiveInheritedValue("true", parent)); - } - } + AssociationClass aClass = (AssociationClass)parent; + EList ends = aClass.getOwnedEnds(); + Iterator iter = ends.iterator(); + while(iter.hasNext()){ + Property prop = (Property)iter.next(); + if(prop.getAggregation().getValue()== AggregationKind.SHARED || + prop.getAggregation().getValue()== AggregationKind.COMPOSITE){ + return (new EffectiveInheritedValue("true", parent)); + } + } } else { return null; } @@ -534,20 +537,20 @@ } else { return null; } - // COMPOSITION + // COMPOSITION } else if(qualifierName.equalsIgnoreCase("Composition")){ if(element instanceof AssociationClass){ Class parent = getParentClass((AssociationClass)element); if(parent != null && parent instanceof AssociationClass){ - AssociationClass aClass = (AssociationClass)parent; - EList ends = aClass.getOwnedEnds(); - Iterator iter = ends.iterator(); - while(iter.hasNext()){ - Property prop = (Property)iter.next(); - if(prop.getAggregation().getValue()== AggregationKind.COMPOSITE){ - return (new EffectiveInheritedValue("true", parent)); - } - } + AssociationClass aClass = (AssociationClass)parent; + EList ends = aClass.getOwnedEnds(); + Iterator iter = ends.iterator(); + while(iter.hasNext()){ + Property prop = (Property)iter.next(); + if(prop.getAggregation().getValue()== AggregationKind.COMPOSITE){ + return (new EffectiveInheritedValue("true", parent)); + } + } } else { return null; } @@ -555,10 +558,10 @@ } else { return null; } - // DEPRECATED + // DEPRECATED } else if(qualifierName.equalsIgnoreCase("Deprecated")){ - return null; - // DESCRIPTION + return null; + // DESCRIPTION } else if(qualifierName.equalsIgnoreCase("Description")){ // getParentClasses ArrayList parents = getParentClasses(element); @@ -568,15 +571,15 @@ for(int j = 0; j < parents.size(); j++){ String description = null; - EList list = ((Class)parents.get(j)).getOwnedComments(); - Iterator it = list.iterator(); - while (it.hasNext()){ - Comment comment = (Comment)it.next(); - Stereotype stereo = comment.getApplicableStereotype("Default::Documentation"); - if(stereo != null){ - description = comment.getBody(); - } - } + EList list = ((Class)parents.get(j)).getOwnedComments(); + Iterator it = list.iterator(); + while (it.hasNext()){ + Comment comment = (Comment)it.next(); + Stereotype stereo = comment.getApplicableStereotype("Default::Documentation"); + if(stereo != null){ + description = comment.getBody(); + } + } if(description != null){ return(new EffectiveInheritedValue(description, (Class)parents.get(j))); } @@ -643,8 +646,8 @@ method = (Operation)operationsList.get(i); } } - - if(method != null){ + + if(method != null && equalMethods(operation, method)){ EList list = method.getOwnedComments(); Iterator it = list.iterator(); @@ -674,6 +677,7 @@ for(int j = 0; j < parents.size(); j++){ String description = null; Parameter param = null; + Operation method = null; List operationsList = ((Class)parents.get(j)).getOwnedOperations(); for(int i = 0; i < operationsList.size(); i++){ @@ -681,13 +685,14 @@ List parameterList = ((Operation)operationsList.get(i)).getOwnedParameters(); for(int k = 0; k < parameterList.size(); k++){ if(((Parameter)parameterList.get(k)).getName().equalsIgnoreCase(parameter.getName())){ - param = (Parameter)parameterList.get(k); + param = (Parameter)parameterList.get(k); + method = (Operation)operationsList.get(i); } } } } - - if(param != null){ + + if(param != null && equalMethods(operation, method)){ EList list = param.getOwnedComments(); Iterator it = list.iterator(); @@ -710,7 +715,7 @@ } else { return null; } - // IN + // IN, OUT } else if(qualifierName.equalsIgnoreCase("In") || qualifierName.equalsIgnoreCase("Out")){ if(element instanceof Parameter){ ArrayList parents = getParentClasses(element); @@ -721,8 +726,9 @@ return null; } for(int j = 0; j < parents.size(); j++){ - String description = null; + //String description = null; Parameter param = null; + Operation method = null; List operationsList = ((Class)parents.get(j)).getOwnedOperations(); for(int i = 0; i < operationsList.size(); i++){ @@ -730,13 +736,14 @@ List parameterList = ((Operation)operationsList.get(i)).getOwnedParameters(); for(int k = 0; k < parameterList.size(); k++){ if(((Parameter)parameterList.get(k)).getName().equalsIgnoreCase(parameter.getName())){ - param = (Parameter)parameterList.get(k); + param = (Parameter)parameterList.get(k); + method = (Operation)operationsList.get(i); } } } } - - if(param != null){ + + if(param != null && equalMethods(operation, method)){ ParameterDirectionKind direction = param.getDirection(); String direct = null; @@ -765,6 +772,369 @@ return null; } + } else if (qualifierName.equalsIgnoreCase("Key")){ + + if(element instanceof Property && override(element)){ + ArrayList parents = getParentClasses(element); + if(parents.size() > 0){ + Property property = (Property)element; + + for(int j = 0; j < parents.size(); j++){ + Property attribute = null; + + List attributeList = ((Class)parents.get(j)).getAttributes(); + for(int i = 0; i < attributeList.size(); i++){ + if(((Property)attributeList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)attributeList.get(i); + } + } + + if(propertyIsOwnedEnd(property)){ + List endList = ((AssociationClass)parents.get(j)).getOwnedEnds(); + for(int i = 0; i < endList.size(); i++){ + if(((Property)endList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)endList.get(i); + } + } + } + + if(attribute != null){ + Stereotype stereo = attribute.getAppliedStereotype("CIM::Key"); + if(stereo != null){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + } + } else { + return null; + } + } else { + return null; + } + } else if (qualifierName.equalsIgnoreCase("Min") || qualifierName.equalsIgnoreCase("Max")){ + + if(element instanceof Property && propertyIsOwnedEnd((Property)element) && override(element)){ + ArrayList parents = getParentClasses(element); + if(parents.size() > 0){ + Property property = (Property)element; + + for(int j = 0; j < parents.size(); j++){ + Property attribute = null; + + List endList = ((AssociationClass)parents.get(j)).getOwnedEnds(); + for(int i = 0; i < endList.size(); i++){ + if(((Property)endList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)endList.get(i); + } + } + + if(attribute != null){ + String value = null; + if (qualifierName.equalsIgnoreCase("Min")){ + value = (new Integer(attribute.getLower())).toString(); + } else { + value = (new Integer(attribute.getUpper())).toString(); + } + return(new EffectiveInheritedValue(value, (Class)parents.get(j))); + } + } + } else { + return null; + } + } else { + return null; + } + // OCTETSTRING + } else if (qualifierName.equalsIgnoreCase("Octetstring")){ + if((element instanceof Property && override(element)) + || (element instanceof Operation && override(element)) + || element instanceof Parameter){ + + ArrayList parents = getParentClasses(element); + if(parents.size() > 0){ + // Property + if(element instanceof Property){ + Property property = (Property)element; + if(property.getType() != null && property.getType().getName().equalsIgnoreCase("String")){ + + for(int j = 0; j < parents.size(); j++){ + Property attribute = null; + List attributeList = ((Class)parents.get(j)).getAttributes(); + for(int i = 0; i < attributeList.size(); i++){ + if(((Property)attributeList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)attributeList.get(i); + } + } + + if(attribute != null){ + Type datatype = property.getType(); + if(datatype != null){ + if(datatype.getName().equalsIgnoreCase("Octetstring")){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + } + } + } else { + return null; + } + // Operation + } else if(element instanceof Operation){ + Operation operation = (Operation)element; + if(operation.getType() != null && operation.getType().getName().equalsIgnoreCase("String")){ + for(int j = 0; j < parents.size(); j++){ + Operation method = null; + + List operationsList = ((Class)parents.get(j)).getOwnedOperations(); + for(int i = 0; i < operationsList.size(); i++){ + if(((Operation)operationsList.get(i)).getName().equalsIgnoreCase(operation.getName())){ + method = (Operation)operationsList.get(i); + } + } + + if(method != null && equalMethods(operation, method)){ + + Type datatype = method.getType(); + if(datatype != null){ + if(datatype.getName().equalsIgnoreCase("Octetstring")){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + } + } + } else { + return null; + } + // Parameter + } else if(element instanceof Parameter){ + + Parameter parameter = (Parameter)element; + if(parameter.getType() != null && parameter.getType().getName().equalsIgnoreCase("String")){ + Operation operation = (Operation)parameter.getOwner(); + if(!override(operation)){ + return null; + } + for(int j = 0; j < parents.size(); j++){ + //String description = null; + Parameter param = null; + Operation method = null; + + List operationsList = ((Class)parents.get(j)).getOwnedOperations(); + for(int i = 0; i < operationsList.size(); i++){ + if(((Operation)operationsList.get(i)).getName().equalsIgnoreCase(operation.getName())){ + List parameterList = ((Operation)operationsList.get(i)).getOwnedParameters(); + for(int k = 0; k < parameterList.size(); k++){ + if(((Parameter)parameterList.get(k)).getName().equalsIgnoreCase(parameter.getName())){ + param = (Parameter)parameterList.get(k); + method = (Operation)operationsList.get(i); + } + } + } + } + + if(param != null && equalMethods(operation, method)){ + + Type datatype = param.getType(); + if(datatype != null){ + if(datatype.getName().equalsIgnoreCase("Octetstring")){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + } + } + return null; + } else { + return null; + } + } else { + return null; + } + } else { + return null; + } + } else { + return null; + } + // STATIC + } else if (qualifierName.equalsIgnoreCase("Static")){ + if((element instanceof Property || element instanceof Operation) && override(element)){ + ArrayList parents = getParentClasses(element); + if(parents.size() > 0){ + if(element instanceof Property){ + Property property = (Property)element; + + for(int j = 0; j < parents.size(); j++){ + Property attribute = null; + + List attributeList = ((Class)parents.get(j)).getAttributes(); + for(int i = 0; i < attributeList.size(); i++){ + if(((Property)attributeList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)attributeList.get(i); + } + } + + if(attribute != null && attribute.isStatic()){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + + } else if(element instanceof Operation){ + Operation operation = (Operation)element; + + for(int j = 0; j < parents.size(); j++){ + Operation method = null; + + List operationsList = ((Class)parents.get(j)).getOwnedOperations(); + for(int i = 0; i < operationsList.size(); i++){ + if(((Operation)operationsList.get(i)).getName().equalsIgnoreCase(operation.getName())){ + method = (Operation)operationsList.get(i); + } + } + + if(method != null && equalMethods(operation, method) && method.isStatic()){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + } + } else { + return null; + } + } else { + return null; + } + // WRITE + } else if (qualifierName.equalsIgnoreCase("Write")){ + if(element instanceof Property && override(element)){ + ArrayList parents = getParentClasses(element); + if(parents.size() > 0){ + Property property = (Property)element; + + for(int j = 0; j < parents.size(); j++){ + Property attribute = null; + + List attributeList = ((Class)parents.get(j)).getAttributes(); + for(int i = 0; i < attributeList.size(); i++){ + if(((Property)attributeList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)attributeList.get(i); + } + } + + if(attribute != null && !attribute.isReadOnly()){ + return(new EffectiveInheritedValue("true", (Class)parents.get(j))); + } + } + } else { + return null; + } + } else { + return null; + } + // Qualifiers in the qualifiers stereotype + } else { + // getParentClasses + ArrayList parents = getParentClasses(element); + if(parents.size() > 0 && !qualifierName.equalsIgnoreCase("ArrayType") + && !qualifierName.equalsIgnoreCase("Association")){ + + if(element instanceof Class){ + for(int j = 0; j < parents.size(); j++){ + String qualValue = getQualifiersStereotypeQualifer((Class)parents.get(j), qualifierName); + if(qualValue != null){ + return(new EffectiveInheritedValue(qualValue, (Class)parents.get(j))); + } + } + return null; + } else if (element instanceof Property && override(element)){ + Property property = (Property)element; + for(int j = 0; j < parents.size(); j++){ + String description = null; + Property attribute = null; + + List attributeList = ((Class)parents.get(j)).getAttributes(); + for(int i = 0; i < attributeList.size(); i++){ + if(((Property)attributeList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)attributeList.get(i); + } + } + if(propertyIsOwnedEnd(property)){ + List endList = ((AssociationClass)parents.get(j)).getOwnedEnds(); + for(int i = 0; i < endList.size(); i++){ + if(((Property)endList.get(i)).getName().equalsIgnoreCase(property.getName())){ + attribute = (Property)endList.get(i); + } + } + } + + if(attribute != null){ + + String qualValue = getQualifiersStereotypeQualifer(attribute, qualifierName); + if(qualValue != null){ + return(new EffectiveInheritedValue(qualValue, (Class)parents.get(j))); + } + } + } + return null; + + } else if (element instanceof Operation && override(element)){ + Operation operation = (Operation)element; + for(int j = 0; j < parents.size(); j++){ + String description = null; + Operation method = null; + + List operationsList = ((Class)parents.get(j)).getOwnedOperations(); + for(int i = 0; i < operationsList.size(); i++){ + if(((Operation)operationsList.get(i)).getName().equalsIgnoreCase(operation.getName())){ + method = (Operation)operationsList.get(i); + } + } + + if(method != null){ + + String qualValue = getQualifiersStereotypeQualifer(method, qualifierName); + if(qualValue != null){ + return(new EffectiveInheritedValue(qualValue, (Class)parents.get(j))); + } + } + } + return null; + + } else if (element instanceof Parameter){ + Parameter parameter = (Parameter)element; + Operation operation = (Operation)parameter.getOwner(); + if(!override(operation)){ + return null; + } + for(int j = 0; j < parents.size(); j++){ + String description = null; + Parameter param = null; + + List operationsList = ((Class)parents.get(j)).getOwnedOperations(); + for(int i = 0; i < operationsList.size(); i++){ + if(((Operation)operationsList.get(i)).getName().equalsIgnoreCase(operation.getName())){ + List parameterList = ((Operation)operationsList.get(i)).getOwnedParameters(); + for(int k = 0; k < parameterList.size(); k++){ + if(((Parameter)parameterList.get(k)).getName().equalsIgnoreCase(parameter.getName())){ + param = (Parameter)parameterList.get(k); + } + } + } + } + + if(param != null){ + + String qualValue = getQualifiersStereotypeQualifer(param, qualifierName); + if(qualValue != null){ + return(new EffectiveInheritedValue(qualValue, (Class)parents.get(j))); + } + } + } + return null; + } else { + return null; + } + } else { + return null; + } } return null; } @@ -815,6 +1185,24 @@ return parents; } + private static String getQualifiersStereotypeQualifer(NamedElement element, String qualifierName){ + String qualifierValue = null; + + Stereotype cimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); + List qualifierNames = (List)element.getValue(cimStereotype, "QualifierName"); + List qualifierValues = (List)element.getValue(cimStereotype, "QualifierValue"); + + for(int i = 0; i < qualifierNames.size(); i++){ + String qualName = (String)qualifierNames.get(i); + String qualValue = (String)qualifierValues.get(i); + + if(qualName.equalsIgnoreCase(qualifierName)){ + qualifierValue = qualValue; + } + } + return qualifierValue; + } + private static boolean override(NamedElement namedElement){ Stereotype cimStereotype = namedElement.getAppliedStereotype("CIM::Qualifiers"); @@ -831,6 +1219,38 @@ return false; } + private static boolean equalMethods(Operation method1, Operation method2){ + + if(method1 == null || method2 == null){ + return false; + } + + List methodParameters1 = method1.getOwnedParameters(); + List methodParameters2 = method2.getOwnedParameters(); + + if(methodParameters1.size() != methodParameters2.size()){ + return false; + } + + for (int i = 0; i < methodParameters1.size(); i++){ + Parameter parameter1 = (Parameter)methodParameters1.get(i); + Parameter parameter2 = (Parameter)methodParameters2.get(i); + + if(!parameter1.getName().equalsIgnoreCase(parameter2.getName())){ + return false; + } + if(!(parameter1.getType()).getName().equalsIgnoreCase((parameter2.getType()).getName())){ + if(((parameter1.getType()).getName().equalsIgnoreCase("String") || (parameter1.getType()).getName().equalsIgnoreCase("Octetstring")) && + ((parameter2.getType()).getName().equalsIgnoreCase("String") || (parameter2.getType()).getName().equalsIgnoreCase("Octetstring"))){ + continue; + } else { + return false; + } + } + } + return true; + } + } Index: EffectiveInheritedValue.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties/EffectiveInheritedValue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- EffectiveInheritedValue.java 19 Jul 2005 16:10:47 -0000 1.1 +++ EffectiveInheritedValue.java 20 Jul 2005 15:21:46 -0000 1.2 @@ -8,14 +8,26 @@ import org.eclipse.uml2.Class; +import com.ibm.ecute.utils.License; + /** - * @author Benjamin Bender - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * Copyright (c) 2005, International Business Machines + * + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES + * RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + * + * You can obtain a current copy of the Common Public License from + * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html + * + * @author Benjamin Bender <be...@de...> */ + public class EffectiveInheritedValue { + // Copyright + private static final String COPYRIGHT = License.COPYRIGHT; + protected String value; protected Class definedIn; @@ -31,4 +43,14 @@ public Class getDefinedIn(){ return this.definedIn; } + + public int getIntValue(){ + int value; + try { + value = (new Integer(this.value)).intValue(); + } catch (NumberFormatException e) { + return -1; + } + return value; + } } Index: ValuesTableHelper.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties/ValuesTableHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ValuesTableHelper.java 19 Jul 2005 16:10:47 -0000 1.2 +++ ValuesTableHelper.java 20 Jul 2005 15:21:46 -0000 1.3 @@ -7,15 +7,11 @@ package com.ibm.ecute.rsa.core.internal.properties; import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import org.eclipse.emf.common.util.EList; import org.eclipse.swt.widgets.Table; -import org.eclipse.uml2.AggregationKind; import org.eclipse.uml2.AssociationClass; import org.eclipse.uml2.Class; -import org.eclipse.uml2.Comment; import org.eclipse.uml2.Constraint; import org.eclipse.uml2.NamedElement; import org.eclipse.uml2.OpaqueExpression; @@ -23,18 +19,27 @@ import org.eclipse.uml2.Package; import org.eclipse.uml2.Parameter; import org.eclipse.uml2.Property; -import org.eclipse.uml2.Stereotype; import com.ibm.ecute.Qualifiers.Qualifier; - +import com.ibm.ecute.utils.License; /** - * @author Benjamin Bender - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * Copyright (c) 2005, International Business Machines + * + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES + * RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + * + * You can obtain a current copy of the Common Public License from + * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html + * + * @author Benjamin Bender <be...@de...> */ + public class ValuesTableHelper { + + // Copyright + private static final String COPYRIGHT = License.COPYRIGHT; Table table; @@ -42,302 +47,6 @@ this.table = table; } -// public void sortValuesTableBy(int columnNumber){ -// -// Collator collator = Collator.getInstance(Locale.getDefault()); -// -// boolean decreasing = false; -// TableItem[] column = table.getItems(); -// for (int h = 0; h < column.length-1; h++) { -// String value1 = column[h].getText(columnNumber); -// String value2 = column[h+1].getText(columnNumber); -// if (collator.compare(value1, value2) > 0) { -// decreasing = true; -// } -// } -// -// TableItem[] items = table.getItems(); -// for (int i = 1; i < items.length; i++) { -// String value1 = items[i].getText(columnNumber); -// QualifierValueObject data1 = (QualifierValueObject)items[i].getData(); -// for (int j = 0; j < i; j++){ -// String value2 = items[j].getText(columnNumber); -// if(decreasing){ -// if (collator.compare(value1, value2) < 0) { -// String[] values = {items[i].getText(0), items[i].getText(1), items[i].getText(2), -// items[i].getText(3), items[i].getText(4), items[i].getText(5)}; -// items[i].dispose(); -// TableItem item = new TableItem(table, SWT.NONE, j); -// item.setText(values); -// item.setData(data1); -// items = table.getItems(); -// break; -// } -// } else { -// if (collator.compare(value1, value2) > 0) { -// String[] values = {items[i].getText(0), items[i].getText(1), items[i].getText(2), -// items[i].getText(3), items[i].getText(4), items[i].getText(5)}; -// items[i].dispose(); -// TableItem item = new TableItem(table, SWT.NONE, j); -// item.setText(values); -// item.setData(data1); -// items = table.getItems(); -// break; -// } -// } -// } -// } -// } - - public ArrayList getInheritedQualifers(NamedElement element, ArrayList allAvailableQualifiers, boolean isReference){ - //TODO BB - ArrayList inheritedList = new ArrayList(); - - // get applicable qualifiers for the element - ArrayList applicableQualifiers = new ArrayList(); - for(int i = 0; i < allAvailableQualifiers.size(); i++){ - - Qualifier qualifier = (Qualifier)allAvailableQualifiers.get(i); - if(element instanceof Class && qualifier.classScope && !qualifier.RestrictedFlavor){ - applicableQualifiers.add(qualifier); - } else if(element instanceof AssociationClass && qualifier.associationScope && !qualifier.RestrictedFlavor){ - applicableQualifiers.add(qualifier); - } else if(element instanceof Property && !isReference && qualifier.propertyScope && !qualifier.RestrictedFlavor){ - applicableQualifiers.add(qualifier); - } else if(element instanceof Property && isReference && qualifier.referenceScope && !qualifier.RestrictedFlavor){ - applicableQualifiers.add(qualifier); - } else if(element instanceof Operation && qualifier.methodScope && !qualifier.RestrictedFlavor){ - applicableQualifiers.add(qualifier); - } else if(element instanceof Parameter && qualifier.parameterScope && !qualifier.RestrictedFlavor){ - applicableQualifiers.add(qualifier); - } - } - applicableQualifiers.trimToSize(); - -// if((element instanceof Class || element insta... [truncated message content] |