/// <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
     }
     ModelingEventManager.GetModelingEventManager(store).AddOrRemoveHandler(store.DomainDataDirectory.FindDomainClass(ReferenceModeKind.DomainClassId), new EventHandler <ElementPropertyChangedEventArgs>(ReferenceModeKindChangeEvent), action);
 }
 /// <summary>
 /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> during connect action activation and deactivation.
 /// The default implementation watches for new <see cref="UniquenessConstraint"/>s added to the <see cref="ORMModel"/>.
 /// </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>
 protected virtual void ManageStoreEvents(Store store, EventHandlerAction action)
 {
     if (store == null || store.Disposed)
     {
         return;                 // bail out
     }
     ModelingEventManager.GetModelingEventManager(store).AddOrRemoveHandler(store.DomainDataDirectory.FindDomainClass(UniquenessConstraint.DomainClassId), new EventHandler <ElementAddedEventArgs>(InternalConstraintAddedEvent), action);
 }
예제 #3
0
		/// <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);
		}
예제 #4
0
		/// <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);
			}
		}
예제 #5
0
                    /// <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);
                    }
예제 #6
0
        /// <summary>
        /// Add or remove an event handler. Use in place of the Add and Remove methods available through
        /// <see cref="EventManagerDirectory.ElementEventsEnded"/>. Set the addHandler parameter to true for an Add
        /// and false for a remove.
        /// </summary>
        public void AddOrRemoveHandler(EventHandler <ElementEventsEndedEventArgs> handler, EventHandlerAction action)
        {
            bool     addHandler      = action == EventHandlerAction.Add;
            Delegate wrapperDelegate = AddOrRemove <ElementEventsEndedEventArgs>(handler, addHandler);

            if (wrapperDelegate != null)
            {
                if (addHandler)
                {
                    myRegisteredEndedEvents = (EventHandler <ElementEventsEndedEventArgs>)wrapperDelegate;
                }
                else
                {
                    myRegisteredEndedEvents = null;
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Required override. Attach handlers for tracking the current diagram.
        /// </summary>
        protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            store = Utility.ValidateStore(store);
            if (store == null)
            {
                return;
            }
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainClassInfo     classInfo     = dataDirectory.FindDomainClass(typeof(Diagram));

            eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(DiagramAddedEvent), action);
            eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(DiagramRemovedEvent), action);
            eventManager.AddOrRemoveHandler(dataDirectory.FindDomainProperty(Diagram.NameDomainPropertyId), new EventHandler <ElementPropertyChangedEventArgs>(DiagramNameChangedEvent), action);
            eventManager.AddOrRemoveHandler(new EventHandler <ElementEventsEndedEventArgs>(ElementEventsEnded), action);
            myStore             = (action == EventHandlerAction.Add) ? store : null;
            myDiagramSetChanged = true;
            AdjustVisibility(false, false);
        }
예제 #8
0
파일: ORMDocView.cs 프로젝트: cjheath/NORMA
		/// <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);
			}
		}
예제 #9
0
		void IPropertyProviderService.AddOrRemovePropertyProvider(Type extendableElementType, IPropertyProvider provider, bool includeSubtypes, EventHandlerAction action)
		{
			if ((object)provider == null)
			{
				throw new ArgumentNullException("provider");
			}
			AddOrRemovePropertyProvider(extendableElementType, new ProviderInstance(provider), includeSubtypes, action);
		}
예제 #10
0
 /// <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);
     }
 }
예제 #11
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="ORMBaseShape"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainClassInfo     classInfo     = dataDirectory.FindDomainClass(ORMBaseShape.DomainClassId);
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateRequiredEvent), action);
            eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(ShapeAddedEvent), action);
            classInfo = dataDirectory.FindDomainClass(PresentationViewsSubject.DomainClassId);
            eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(ShapeDeletedEvent), action);
        }
예제 #12
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="BarkerEntityShape"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(BarkerEntityShape.UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateShapeEvent), action);

            if (action == EventHandlerAction.Add)
            {
                // We don't want this rule on. This forces a full repopulation of the compartment,
                // which makes it impossible to determine the old index of a selected item. If this is
                // on, then the ColumnRenamedEvent does not work for the initial transaction.
                store.RuleManager.DisableRule(typeof(CompartmentItemChangeRule));
            }
            propertyInfo = dataDirectory.FindDomainProperty(Barker.Attribute.NameDomainPropertyId);
            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(AttributeRenamedEvent), action);
        }
