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); } }
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); } } }
/// <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)); }