/// <summary> /// Implements <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/> /// </summary> protected void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (0 == (reasons & EventSubscriberReasons.DocumentLoaded)) { return; } 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); }
/// <summary> /// Implements <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/>. /// </summary> protected void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { // UNDONE: If we delay attach user interface events (possible in the future for // external model scenarios), then we need to check ModelStateEvents here and // be more precise in which events are attached that affect model state such as // calculated shape size. Currently, this is only called without 'UserInterfaceEvents' // for unit-testing. if ((EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents) == (reasons & (EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents))) { Store store = Store; ORMBaseShape.ManageEventHandlers(store, eventManager, action); ReadingShape.ManageEventHandlers(store, eventManager, action); ExternalConstraintShape.ManageEventHandlers(store, eventManager, action); RolePlayerLink.ManageEventHandlers(store, eventManager, action); ObjectTypeShape.ManageEventHandlers(store, eventManager, action); ORMBaseBinaryLinkShape.ManageEventHandlers(store, eventManager, action); FactTypeShape.ManageEventHandlers(store, eventManager, action); SubtypeLink.ManageEventHandlers(store, eventManager, action); } }
/// <summary> /// Implements <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/>. /// </summary> protected void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { // UNDONE: If we delay attach user interface events (possible in the future for // external model scenarios), then we need to check ModelStateEvents here and // be more precise in which events are attached that affect model state such as // calculated shape size. Currently, this is only called without 'UserInterfaceEvents' // for unit-testing. if ((EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents) == (reasons & (EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents))) { Store store = Store; ORMDiagram.ManageEventHandlers(store, eventManager, action); ORMBaseShape.ManageEventHandlers(store, eventManager, action); ReadingShape.ManageEventHandlers(store, eventManager, action); ExternalConstraintShape.ManageEventHandlers(store, eventManager, action); RolePlayerLink.ManageEventHandlers(store, eventManager, action); ObjectTypeShape.ManageEventHandlers(store, eventManager, action); ORMBaseBinaryLinkShape.ManageEventHandlers(store, eventManager, action); FactTypeShape.ManageEventHandlers(store, eventManager, action); SubtypeLink.ManageEventHandlers(store, eventManager, action); } if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { IORMToolServices services; IORMExtendableElementService extendableElementService; if (null != (services = Store as IORMToolServices) && null != (extendableElementService = services.ExtendableElementService)) { extendableElementService.RegisterExtensionRoles(new Guid[] { ORMDiagramHasExtensionElement.ExtensionDomainRoleId, ORMBaseShapeHasExtensionElement.ExtensionDomainRoleId }); } } }
void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (action == EventHandlerAction.Add && 0 != (reasons & EventSubscriberReasons.DocumentLoading)) { // Hack implementation to turn on the FixupDiagram rules before the model loads. // Normally this would be done with a coordinated fixup listener. However, we // have no control over the DSL-generated FixupDiagram rule without jumping through // a lot of hoops, so we do it here, which fires after the rules are created and // before the model loads. Store.RuleManager.EnableRule(typeof(FixUpDiagram)); } if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { Store store = Store; TableShape.ManageEventHandlers(store, eventManager, action); RelationalDiagram.ManageEventHandlers(store, eventManager, action); } }
/// <summary> /// Implements <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/>. /// </summary> protected void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { Store store = Store; if (action == EventHandlerAction.Add && (EventSubscriberReasons.ModelStateEvents | EventSubscriberReasons.DocumentLoading) == (reasons & (EventSubscriberReasons.ModelStateEvents | EventSubscriberReasons.DocumentLoading))) { store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo[NamedElementDictionary.DefaultAllowDuplicateNamesKey] = null; } if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { if (0 != (reasons & EventSubscriberReasons.ModelStateEvents)) { NamedElementDictionary.ManageModelStateEventHandlers(store, eventManager, action); ORMModel.ManageModelStateEventHandlers(store, eventManager, action); } if (action == EventHandlerAction.Add && 0 == (reasons & EventSubscriberReasons.DocumentReloading) && 0 != (reasons & EventSubscriberReasons.UserInterfaceEvents)) { Design.ORMEditorUtility.RegisterModelErrorActivators(store); } } if (0 != (reasons & EventSubscriberReasons.SurveyQuestionEvents)) { DomainDataDirectory directory = store.DomainDataDirectory; EventHandler<ElementDeletedEventArgs> standardDeleteHandler = new EventHandler<ElementDeletedEventArgs>(ModelElementRemovedEvent); EventHandler<ElementPropertyChangedEventArgs> standardGlyphChangeHandler = new EventHandler<ElementPropertyChangedEventArgs>(SurveyGlyphChangedEvent); EventHandler<ElementDeletedEventArgs> standardErrorPathDeletedHandler = new EventHandler<ElementDeletedEventArgs>(ModelElementErrorStateChangedEvent); EventHandler<RolePlayerChangedEventArgs> standardErrorPathRolePlayedChangedHandler = new EventHandler<RolePlayerChangedEventArgs>(ModelElementErrorStateOwnerPathChangedEvent); //Object Type DomainClassInfo classInfo = directory.FindDomainClass(ObjectType.DomainClassId); DomainPropertyInfo propertyInfo = directory.FindDomainProperty(ObjectType.NameDomainPropertyId); eventManager.AddOrRemoveHandler(classInfo, propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(ObjectTypeNameChangedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ObjectTypeAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, standardDeleteHandler, action); //Fact Type classInfo = directory.FindDomainClass(FactType.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(FactTypeAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, standardDeleteHandler, action); //Set Constraint classInfo = directory.FindDomainClass(SetConstraint.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(SetConstraintAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, standardDeleteHandler, action); //Set Comparison classInfo = directory.FindDomainClass(SetComparisonConstraint.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(SetComparisonConstraintAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, standardDeleteHandler, action); // External constraint expansion classInfo = directory.FindDomainRelationship(FactConstraint.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(FactConstraintAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(FactConstraintDeletedEvent), action); //Track name change EventHandler<ElementPropertyChangedEventArgs> standardNameChangedHandler = new EventHandler<ElementPropertyChangedEventArgs>(ModelElementNameChangedEvent); propertyInfo = directory.FindDomainProperty(ORMNamedElement.NameDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardNameChangedHandler , action); propertyInfo = directory.FindDomainProperty(FactType.NameChangedDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardNameChangedHandler, action); propertyInfo = directory.FindDomainProperty(ModelNote.TextDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardNameChangedHandler, action); // Derivation display (* after derived fact type and subtype names) classInfo = directory.FindDomainClass(FactTypeHasDerivationRule.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(FactTypeDerivationRuleAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(FactTypeDerivationRuleDeletedEvent), action); classInfo = directory.FindDomainClass(SubtypeHasDerivationRule.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(SubtypeDerivationRuleAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(SubtypeDerivationRuleDeletedEvent), action); //FactTypeHasRole classInfo = directory.FindDomainClass(FactTypeHasRole.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(FactTypeHasRoleAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(FactTypeHasRoleDeletedEvent), action); //Role propertyInfo = directory.FindDomainProperty(Role.NameDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(RoleNameChangedEvent), action); //ValueTypeHasDataType classInfo = directory.FindDomainClass(ValueTypeHasDataType.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ValueTypeHasDataTypeAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ValueTypeHasDataTypeDeletedEvent), action); //Objectification classInfo = directory.FindDomainClass(Objectification.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ObjectificationAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ObjectificationDeletedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<RolePlayerChangedEventArgs>(ObjectificationRolePlayerChangedEvent), action); propertyInfo = directory.FindDomainProperty(Objectification.IsImpliedDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(ObjectificationChangedEvent), action); //Role player changes classInfo = directory.FindDomainClass(ObjectTypePlaysRole.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(RolePlayerAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(RolePlayerDeletedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<RolePlayerChangedEventArgs>(RolePlayerRolePlayerChangedEvent), action); //Error state changed classInfo = directory.FindDomainRelationship(ElementAssociatedWithModelError.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ModelElementErrorStateChangedEvent), action); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(FactTypeHasFactTypeInstance.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(ObjectTypeHasObjectTypeInstance.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(ValueConstraintHasValueRange.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(RolePathOwnerOwnsLeadRolePath.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathRolePlayedChangedHandler, action); classInfo = directory.FindDomainRelationship(RoleSubPathIsContinuationOfRolePath.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathRolePlayedChangedHandler, action); classInfo = directory.FindDomainRelationship(PathedRole.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(PathedRoleHasValueConstraint.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(LeadRolePathCalculatesCalculatedPathValue.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(FactTypeHasDerivationRule.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(SubtypeHasDerivationRule.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(ConstraintRoleSequenceHasJoinPath.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); classInfo = directory.FindDomainRelationship(SetComparisonConstraintHasRoleSequence.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); //ModalityChanged propertyInfo = directory.FindDomainProperty(SetConstraint.ModalityDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardGlyphChangeHandler, action); propertyInfo = directory.FindDomainProperty(SetComparisonConstraint.ModalityDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardGlyphChangeHandler, action); //RingType changed propertyInfo = directory.FindDomainProperty(RingConstraint.RingTypeDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardGlyphChangeHandler, action); //Preferred Identifier Changed propertyInfo = directory.FindDomainProperty(UniquenessConstraint.IsPreferredDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardGlyphChangeHandler, action); classInfo = directory.FindDomainClass(EntityTypeHasPreferredIdentifier.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, standardErrorPathDeletedHandler, action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<RolePlayerChangedEventArgs>(PreferredIdentifierRolePlayerChangedEvent), action); //ExclusiveOr added deleted classInfo = directory.FindDomainClass(ExclusiveOrConstraintCoupler.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ExclusiveOrAddedEvent), action); classInfo = directory.FindDomainClass(ExclusiveOrConstraintCoupler.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ExclusiveOrDeletedEvent), action); propertyInfo = directory.FindDomainProperty(ExclusionConstraint.NameDomainPropertyId); classInfo = directory.FindDomainClass(ExclusionConstraint.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(ExclusiveOrNameChangedEvent), action); //SubType propertyInfo = directory.FindDomainProperty(SubtypeFact.ProvidesPreferredIdentifierDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardGlyphChangeHandler, action); //Grouping classInfo = directory.FindDomainClass(ElementGrouping.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(GroupingAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, standardDeleteHandler, action); propertyInfo = directory.FindDomainProperty(ElementGrouping.NameDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, standardNameChangedHandler, action); classInfo = directory.FindDomainRelationship(GroupingElementRelationship.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(GroupingElementAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(GroupingElementDeletedEvent), action); classInfo = directory.FindDomainRelationship(ElementGroupingContainsElementGrouping.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(NestedGroupingAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(NestedGroupingDeletedEvent), action); classInfo = directory.FindDomainRelationship(ElementGroupingIsOfElementGroupingType.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(GroupingTypeAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(GroupingTypeDeletedEvent), action); classInfo = directory.FindDomainRelationship(GroupingMembershipContradictionErrorIsForElement.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(GroupingContradictionErrorAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(GroupingContradictionErrorDeletedEvent), action); } }
void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { this.ManageModelingEventHandlers(eventManager, reasons, action); }
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 new void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { base.ManageModelingEventHandlers(eventManager, reasons, action); if ((EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents) == (reasons & (EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents))) { eventManager.AddOrRemoveHandler(new EventHandler <ElementEventsEndedEventArgs>(OnElementEventsEnded), action); } }
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(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(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(ValueConstraint), CustomPropertyProviders.ValueConstraint, true, action); if (verbalizerService != null) { verbalizerService.AddOrRemoveExtensionVerbalizer(typeof(ORMModel), DefaultVerbalizationProviders.Model, true, 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(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(ValueConstraint), DefaultVerbalizationProviders.ValueConstraint, true, 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); } } }
/// <summary> /// Implements <see cref="IModelingEventSubscriber.ManageModelingEventHandlers"/>. /// </summary> protected new void ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { base.ManageModelingEventHandlers(eventManager, reasons, action); if ((EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents) == (reasons & (EventSubscriberReasons.DocumentLoaded | EventSubscriberReasons.UserInterfaceEvents))) { eventManager.AddOrRemoveHandler(new EventHandler<ElementEventsEndedEventArgs>(OnElementEventsEnded), 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)) { 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); } } }
void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (action == EventHandlerAction.Add && 0 != (reasons & EventSubscriberReasons.DocumentLoading)) { // Hack implementation to turn on the FixupDiagram rules before the model loads. // Normally this would be done with a coordinated fixup listener. However, we // have no control over the DSL-generated FixupDiagram rule without jumping through // a lot of hoops, so we do it here, which fires after the rules are created and // before the model loads. Store.RuleManager.EnableRule(typeof(FixUpDiagram)); } if (0 != (reasons & EventSubscriberReasons.DocumentLoaded)) { Store store = Store; BarkerEntityShape.ManageEventHandlers(store, eventManager, action); BarkerERDiagram.ManageEventHandlers(store, eventManager, action); } }
void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { ManageModelingEventHandlers(eventManager, reasons, action); }
void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action) { if (0 != (reasons & EventSubscriberReasons.SurveyQuestionEvents)) { Store store = Store; DomainDataDirectory dataDirectory = store.DomainDataDirectory; DomainClassInfo classInfo = dataDirectory.FindDomainClass(Diagram.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(DiagramAddedEvent), action); eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(DiagramRemovedEvent), action); DomainPropertyInfo propertyInfo = dataDirectory.FindDomainProperty(Diagram.NameDomainPropertyId); eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(DiagramRenamedEvent), action); } }