예제 #13
0
		/// <summary>
		/// Wires event handlers to the store.
		/// </summary>
		protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			SamplePopulationEditor editor = myEditor;
			if (editor != null)
			{
				editor.ManageEventHandlers(store, eventManager, action);
			}
		}
예제 #14
0
		/// <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);
				}
			}
		}
		/// <summary>
		/// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> during connect action activation and deactivation.
		/// The default implementation watches for new <see cref="UniquenessConstraint"/>s added to the <see cref="ORMModel"/>.
		/// </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>
		protected virtual void ManageStoreEvents(Store store, EventHandlerAction action)
		{
			if (store == null || store.Disposed)
			{
				return; // bail out
			}
			ModelingEventManager.GetModelingEventManager(store).AddOrRemoveHandler(store.DomainDataDirectory.FindDomainClass(UniquenessConstraint.DomainClassId), new EventHandler<ElementAddedEventArgs>(InternalConstraintAddedEvent), action);
		}
예제 #16
0
        /// <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);
                }
            }
        }
예제 #17
0
파일: ORMDocData.cs 프로젝트: cjheath/NORMA
		private void ManageErrorReportingEvents(ModelingEventManager eventManager, EventHandlerAction action)
		{
			Store store = Store;
			DomainDataDirectory dataDirectory = store.DomainDataDirectory;
			DomainClassInfo classInfo = dataDirectory.FindDomainRelationship(ModelHasError.DomainClassId);

			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ErrorAddedEvent), action);

			classInfo = dataDirectory.FindDomainClass(ModelError.DomainClassId);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ErrorRemovedEvent), action);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementPropertyChangedEventArgs>(ErrorChangedEvent), action);

			classInfo = dataDirectory.FindDomainRelationship(ModelHasModelErrorDisplayFilter.DomainClassId);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ErrorDisplayChangedEvent), action);

			classInfo = dataDirectory.FindDomainClass(ModelErrorDisplayFilter.DomainClassId);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ErrorDisplayChangedEvent), action);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementPropertyChangedEventArgs>(ErrorDisplayChangedEvent), action);

			DomainPropertyInfo propertyInfo = dataDirectory.FindDomainProperty(ModelErrorDisplayFilter.ExcludedCategoriesDomainPropertyId);
			eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(ErrorDisplayChangedEvent), action);
			propertyInfo = dataDirectory.FindDomainProperty(ModelErrorDisplayFilter.ExcludedErrorsDomainPropertyId);
			eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(ErrorDisplayChangedEvent), action);
			propertyInfo = dataDirectory.FindDomainProperty(ModelErrorDisplayFilter.IncludedErrorsDomainPropertyId);
			eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(ErrorDisplayChangedEvent), action);
			eventManager.AddOrRemoveHandler(new EventHandler<ElementEventsEndedEventArgs>(ErrorEventsEnded), action);
		}
예제 #18
0
파일: ORMDocData.cs 프로젝트: cjheath/NORMA
		private void ManageTabRestoreEvents(ModelingEventManager eventManager, EventHandlerAction action)
		{
			// Add event handlers to cater for undo/redo and initial
			// add when multiple windows are open
			Store store = Store;
			DomainDataDirectory dataDirectory = store.DomainDataDirectory;
			DomainClassInfo classInfo = dataDirectory.FindDomainClass(Diagram.DomainClassId);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(AddOrRemoveTabForEvent), action);
		}
예제 #19
0
        /// <summary>
        /// Add or remove an event handler. Use in place of the Add and Remove methods available through
        /// <see cref="EventManagerDirectory.RolePlayerOrderChanged"/>. Set the addHandler parameter to true for an Add
        /// and false for a remove.
        /// </summary>
        public void AddOrRemoveHandler(DomainModelInfo domainModel, EventHandler <RolePlayerOrderChangedEventArgs> handler, EventHandlerAction action)
        {
            bool     addHandler      = action == EventHandlerAction.Add;
            Delegate wrapperDelegate = AddOrRemove <RolePlayerOrderChangedEventArgs>(domainModel, handler, addHandler);

            if (wrapperDelegate != null)
            {
                if (addHandler)
                {
                    myStore.EventManagerDirectory.RolePlayerOrderChanged.Add(domainModel, wrapperDelegate);
                }
                else
                {
                    myStore.EventManagerDirectory.RolePlayerOrderChanged.Remove(domainModel, wrapperDelegate);
                }
            }
        }
