Ejemplo n.º 1
0
        /// <summary>
        /// Resets the current document data.
        /// </summary>
        public virtual void Reset()
        {
            if (CurrentModelContext != null)
            {
                CurrentModelContext.Reset();
            }

            // clear undo manager stack
            if (this.UndoManager != null)
            {
                this.UndoManager.Flush();
            }

            this.OnStoreDisposing(new EventArgs());

            lock (this.eventSubscLock)
            {
                this.hasSubscribedToEvents = false;
            }

            this.Dispose();
            store = null;

            this.InitializeHelper(false, false);
            this.RaiseUndoRedoChangeEvents();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets searchable elements as specified by search source enumeration.
        /// </summary>
        /// <param name="store">Store.</param>
        /// <param name="source">Search source.</param>
        /// <returns>List of searchable elements.</returns>
        public virtual List <ModelElement> GetSearchableElements(DomainModelStore store, SearchSourceEnum source)
        {
            System.Collections.Generic.List <ModelElement> elements = new System.Collections.Generic.List <ModelElement>();
            if (source == SearchSourceEnum.Elements || source == SearchSourceEnum.ElementsAndReferenceRelationships)
            {
                foreach (DomainModelElement modelElement in store.ElementDirectory.FindElements <DomainModelElement>())
                {
                    if (IsElementIncludedInDomainTree(store, modelElement.GetDomainClassId()))
                    {
                        elements.Add(modelElement);
                    }
                }
            }
            if (source == SearchSourceEnum.ReferenceRelationships || source == SearchSourceEnum.ElementsAndReferenceRelationships)
            {
                foreach (DomainModelLink modelElement in store.ElementDirectory.FindElements <DomainModelLink>())
                {
                    if (modelElement.IsEmbedding)
                    {
                        continue;
                    }

                    DomainClassInfo info = modelElement.GetDomainClass();
                    if (IsLinkIncludedInDomainTree(store, info.Id))
                    {
                        elements.Add(modelElement);
                    }
                }
            }

            return(elements);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  Creates a new store
        /// </summary>
        private void CreateStore(bool bInitAsynchronous)
        {
            lock (this.storeLock)
            {
                if (!this.isStoreCreated)
                {
                    store = new DomainModelStore(bInitAsynchronous, GetDomainModels());
                    InitializeSerializationHelper(this.store);
                }

                // loading done
                this.isStoreCreated = true;
            }
        }
Ejemplo n.º 4
0
        private void InitializeSerializationHelper(DomainModelStore store)
        {
            try
            {
                this.InitializeSerializationForStore(store);
            }
            catch (Exception ex)
            {
                Tum.PDE.ToolFramework.Modeling.Base.LogHelper.LogError("Error serialization intialization: " + ex.Message);

                // rethrow exception
                throw new Exception("Error serialization intialization", ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public DomainDataAdvDirectory(DomainModelStore store)
        {
            this.Store = store;

            this.extensions = new Dictionary <Type, IDomainDataExtensionDirectory>();

            this.classDictionary                = new Dictionary <Guid, DomainClassAdvancedInfo>();
            this.relationshipDictionary         = new Dictionary <Guid, DomainRelationshipAdvancedInfo>();
            this.modelContextDictionary         = new Dictionary <Guid, ModelContextInfo>();
            this.embRelationshipOrderDictionary = new Dictionary <Guid, EmbeddingRelationshipOrderInfo>();

            this.parentChildrenMapping   = new Dictionary <Guid, Dictionary <Guid, List <Guid> > >();
            this.parentChildrenCMMapping = new Dictionary <Guid, Dictionary <Guid, List <Guid> > >();

            this.domainClassSourceReferences = new Dictionary <Guid, List <ReferenceRelationshipAdvancedInfo> >();
            this.domainClassTargetReferences = new Dictionary <Guid, List <ReferenceRelationshipAdvancedInfo> >();

            this.domainClassSourceEmbeddings = new Dictionary <Guid, List <EmbeddingRelationshipAdvancedInfo> >();
            this.domainClassTargetEmbeddings = new Dictionary <Guid, List <EmbeddingRelationshipAdvancedInfo> >();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="store">Store containing the domain model.</param>
 /// <param name="dModelId">Domain model Id.</param>
 protected DomainModelBase(DomainModelStore store, Guid dModelId)
     : base(store, dModelId)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Serialization initialization.
 /// </summary>
 /// <param name="store">Store.</param>
 protected abstract void InitializeSerializationForStore(DomainModelStore store);
Ejemplo n.º 8
0
 /// <summary>
 /// Gets whether a link is included in the domain tree and therefore should be included in the search.
 /// </summary>
 /// <param name="store">Store.</param>
 /// <param name="domainClassId">Domain class Id.</param>
 /// <returns>True if the link is included in the domain tree. False otherwise.</returns>
 public virtual bool IsLinkIncludedInDomainTree(DomainModelStore store, Guid domainClassId)
 {
     return(store.DomainDataAdvDirectory.IsReferenceIncludedInModel(domainClassId));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets whether an element is included in the domain tree and therefore should be included in the search.
 /// </summary>
 /// <param name="store">Store.</param>
 /// <param name="domainClassId">Domain class Id.</param>
 /// <returns>True if the element is included in the domain tree. False otherwise.</returns>
 public virtual bool IsElementIncludedInDomainTree(DomainModelStore store, Guid domainClassId)
 {
     return(store.DomainDataAdvDirectory.IsIncludedInModel(domainClassId));
 }