/// <summary>
        /// ChangeRule: typeof(RelationalDiagram)
        /// Disallows changing the name of the Relational Diagram
        /// Changes the name of the <see cref="T:RelationalDiagram"/> to
        /// its default name if changed by a user.
        /// </summary>
        private static void NameChangedRule(ElementPropertyChangedEventArgs e)
        {
            Guid attributeId = e.DomainProperty.Id;

            if (attributeId == Diagram.NameDomainPropertyId)
            {
                RelationalDiagram diagram = e.ModelElement as RelationalDiagram;
                string            name    = ORMSolutions.ORMArchitect.Framework.Design.ResourceAccessor <RelationalDiagram> .ResourceManager.GetString(NameResourceName);

                if (diagram != null && diagram.Name != name)
                {
                    diagram.Name = name;
                }
            }
            else if (attributeId == RelationalDiagram.DisplayDataTypesDomainPropertyId)
            {
                foreach (PresentationElement pel in ((RelationalDiagram)e.ModelElement).NestedChildShapes)
                {
                    TableShape shape;
                    ColumnElementListCompartment compartment;
                    if (null != (shape = pel as TableShape) &&
                        null != (compartment = shape.FindCompartment("ColumnsCompartment") as ColumnElementListCompartment))
                    {
                        compartment.InvalidateOrUpdateSize();
                    }
                }
            }
        }
Exemple #2
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);
     }
 }
Exemple #3
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.ReferenceConstraintAddedRule");
     RelationalDiagram.ReferenceConstraintAddedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.ReferenceConstraintAddedRule");
 }
Exemple #4
0
 public override void ElementPropertyChanged(Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.DisplayTablePropertyChangedRule");
     RelationalDiagram.DisplayTablePropertyChangedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.DisplayTablePropertyChangedRule");
 }
Exemple #5
0
 public override void RolePlayerChanged(Microsoft.VisualStudio.Modeling.RolePlayerChangedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ElementLink.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.DataTypeChangedRule");
     RelationalDiagram.DataTypeChangedRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ElementLink.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.DataTypeChangedRule");
 }
Exemple #6
0
 public override void ElementDeleting(Microsoft.VisualStudio.Modeling.ElementDeletingEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.ConceptTypeDetachingFromObjectTypeRule");
     RelationalDiagram.ConceptTypeDetachingFromObjectTypeRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.Views.RelationalView.RelationalDiagram.ConceptTypeDetachingFromObjectTypeRule");
 }