예제 #20
0
		/// <summary>
		/// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="ORMBaseShape"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			DomainDataDirectory dataDirectory = store.DomainDataDirectory;
			DomainPropertyInfo propertyInfo = dataDirectory.FindDomainProperty(ORMBaseBinaryLinkShape.UpdateCounterDomainPropertyId);
			eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(UpdateRequiredEvent), action);
		}
예제 #21
0
					/// <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);
					}
예제 #22
0
        /// <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);
        }
예제 #23
0
		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);
				}
			}
		}
예제 #24
0
 /// <summary>
 /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="SubtypeLink"/>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)
 {
     eventManager.AddOrRemoveHandler(store.DomainDataDirectory.FindDomainProperty(SubtypeFact.ProvidesPreferredIdentifierDomainPropertyId), new EventHandler <ElementPropertyChangedEventArgs>(ProvidesPreferredIdentifierChangedEvent), action);
 }
예제 #25
0
        /// <summary>
        /// Manages event handlers in the store so that the tool window
        /// contents can be updated to reflect any model changes.
        /// </summary>
        protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            ReadingsViewForm form          = myForm;
            ReadingEditor    readingEditor = (form != null) ? form.ReadingEditor : null;

            if (readingEditor != null)
            {
                readingEditor.ManageEventHandlers(store, eventManager, action);
            }
        }
예제 #26
0
			/// <summary>
			/// Add or remove change listeners as needed
			/// </summary>
			public void AddOrRemoveChangeListener(ExtensionPropertyChangedEventHandler handler, EventHandlerAction action)
			{
				IPropertyProvider interfaceInstance;
				if (null != (interfaceInstance = myInstance) &&
					0 != (interfaceInstance.ProviderFeatures & PropertyProviderFeatures.ChangeNotifications))
				{
					if (action == EventHandlerAction.Add)
					{
						interfaceInstance.PropertyChanged += handler;
					}
					else
					{
						interfaceInstance.PropertyChanged -= handler;
					}
				}
			}
예제 #27
0
		/// <summary>
		/// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> so that the <see cref="ORMVerbalizationToolWindow"/>
		/// contents can be updated to reflect any model changes.
		/// </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>
		protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			if (Utility.ValidateStore(store) != null)
			{
				eventManager.AddOrRemoveHandler(new EventHandler<ElementEventsEndedEventArgs>(ModelStateChangedEvent), action);
			}
		}
예제 #28
0
		/// <summary>
		/// Manages event handlers in the store so that the tool window
		/// contents can be updated to reflect any model changes.
		/// </summary>
		protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			ReadingsViewForm form = myForm;
			ReadingEditor readingEditor = (form != null) ? form.ReadingEditor : null;

			if (readingEditor != null)
			{
				readingEditor.ManageEventHandlers(store, eventManager, action);
			}
		}
예제 #29
0
		/// <summary>
		/// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="RolePlayerLink"/>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.FindDomainProperty(MandatoryConstraint.ModalityDomainPropertyId), new EventHandler<ElementPropertyChangedEventArgs>(InternalConstraintModalityChangedEvent), action);
			eventManager.AddOrRemoveHandler(dataDirectory.FindDomainRelationship(FactSetConstraint.DomainClassId), new EventHandler<ElementAddedEventArgs>(InternalConstraintRoleSequenceAddedEvent), action);
			eventManager.AddOrRemoveHandler(dataDirectory.FindDomainRelationship(ConstraintRoleSequenceHasRole.DomainClassId), new EventHandler<ElementDeletedEventArgs>(InternalConstraintRoleSequenceRoleRemovedEvent), action);
		}
예제 #30
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="TableShape"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(TableShape.UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateShapeEvent), action);

            if (action == EventHandlerAction.Add)
            {
                // We don't want this rule on. This forces a full repopulation of the compartment,
                // which makes it impossible to determine the old index of a selected item. If this is
                // on, then the ColumnRenamedEvent does not work for the initial transaction.
                store.RuleManager.DisableRule(typeof(CompartmentItemChangeRule));
            }
