/// <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; }
/// <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(); }
/// <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; } }
/// <summary> /// Serialization initialization. /// </summary> /// <param name="store">Store.</param> protected abstract void InitializeSerializationForStore(DomainModelStore store);
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 { } }
/// <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); }
/// <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); }