Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public static GuiEnum fromUML(UmlEnum st)
        {
            GuiEnum s = new GuiEnum();

            s.name = st.UniqueName;
            s.st   = st;
            s.Created();
            return(s);
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
 public override void PostLoad()
 {
     st = parent.proj.model.GetObject(name) as UmlEnum;
     base.PostLoad();
 }