#if CUSTOMSORT
            propertyInfo = dataDirectory.FindDomainProperty(Column.NameDomainPropertyId);
            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(ColumnRenamedEvent), action);
#else // CUSTOMSORT
            eventManager.AddOrRemoveHandler(dataDirectory.FindDomainRole(TableContainsColumn.ColumnDomainRoleId), new EventHandler <RolePlayerOrderChangedEventArgs>(ColumnOrderChanged), action);
#endif // CUSTOMSORT
        }
예제 #31
0
		/// <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);
		}
예제 #32
0
					/// <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
						}
						ModelingEventManager.GetModelingEventManager(store).AddOrRemoveHandler(store.DomainDataDirectory.FindDomainClass(ReferenceModeKind.DomainClassId), new EventHandler<ElementPropertyChangedEventArgs>(ReferenceModeKindChangeEvent), action);
					}
예제 #33
0
 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);
     }
 }
예제 #34
0
		/// <summary>
		/// Required override. Attach handlers for tracking the current diagram.
		/// </summary>
		protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			store = Utility.ValidateStore(store);
			if (store == null)
			{
				return;
			}
			DomainDataDirectory dataDirectory = store.DomainDataDirectory;
			DomainClassInfo classInfo = dataDirectory.FindDomainClass(typeof(Diagram));
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(DiagramAddedEvent), action);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(DiagramRemovedEvent), action);
			eventManager.AddOrRemoveHandler(dataDirectory.FindDomainProperty(Diagram.NameDomainPropertyId), new EventHandler<ElementPropertyChangedEventArgs>(DiagramNameChangedEvent), action);
			eventManager.AddOrRemoveHandler(new EventHandler<ElementEventsEndedEventArgs>(ElementEventsEnded), action);
			myStore = (action == EventHandlerAction.Add) ? store : null;
			myDiagramSetChanged = true;
			AdjustVisibility(false, false);
		}
예제 #35
0
        /// <summary>
        /// Wires event handlers to the store.
        /// </summary>
        protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            SamplePopulationEditor editor = myEditor;

            if (editor != null)
            {
                editor.ManageEventHandlers(store, eventManager, action);
            }
        }
예제 #36
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="ORMBaseShape"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(ORMBaseBinaryLinkShape.UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateRequiredEvent), action);
        }
예제 #37
0
 /// <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);
     }
 }
예제 #38
0
        /// <summary>
        /// Add or remove an event handler. Use in place of the Add and Remove methods available through
        /// <see cref="EventManagerDirectory.ElementPropertyChanged"/>. Set the addHandler parameter to true for an Add
        /// and false for a remove.
        /// </summary>
        public void AddOrRemoveHandler(DomainPropertyInfo domainProperty, EventHandler <ElementPropertyChangedEventArgs> handler, EventHandlerAction action)
        {
            bool     addHandler      = action == EventHandlerAction.Add;
            Delegate wrapperDelegate = AddOrRemove <ElementPropertyChangedEventArgs>(domainProperty, handler, addHandler);

            if (wrapperDelegate != null)
            {
                if (addHandler)
                {
                    myStore.EventManagerDirectory.ElementPropertyChanged.Add(domainProperty, wrapperDelegate);
                }
                else
                {
                    myStore.EventManagerDirectory.ElementPropertyChanged.Remove(domainProperty, wrapperDelegate);
                }
            }
        }
예제 #39
0
		/// <summary>
		/// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="ORMBaseShape"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			DomainDataDirectory dataDirectory = store.DomainDataDirectory;
			DomainClassInfo classInfo = dataDirectory.FindDomainClass(ORMBaseShape.DomainClassId);
			DomainPropertyInfo propertyInfo = dataDirectory.FindDomainProperty(UpdateCounterDomainPropertyId);
			eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler<ElementPropertyChangedEventArgs>(UpdateRequiredEvent), action);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementAddedEventArgs>(ShapeAddedEvent), action);
			classInfo = dataDirectory.FindDomainClass(PresentationViewsSubject.DomainClassId);
			eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ShapeDeletedEvent), action);
		}
