void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { Store store = Store; IPropertyProviderService propertyService = ((IFrameworkServices)store).PropertyProviderService; IExtensionVerbalizerService verbalizerService = ((IORMToolServices)store).ExtensionVerbalizerService; propertyService.AddOrRemovePropertyProvider(typeof(ORMModel), CustomPropertyProviders.CustomPropertiesEditor, true, action); propertyService.AddOrRemovePropertyProvider(typeof(ORMModel), CustomPropertyProviders.Model, false, action); propertyService.AddOrRemovePropertyProvider(typeof(ORMDiagram), CustomPropertyProviders.ORMDiagram, false, action); propertyService.AddOrRemovePropertyProvider(typeof(ElementGrouping), CustomPropertyProviders.ElementGrouping, false, action); propertyService.AddOrRemovePropertyProvider(typeof(ObjectType), CustomPropertyProviders.ObjectType, true, action); propertyService.AddOrRemovePropertyProvider(typeof(SubtypeFact), CustomPropertyProviders.SubtypeFact, true, action); propertyService.AddOrRemovePropertyProvider(typeof(FactType), CustomPropertyProviders.FactType, false, action); propertyService.AddOrRemovePropertyProvider(typeof(Role), CustomPropertyProviders.Role, true, action); propertyService.AddOrRemovePropertyProvider(typeof(CardinalityConstraint), CustomPropertyProviders.CardinalityConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(FrequencyConstraint), CustomPropertyProviders.FrequencyConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(MandatoryConstraint), CustomPropertyProviders.MandatoryConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(RingConstraint), CustomPropertyProviders.RingConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(UniquenessConstraint), CustomPropertyProviders.UniquenessConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(EqualityConstraint), CustomPropertyProviders.EqualityConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(ExclusionConstraint), CustomPropertyProviders.ExclusionConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(SubsetConstraint), CustomPropertyProviders.SubsetConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(ValueComparisonConstraint), CustomPropertyProviders.ValueComparisonConstraint, true, action); propertyService.AddOrRemovePropertyProvider(typeof(ValueConstraint), CustomPropertyProviders.ValueConstraint, true, action); if (verbalizerService != null) { verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ORMModel), DefaultVerbalizationProviders.Model, false, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ORMDiagram), DefaultVerbalizationProviders.ORMDiagram, false, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ElementGrouping), DefaultVerbalizationProviders.ElementGrouping, false, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ObjectType), DefaultVerbalizationProviders.ObjectType, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(SubtypeFact), DefaultVerbalizationProviders.SubtypeFact, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(FactType), DefaultVerbalizationProviders.FactType, false, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(Role), DefaultVerbalizationProviders.Role, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(CardinalityConstraint), DefaultVerbalizationProviders.CardinalityConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(FrequencyConstraint), DefaultVerbalizationProviders.FrequencyConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(MandatoryConstraint), DefaultVerbalizationProviders.MandatoryConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(RingConstraint), DefaultVerbalizationProviders.RingConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(UniquenessConstraint), DefaultVerbalizationProviders.UniquenessConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(EqualityConstraint), DefaultVerbalizationProviders.EqualityConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ExclusionConstraint), DefaultVerbalizationProviders.ExclusionConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(SubsetConstraint), DefaultVerbalizationProviders.SubsetConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ValueComparisonConstraint), DefaultVerbalizationProviders.ValueComparisonConstraint, true, action); verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ValueConstraint), DefaultVerbalizationProviders.ValueConstraint, true, action); } } }
/// <summary> /// Implements <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/> /// </summary> protected void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { IPropertyProviderService propertyProvider = ((IFrameworkServices)Store).PropertyProviderService; propertyProvider.AddOrRemovePropertyProvider(typeof(FactType), AssimilationMapping.PopulateAssimilationMappingExtensionProperties, true, action); propertyProvider.AddOrRemovePropertyProvider(typeof(ObjectType), AssimilationMapping.PopulateObjectTypeAbsorptionExtensionProperties, false, action); propertyProvider.AddOrRemovePropertyProvider(typeof(ObjectType), ReferenceModeNaming.PopulateReferenceModeNamingExtensionProperties, false, action); propertyProvider.AddOrRemovePropertyProvider(typeof(ORMModel), ReferenceModeNaming.PopulateDefaultReferenceModeNamingExtensionPropertiesOnORMModel, false, action); propertyProvider.AddOrRemovePropertyProvider(typeof(RelationalNameGenerator), ReferenceModeNaming.PopulateDefaultReferenceModeNamingExtensionPropertiesOnColumnNameGenerator, false, action); if (0 != (reasons & EventSubscriberReasons.ModelStateEvents)) { SchemaCustomization.ManageModelingEventHandlers(eventManager, this.Store, 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); } } }