Пример #1
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> so that the <see cref="ORMNotesToolWindow"/>
        /// 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)
            {
                return;                 // Bail out
            }
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;

            // Track Note additions and deletions changes
            NoteRoleAndHandler[] owningRelationshipHandlers;
            if (null != (owningRelationshipHandlers = GetOwningRelationshipHandlers(store, action == EventHandlerAction.Add)))
            {
                for (int i = 0; i < owningRelationshipHandlers.Length; ++i)
                {
                    NoteRoleAndHandler handlerInfo          = owningRelationshipHandlers[i];
                    EventHandler <ElementEventArgs> handler = handlerInfo.AddDeleteHandler;
                    DomainClassInfo classInfo = handlerInfo.DomainRole.DomainRelationship;
                    eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(handler), action);
                    eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(handler), action);
                }

                // Track Note.Text changes
                eventManager.AddOrRemoveHandler(dataDirectory.FindDomainProperty(GetNoteTextPropertyId(store)), new EventHandler <ElementPropertyChangedEventArgs>(NoteAlteredEventHandler), 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);
        }
Пример #3
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);
        }
Пример #4
0
 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);
     }
 }
Пример #5
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);
     }
 }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
     }
 }
Пример #9
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);
        }
Пример #10
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
        }
Пример #11
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);
                    }
Пример #12
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);
        }
Пример #13
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);
                }
            }
        }
Пример #14
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);
		}
Пример #15
0
		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);
		}
Пример #16
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);
 }
Пример #17
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);
		}
Пример #18
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);
		}
Пример #19
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);
		}
Пример #20
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);
			}
		}
Пример #21
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);
		}
Пример #22
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);
				}
			}
		}
Пример #23
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);
			}
		}
Пример #24
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);
			}
		}
Пример #25
0
		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);
		}