예제 #40
0
        /// <summary>
        /// Add or remove an event handler. Use in place of the Add and Remove methods available through
        /// <see cref="EventManagerDirectory.TransactionRolledBack"/>. Set the addHandler parameter to true for an Add
        /// and false for a remove.
        /// </summary>
        public void AddOrRemoveHandler(EventHandler <TransactionRollbackEventArgs> handler, EventHandlerAction action)
        {
            bool     addHandler      = action == EventHandlerAction.Add;
            Delegate wrapperDelegate = AddOrRemove <TransactionRollbackEventArgs>(handler, addHandler);

            if (wrapperDelegate != null)
            {
                if (addHandler)
                {
                    myStore.EventManagerDirectory.TransactionRolledBack.Add(wrapperDelegate);
                }
                else
                {
                    myStore.EventManagerDirectory.TransactionRolledBack.Remove(wrapperDelegate);
                }
            }
        }
예제 #41
0
            /// <summary>
            /// Add or remove change listeners as needed
            /// </summary>
            public void AddOrRemoveChangeListener(ExtensionPropertyChangedEventHandler handler, EventHandlerAction action)
            {
                IPropertyProvider interfaceInstance;

                if (null != (interfaceInstance = myInstance) &&
                    0 != (interfaceInstance.ProviderFeatures & PropertyProviderFeatures.ChangeNotifications))
                {
                    if (action == EventHandlerAction.Add)
                    {
                        interfaceInstance.PropertyChanged += handler;
                    }
                    else
                    {
                        interfaceInstance.PropertyChanged -= handler;
                    }
                }
            }
예제 #42
0
		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);
			}
		}
예제 #43
0
        private void AddOrRemovePropertyProvider(Type extendableElementType, ProviderInstance providerInstance, bool includeSubtypes, EventHandlerAction action)
        {
            bool register = action == EventHandlerAction.Add;

            if (register)
            {
                this.RegisterPropertyProvider(extendableElementType.TypeHandle, providerInstance);
            }
            else
            {
                this.UnregisterPropertyProvider(extendableElementType.TypeHandle, providerInstance);
            }
            if (includeSubtypes)
            {
                Store           store           = this.myStore;
                DomainClassInfo domainClassInfo = store.DomainDataDirectory.FindDomainClass(extendableElementType);
                if (null != domainClassInfo)
                {
                    foreach (DomainClassInfo subtypeInfo in domainClassInfo.AllDescendants)
                    {
                        if (register)
                        {
                            this.RegisterPropertyProvider(subtypeInfo.ImplementationClass.TypeHandle, providerInstance);
                        }
                        else
                        {
                            this.UnregisterPropertyProvider(subtypeInfo.ImplementationClass.TypeHandle, providerInstance);
                        }
                    }
                }
            }
        }
예제 #44
0
		/// <summary>
		/// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="RelationalDiagram"/>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 void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
		{
			foreach (RelationalDiagram diagram in store.ElementDirectory.FindElements<RelationalDiagram>(false))
			{
				switch (action)
				{
					case EventHandlerAction.Add:
						diagram.SubscribeCompartmentItemsEvents();
						break;
					case EventHandlerAction.Remove:
						diagram.UnsubscribeCompartmentItemsEvents();
						break;
				}
			}
		}
예제 #45
0
 void IPropertyProviderService.AddOrRemovePropertyProvider(Type extendableElementType, IPropertyProvider provider, bool includeSubtypes, EventHandlerAction action)
 {
     if ((object)provider == null)
     {
         throw new ArgumentNullException("provider");
     }
     AddOrRemovePropertyProvider(extendableElementType, new ProviderInstance(provider), includeSubtypes, action);
 }
        /// <summary>
        /// Manage events associated with the schema customization state.
        /// The primary function of schema customization is to reassociate
        /// schema customizations when a schema is deleted and recreated.
        /// Therefore, the data is maintained outside the transacted store
        /// and must be updated with events to remain consistent across
        /// undo and redo operations.
        /// </summary>
        /// <param name="eventManager">The <see cref="ModelingEventManager"/> to attach
        /// to. The assumption is that this is called for state change events on document
        /// loaded.</param>
        /// <param name="store">The <see cref="Store"/> used to retrieve type information.</param>
        /// <param name="action">The action to take (add or remove the handler)</param>
        public static void ManageModelingEventHandlers(ModelingEventManager eventManager, Store store, EventHandlerAction action)
        {
            DomainDataDirectory dataDir = store.DomainDataDirectory;

            eventManager.AddOrRemoveHandler(dataDir.FindDomainClass(Column.DomainClassId), new EventHandler <ElementPropertyChangedEventArgs>(ColumnPropertyChanged), action);
            eventManager.AddOrRemoveHandler(dataDir.FindDomainClass(Table.DomainClassId), new EventHandler <ElementPropertyChangedEventArgs>(TablePropertyChanged), action);
            eventManager.AddOrRemoveHandler(dataDir.FindDomainClass(Schema.DomainClassId), new EventHandler <ElementPropertyChangedEventArgs>(SchemaPropertyChanged), action);
            eventManager.AddOrRemoveHandler(dataDir.FindDomainRole(TableContainsColumn.ColumnDomainRoleId), new EventHandler <RolePlayerOrderChangedEventArgs>(ColumnOrderChanged), action);
        }
