private static Dictionary<DomainClassInfo, object> BuildCustomSerializationOmissions(Store store) { Dictionary<DomainClassInfo, object> retVal = new Dictionary<DomainClassInfo, object>(); DomainDataDirectory dataDir = store.DomainDataDirectory; retVal[dataDir.FindDomainRelationship(ParentShapeContainsNestedChildShapes.DomainClassId)] = null; retVal[dataDir.FindDomainRelationship(PresentationViewsSubject.DomainClassId)] = null; retVal[dataDir.FindDomainClass(BarkerEntityShape.DomainClassId)] = null; return retVal; }
private static Dictionary <DomainClassInfo, object> BuildCustomSerializationOmissions(Store store) { Dictionary <DomainClassInfo, object> retVal = new Dictionary <DomainClassInfo, object>(); DomainDataDirectory dataDir = store.DomainDataDirectory; retVal[dataDir.FindDomainRelationship(ExcludedORMModelElement.DomainClassId)] = null; return(retVal); }
/// <summary> /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> during activation and /// deactivation. /// </summary> /// <param name="store">The <see cref="Store"/> for which the <see cref="EventHandler{TEventArgs}"/>s should be managed.</param> /// <param name="action">The <see cref="EventHandlerAction"/> that should be taken for the <see cref="EventHandler{TEventArgs}"/>s.</param> private void ManageStoreEvents(Store store, EventHandlerAction action) { if (store == null || store.Disposed) { return; // bail out } DomainDataDirectory dataDirectory = store.DomainDataDirectory; ModelingEventManager eventManager = ModelingEventManager.GetModelingEventManager(store); DomainClassInfo classInfo = dataDirectory.FindDomainClass(ReferenceModeKind.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementPropertyChangedEventArgs>(ReferenceModeKindChangeEvent), action); classInfo = dataDirectory.FindDomainClass(CustomReferenceMode.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementPropertyChangedEventArgs>(CustomReferenceModeChangeEvent), action); classInfo = dataDirectory.FindDomainRelationship(ModelHasReferenceMode.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(CustomReferenceModeAddEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(CustomReferenceModeRemoveEvent), action); classInfo = dataDirectory.FindDomainRelationship(ReferenceModeHasReferenceModeKind.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <RolePlayerChangedEventArgs>(ReferenceModeHasKindChangeEvent), action); }
/// <summary> /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="ExternalConstraintShape"/>s. /// </summary> /// <param name="store">The <see cref="Store"/> for which the <see cref="EventHandler{TEventArgs}"/>s should be managed.</param> /// <param name="eventManager">The <see cref="ModelingEventManager"/> used to manage the <see cref="EventHandler{TEventArgs}"/>s.</param> /// <param name="action">The <see cref="EventHandlerAction"/> that should be taken for the <see cref="EventHandler{TEventArgs}"/>s.</param> public static new void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action) { DomainDataDirectory dataDirectory = store.DomainDataDirectory; eventManager.AddOrRemoveHandler(dataDirectory.FindDomainRole(SetComparisonConstraintHasRoleSequence.RoleSequenceDomainRoleId), new EventHandler <RolePlayerOrderChangedEventArgs>(RolePlayerOrderChangedEvent), action); eventManager.AddOrRemoveHandler(dataDirectory.FindDomainProperty(SetComparisonConstraint.ModalityDomainPropertyId), new EventHandler <ElementPropertyChangedEventArgs>(SetComparisonConstraintChangedEvent), action); eventManager.AddOrRemoveHandler(dataDirectory.FindDomainProperty(SetConstraint.ModalityDomainPropertyId), new EventHandler <ElementPropertyChangedEventArgs>(SetConstraintChangedEvent), action); DomainClassInfo classInfo = dataDirectory.FindDomainRelationship(EntityTypeHasPreferredIdentifier.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(PreferredIdentifierAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(PreferredIdentifierRemovedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <RolePlayerChangedEventArgs>(PreferredIdentifierRolePlayerChangedEvent), action); }
/// <summary> /// Implement <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/> /// </summary> protected void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { // Force toolbox refresh on next selection change myLastToolboxDiagramType = null; // Attach extra properties and events if we're tracking diagram order and position Store store = this.Store; if (null != store.FindDomainModel(DiagramDisplayDomainModel.DomainModelId)) { if (0 != (reasons & EventSubscriberReasons.ModelStateEvents)) { IPropertyProviderService providerService = ((IFrameworkServices)store).PropertyProviderService; if (providerService != null) { providerService.AddOrRemovePropertyProvider(typeof(Diagram), DiagramDisplay.ProvideDiagramProperties, true, action); } } if (0 != (reasons & EventSubscriberReasons.UserInterfaceEvents)) { DomainDataDirectory dataDirectory = store.DomainDataDirectory; DomainClassInfo classInfo; classInfo = dataDirectory.FindDomainRelationship(DiagramDisplayHasDiagramOrder.DomainClassId); if (classInfo != null) { // DiagramDisplay is an optional domain model, it may not be loaded in the store eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(VerifyPageOrderEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(VerifyPageOrderEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <RolePlayerOrderChangedEventArgs>(VerifyPageOrderEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <RolePlayerChangedEventArgs>(VerifyPageOrderEvent), action); } } } if (0 != (reasons & EventSubscriberReasons.UserInterfaceEvents)) { eventManager.AddOrRemoveHandler(new EventHandler <ElementEventsBegunEventArgs>(ElementEventsBegunEvent), action); eventManager.AddOrRemoveHandler(new EventHandler <ElementEventsEndedEventArgs>(ElementEventsEndedEvent), action); } } }