public static List <PSMAttribute> GetAttributesForGroup(this PSMClass groupNode, Version oldVersion) { // take elements in the group that used to be attributes List <PSMAttribute> result = new List <PSMAttribute>(); List <NodeElementWrapper> contentComponents = groupNode.GetSubtreeElements(); foreach (NodeElementWrapper contentComponent in contentComponents) { if (contentComponent is SimpleNodeElement) { SimpleNodeElement simpleNodeElement = ((SimpleNodeElement)contentComponent); if (simpleNodeElement.Element is PSMAttribute) { PSMAttribute attribute = (PSMAttribute)simpleNodeElement.Element; PSMAttribute attributeOldVersion = (PSMAttribute)attribute.GetInVersion(oldVersion); if (attributeOldVersion != null) { PSMElement parent = (attributeOldVersion).Class; if (parent is PSMClass && ((PSMClass)parent).HasElementLabel) { continue; } if (attribute.AttributeContainer != null && attributeOldVersion.AttributeContainer == null) { result.Add(attribute); } } } } } return(result); }
private static void ConvertToContentGroup(ref List <NodeElementWrapper> nodeContents, SimpleNodeElement nodeElement) { Debug.Assert(nodeElement.Element is PSMClass); int index = nodeContents.IndexOf(nodeElement); nodeContents.RemoveAt(index); ContentGroup cg = ((PSMClass)nodeElement.Element).GetNodeAsContentGroup(); nodeContents.Insert(index, cg); }