コード例 #1
0
        /// <summary>
        /// Gets a default file in the project, if this element doesn't exist, this element will be created
        /// </summary>
        /// <param name="key">Element key for the model</param>
        /// <returns>Defaul file element</returns>
        public StarUML.IUMLClass GetAuxFile(string key)
        {
            //StarUML.IUMLNamespace model = ((StarUML.IUMLCollaboration)FindModel(key)).RepresentedClassifier.Namespace;
            StarUML.IUMLNamespace model = ((StarUML.IUMLCollaboration)FindModel(key));
            StarUML.IUMLClass     e     = null;

            if (model != null)
            {
                try
                {
                    e = (StarUML.IUMLClass)model.FindByName("DETAUX");
                    if (e == null)
                    {
                        e      = app.UMLFactory.CreateClass(model);
                        e.Name = "DETAUX";
                        e.SetStereotype("File");
                    }
                }
                catch (Exception ex)
                {
                    log.Error("", ex);
                }
            }

            return(e);
        }
コード例 #2
0
        /// <summary>
        /// Create the association between two elements
        /// </summary>
        /// <typeparam name="T">Type for the first element</typeparam>
        /// <typeparam name="T2">Type for second element</typeparam>
        /// <param name="element1">First element</param>
        /// <param name="element2">Second element</param>
        /// <param name="ownerElement">Owner of the association</param>
        public static void CreateAssociation <T, T2>(T element1, T2 element2, IUMLElement ownerElement)
            where T : ActiveRecord <T>, new()
            where T2 : ActiveRecord <T2>, new()
        {
            try
            {
                StarUML.IUMLNamespace  owner           = dataAccess.FindModel(ownerElement.Guid) as StarUML.IUMLNamespace;
                StarUML.IUMLClassifier elementStarUML1 = dataAccess.FindModel(element1.Guid) as StarUML.IUMLClassifier;
                StarUML.IUMLClassifier elementStarUML2 = dataAccess.FindModel(element2.Guid) as StarUML.IUMLClassifier;

                dataAccess.Factory.CreateAssociation(owner, elementStarUML1, elementStarUML2);
            }
            catch (Exception ex)
            {
                log.Error("CreateAssociation", ex);
            }
        }
コード例 #3
0
        /// <summary>
        /// Create the dependency between two elements
        /// </summary>
        /// <typeparam name="T">Type for the first element</typeparam>
        /// <typeparam name="T2">Type for second element</typeparam>
        /// <param name="client">Client for the dependency</param>
        /// <param name="supplier">Supplier for the dependency</param>
        /// <param name="stereoTypeName">Stereotype</param>
        /// <param name="ownerElement">Owner of the dependency</param>
        public static void CreateDependency <T, T2>(T client, T2 supplier, string stereoTypeName, IUMLElement ownerElement)
            where T : ActiveRecord <T>, new()
            where T2 : ActiveRecord <T2>, new()
        {
            try
            {
                StarUML.IUMLNamespace    owner           = dataAccess.FindModel(ownerElement.Guid) as StarUML.IUMLNamespace;
                StarUML.IUMLModelElement elementStarUML1 = dataAccess.FindModel(client.Guid) as StarUML.IUMLModelElement;
                StarUML.IUMLModelElement elementStarUML2 = dataAccess.FindModel(supplier.Guid) as StarUML.IUMLModelElement;

                StarUML.IUMLDependency dependency = dataAccess.Factory.CreateDependency(owner, elementStarUML1, elementStarUML2);
                dependency.SetStereotype(stereoTypeName);
            }
            catch (Exception ex)
            {
                log.Error("CreateDependency", ex);
            }
        }