@@ -0,0 +1,2225 @@
+/*******************************************************************************%0D%0A * Copyright (c) 2009 David A Carlson.%0D%0A * All rights reserved. This program and the accompanying materials%0D%0A * are made available under the terms of the Eclipse Public License v1.0%0D%0A * which accompanies this distribution, and is available at%0D%0A * http://www.eclipse.org/legal/epl-v10.html%0D%0A * %0D%0A * Contributors:%0D%0A *     David A Carlson (XMLmodeling.com) - initial API and implementation%0D%0A *     %0D%0A * $Id$%0D%0A *******************************************************************************/%0D%0Apackage org.openhealthtools.mdht.uml.common.util;%0D%0A%0D%0Aimport java.util.ArrayList;%0D%0Aimport java.util.Collections;%0D%0Aimport java.util.List;%0D%0A%0D%0Aimport org.eclipse.uml2.uml.Class;%0D%0Aimport org.eclipse.uml2.uml.Classifier;%0D%0Aimport org.eclipse.uml2.uml.Property;%0D%0A%0D%0Apublic class AttributeList %7B%0D%0A%0D%0A%09private Class clazz;%0D%0A%09private List%3CProperty%3E attributes;%0D%0A%09%0D%0A%09private boolean isOmitAssociations = true;%0D%0A%09private boolean isAllSuperclasses = true;%0D%0A%09private boolean isSorted = true;%0D%0A%09%0D%0A%09public AttributeList(Class clazz) %7B%0D%0A%09%09this.clazz = clazz;%0D%0A%09%7D%0D%0A%09%0D%0A%09public List%3CProperty%3E getAttributes() %7B%0D%0A%09%09if (attributes == null) %7B%0D%0A%09%09%09fillAttributeList();%0D%0A%09%09%7D%0D%0A%0D%0A%09%09if (isSorted) %7B%0D%0A%09%09%09Collections.sort(attributes, new NamedElementComparator());%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09return attributes;%0D%0A%09%7D%0D%0A%0D%0A%09public Property getForName(String name) %7B%0D%0A%09%09if (name != null) %7B%0D%0A%09%09%09for (Property property : getAttributes()) %7B%0D%0A%09%09%09%09if (name.equals(property.getName())) %7B%0D%0A%09%09%09%09%09return property;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09return null;%0D%0A%09%7D%0D%0A%09%0D%0A%09private void fillAttributeList() %7B%0D%0A%09%09attributes = new ArrayList%3CProperty%3E();%0D%0A%09%09addAttributes(clazz);%0D%0A%09%7D%0D%0A%09%0D%0A%09private void addAttributes(Class aClass) %7B%0D%0A%09%09for (Property property : aClass.getOwnedAttributes()) %7B%0D%0A%09%09%09if (isOmitAssociations && property.getAssociation() != null) %7B%0D%0A%09%09%09%09continue;%0D%0A%09%09%09%7D%0D%0A%09%09%09// skip implicit redefinitions%0D%0A%09%09%09if (getForName(property.getName()) == null) %7B%0D%0A%09%09%09%09attributes.add(property);%0D%0A%09%09%09%7D%0D%0A%09%09%09%0D%0A%09%09%09//TODO skip explicit redefinitions%0D%0A%09%09%09%0D%0A%09%09%7D%0D%0A%0D%0A%09%09if (isAllSuperclasses) %7B%0D%0A%09%09%09for (Classifier general : aClass.getGenerals()) %7B%0D%0A%09%09%09%09if (general instanceof Class)%0D%0A%09%09%09%09%09addAttributes((Class)general);%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%7D%0D%0A

Add SubclassEditorDialog, generalized from RIM clone editor.