private UmlType UpdateTypeInArray(ArrayList Types, Type t, string typename) { // resolve kind UmlKind kind = UmlKind.Class; if (t.IsInterface) { kind = UmlKind.Interface; } else if (t.IsEnum) { kind = UmlKind.Enum; } else if (t.IsValueType) { kind = UmlKind.Struct; } // search existing or create a new UmlType found = null; foreach (UmlType e in Types) { if (e.name.Equals(typename)) { found = e; break; } } recreate: if (found == null) { if (kind == UmlKind.Enum) { found = new UmlEnum(); } else { found = new UmlClass(); ((UmlClass)found).kind = kind; } found.name = typename; Types.Add(found); } else { if (found.Kind == UmlKind.Enum && kind != UmlKind.Enum || found.Kind != UmlKind.Enum && kind == UmlKind.Enum) { Types.Remove(found); found = null; goto recreate; } if (found.Kind != UmlKind.Enum) { ((UmlClass)found).kind = kind; } found.Deleted = false; } return(found); }
private UmlInstanceType GetUmlType(DiagramTypeElement diagramElement) { UmlInstanceType t = null; if (diagramElement.Type is InterfaceElement) { t = new UmlInterface(); var data = new UmlInterfaceData(); data.Owner = diagramElement; t.DataSource = data; } if (diagramElement.Type is ClassElement) { t = new UmlClass(); var data = new UmlClassData(); data.Owner = diagramElement; t.DataSource = data; } if (diagramElement.Type is EnumElement) { t = new UmlEnum(); var data = new UmlEnumData(); data.Owner = diagramElement; t.DataSource = data; } return(t); }
public static GuiEnum fromUML(UmlEnum st) { GuiEnum s = new GuiEnum(); s.name = st.UniqueName; s.st = st; s.Created(); return(s); }
private UmlType UpdateTypeInArray( ArrayList Types, Type t, string typename ) { // resolve kind UmlKind kind = UmlKind.Class; if( t.IsInterface ) kind = UmlKind.Interface; else if( t.IsEnum ) kind = UmlKind.Enum; else if( t.IsValueType ) kind = UmlKind.Struct; // search existing or create a new UmlType found = null; foreach( UmlType e in Types ) if( e.name.Equals( typename ) ) { found = e; break; } recreate: if( found == null ) { if( kind == UmlKind.Enum ) { found = new UmlEnum(); } else { found = new UmlClass(); ((UmlClass)found).kind = kind; } found.name = typename; Types.Add( found ); } else { if( found.Kind == UmlKind.Enum && kind != UmlKind.Enum || found.Kind != UmlKind.Enum && kind == UmlKind.Enum ) { Types.Remove( found ); found = null; goto recreate; } if( found.Kind != UmlKind.Enum ) { ((UmlClass)found).kind = kind; } found.Deleted = false; } return found; }
public override void PostLoad() { st = parent.proj.model.GetObject(name) as UmlEnum; base.PostLoad(); }