예제 #47
0
        void IPropertyProviderService.AddOrRemoveChangeListener(Type extendableElementType, ExtensionPropertyChangedEventHandler handler, EventHandlerAction action)
        {
            if (extendableElementType == null)
            {
                throw new ArgumentNullException("extendableElementType");
            }
            if ((object)handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            LinkedNode <CountedProviderInstance> providerNode;

            if (myProviderDictionary.TryGetValue(extendableElementType.TypeHandle, out providerNode))
            {
                while (providerNode != null)
                {
                    providerNode.Value.Instance.AddOrRemoveChangeListener(handler, action);
                    providerNode = providerNode.Next;
                }
            }
        }
예제 #48
0
        /// <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 });
                }
            }
        }
예제 #49
0
 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);
         }
     }
 }
예제 #50
0
 /// <summary>
 /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> so that the <see cref="ORMVerbalizationToolWindow"/>
 /// contents can be updated to reflect any model changes.
 /// </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>
 protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
 {
     if (Utility.ValidateStore(store) != null)
     {
         eventManager.AddOrRemoveHandler(new EventHandler <ElementEventsEndedEventArgs>(ModelStateChangedEvent), action);
     }
 }
예제 #51
0
		/// <summary>
		/// NOT IMPLEMENTED: There are no event handlers to attach for this class.
		/// </summary>
		protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action) { }
예제 #52
0
 void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action)
 {
     ManageModelingEventHandlers(eventManager, reasons, action);
 }
예제 #53
0
 /// <summary>
 /// Manages event handlers in the store.
 /// </summary>
 protected override void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
 {
 }
예제 #54
0
		private void AddOrRemovePropertyProvider(Type extendableElementType, ProviderInstance providerInstance, bool includeSubtypes, EventHandlerAction action)
		{
			bool register = action == EventHandlerAction.Add;
			if (register)
			{
				this.RegisterPropertyProvider(extendableElementType.TypeHandle, providerInstance);
			}
			else
			{
				this.UnregisterPropertyProvider(extendableElementType.TypeHandle, providerInstance);
			}
			if (includeSubtypes)
			{
				Store store = this.myStore;
				DomainClassInfo domainClassInfo = store.DomainDataDirectory.FindDomainClass(extendableElementType);
				if (null != domainClassInfo)
				{
					foreach (DomainClassInfo subtypeInfo in domainClassInfo.AllDescendants)
					{
						if (register)
						{
							this.RegisterPropertyProvider(subtypeInfo.ImplementationClass.TypeHandle, providerInstance);
						}
						else
						{
							this.UnregisterPropertyProvider(subtypeInfo.ImplementationClass.TypeHandle, providerInstance);
						}
					}
				}
			}
		}
예제 #55
0
		void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action)
		{
			this.ManageModelingEventHandlers(eventManager, reasons, action);
		}
예제 #56
0
		void IPropertyProviderService.AddOrRemoveChangeListener(Type extendableElementType, ExtensionPropertyChangedEventHandler handler, EventHandlerAction action)
		{
			if (extendableElementType == null)
			{
				throw new ArgumentNullException("extendableElementType");
			}
			if ((object)handler == null)
			{
				throw new ArgumentNullException("handler");
			}
			LinkedNode<ProviderInstance> providerNode;
			if (myProviderDictionary.TryGetValue(extendableElementType.TypeHandle, out providerNode))
			{
				while (providerNode != null)
				{
					providerNode.Value.AddOrRemoveChangeListener(handler, action);
					providerNode = providerNode.Next;
				}
			}
		}
예제 #57
0
		/// <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);
			}
		}