public IAnnotationData SetAnnotation(IWriteSession session, IProjectContext projectContext, IModelElement element, string annotation) { var pluginData = GetPluginData(projectContext); if (pluginData == null) { pluginData = new AnnotationPluginData(); _pluginDataService.SetPluginData(session, projectContext, PLUGIN_ID, pluginData); } var annotationData = GetAnnotationData(projectContext, element); if (annotationData == null) { annotationData = new AnnotationData { Element = element, Annotation = annotation }; pluginData.Annotations.Add(annotationData); session.Save(pluginData); } else { annotationData.Annotation = annotation; } session.Save(annotationData); return(annotationData); }
private void AddModelNamespace(IWriteSession session, IProjectContext projectContext, INamespace @namespace) { var rootNamespace = projectContext.Project.RootNamespace; rootNamespace.Namespaces.Add(@namespace); session.Save(rootNamespace); session.SaveHierarchy(@namespace); }