コード例 #1
0
        private void OnElementDeleted(object sender, ElementDeletedEventArgs e)
        {
            IArtifactLinkContainer artifactContainer = ModelCollector.GetArtifacts(e.ModelElement);

            if (artifactContainer != null && artifactContainer.ArtifactLinks != null)
            {
                ICodeGenerationService codeGenerationService = GetService <ICodeGenerationService>();
                codeGenerationService.ValidateDeleteFromCollection(artifactContainer.ArtifactLinks);
            }
        }
コード例 #2
0
 private void OnElementChanged(object sender, ElementPropertyChangedEventArgs e)
 {
     if (e.DomainProperty.DisplayName.Equals("Name", StringComparison.OrdinalIgnoreCase))
     {
         try
         {
             string oldName = e.OldValue.ToString();
             string newName = e.NewValue.ToString();
             IArtifactLinkContainer artifactContainer = ModelCollector.GetArtifacts(e.ModelElement);
             if (artifactContainer != null && artifactContainer.ArtifactLinks != null)
             {
                 ICodeGenerationService codeGenerationService = GetService <ICodeGenerationService>();
                 codeGenerationService.ValidateRenameFromCollection(artifactContainer.ArtifactLinks, newName, oldName);
             }
         }
         catch (Exception ex)
         {
             Logger.Write(ex);
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Will walk until it finds the first valid artifact link with roles
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <returns></returns>
        public static bool HasValidArtifactsAndRoles(IServiceProvider serviceProvider)
        {
            IArtifactLinkContainer container = ModelCollector.GetArtifacts(serviceProvider, true);

            return(HasValidArtifacts(container) && HasRoles(container));
        }