コード例 #1
0
        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);
        }
コード例 #2
0
        private void AddModelNamespace(IWriteSession session, IProjectContext projectContext, INamespace @namespace)
        {
            var rootNamespace = projectContext.Project.RootNamespace;

            rootNamespace.Namespaces.Add(@namespace);

            session.Save(rootNamespace);
            session.SaveHierarchy(@namespace);
        }