|
From: <mcu...@us...> - 2009-12-04 20:19:17
|
Revision: 1421
http://orm.svn.sourceforge.net/orm/?rev=1421&view=rev
Author: mcurland
Date: 2009-12-04 20:19:09 +0000 (Fri, 04 Dec 2009)
Log Message:
-----------
* Added custom property support to ORMModel element, opened up ORMModel verbalization to verbalization extension elements off the model. refs #289
* Domain model for custom properties fails on standalone load, don't assume ExtensionVerbalizerService is available. Addition to [1420]. refs #401
Modified Paths:
--------------
trunk/CustomProperties/CustomProperties.dsl
trunk/CustomProperties/CustomProperties.xsd
trunk/CustomProperties/CustomPropertiesManager.cs
trunk/CustomProperties/CustomPropertyProviders.cs
trunk/CustomProperties/DefinitionEditor.cs
trunk/CustomProperties/GeneratedCode/DomainModel.cs
trunk/CustomProperties/GeneratedCode/DomainModelResx.resx
trunk/ORMModel/ObjectModel/ORMModel.cs
Modified: trunk/CustomProperties/CustomProperties.dsl
===================================================================
--- trunk/CustomProperties/CustomProperties.dsl 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/CustomProperties.dsl 2009-12-04 20:19:09 UTC (rev 1421)
@@ -183,7 +183,9 @@
<EnumerationLiteral Name="ExclusionConstraint" Value="1024"/>
<EnumerationLiteral Name="SubsetConstraint" Value="2048"/>
<EnumerationLiteral Name="ValueConstraint" Value="4096"/>
- <EnumerationLiteral Name="AllConstraints" Value="7904"/>
+ <EnumerationLiteral Name="AllConstraints" Value="8160"/>
+
+ <EnumerationLiteral Name="Model" Value="8192"/>
</Literals>
<Attributes>
<ClrAttribute Name="global::System.ComponentModel.TypeConverter">
Modified: trunk/CustomProperties/CustomProperties.xsd
===================================================================
--- trunk/CustomProperties/CustomProperties.xsd 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/CustomProperties.xsd 2009-12-04 20:19:09 UTC (rev 1421)
@@ -190,6 +190,7 @@
<xs:documentation>An enumeration of ORM model types that supports custom properties</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
+ <xs:enumeration value="Model"/>
<xs:enumeration value="EntityType"/>
<xs:enumeration value="ValueType"/>
<xs:enumeration value="FactType"/>
Modified: trunk/CustomProperties/CustomPropertiesManager.cs
===================================================================
--- trunk/CustomProperties/CustomPropertiesManager.cs 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/CustomPropertiesManager.cs 2009-12-04 20:19:09 UTC (rev 1421)
@@ -417,6 +417,7 @@
//Probably a better way to do this but since the newDef.ORMTypes property is a bit field
//we need to find out each enumeration that has been specified for the object and add it to the xml.
AddORMTypeToGroupIfNeeded(newDef.ORMTypes, ORMTypes.AllConstraints, newOrmTypes);
+ AddORMTypeToGroupIfNeeded(newDef.ORMTypes, ORMTypes.Model, newOrmTypes);
AddORMTypeToGroupIfNeeded(newDef.ORMTypes, ORMTypes.EntityType, newOrmTypes);
AddORMTypeToGroupIfNeeded(newDef.ORMTypes, ORMTypes.EqualityConstraint, newOrmTypes);
AddORMTypeToGroupIfNeeded(newDef.ORMTypes, ORMTypes.ExclusionConstraint, newOrmTypes);
Modified: trunk/CustomProperties/CustomPropertyProviders.cs
===================================================================
--- trunk/CustomProperties/CustomPropertyProviders.cs 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/CustomPropertyProviders.cs 2009-12-04 20:19:09 UTC (rev 1421)
@@ -48,6 +48,10 @@
}
}
+ public static readonly PropertyProvider Model = delegate(object extendableElement, PropertyDescriptorCollection properties)
+ {
+ GetProvidedProperties(ORMTypes.Model, extendableElement, properties);
+ };
public static readonly PropertyProvider ObjectType = delegate(object extendableElement, PropertyDescriptorCollection properties)
{
GetProvidedProperties(((ObjectType)extendableElement).IsValueType ? ORMTypes.ValueType : ORMTypes.EntityType, extendableElement, properties);
@@ -236,6 +240,10 @@
}
#endregion // DefaultCustomPropertyVerbalizer class
#region Specific verbalizers for each element type
+ public static readonly IVerbalizeExtensionChildren Model = new DefaultCustomPropertyVerbalizer(delegate(IORMExtendableElement propertyOwner, CustomPropertyDefinition propertyDefinition)
+ {
+ return 0 != (propertyDefinition.ORMTypes & ORMTypes.Model);
+ });
public static readonly IVerbalizeExtensionChildren ObjectType = new DefaultCustomPropertyVerbalizer(delegate(IORMExtendableElement propertyOwner, CustomPropertyDefinition propertyDefinition)
{
return 0 != (propertyDefinition.ORMTypes & (((ObjectType)propertyOwner).IsValueType ? ORMTypes.ValueType : ORMTypes.EntityType));
@@ -296,6 +304,7 @@
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);
@@ -308,18 +317,22 @@
propertyService.AddOrRemovePropertyProvider(typeof(ExclusionConstraint), CustomPropertyProviders.ExclusionConstraint, true, action);
propertyService.AddOrRemovePropertyProvider(typeof(SubsetConstraint), CustomPropertyProviders.SubsetConstraint, true, action);
propertyService.AddOrRemovePropertyProvider(typeof(ValueConstraint), CustomPropertyProviders.ValueConstraint, 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);
+ 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);
+ }
}
}
#endregion // IModelingEventSubscriber Implementation
Modified: trunk/CustomProperties/DefinitionEditor.cs
===================================================================
--- trunk/CustomProperties/DefinitionEditor.cs 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/DefinitionEditor.cs 2009-12-04 20:19:09 UTC (rev 1421)
@@ -297,6 +297,7 @@
chkVerbalizeDefaultValue.Checked = _definitionObject.VerbalizeDefaultValue;
chkVerbalizeDefaultValue.Enabled = defaultText.Length != 0;
ClearCheckedItems(tvModelElements.Nodes);
+ CheckTypeIfNeeded(ORMTypes.Model);
CheckTypeIfNeeded(ORMTypes.EntityType);
CheckTypeIfNeeded(ORMTypes.FactType);
CheckTypeIfNeeded(ORMTypes.Role);
@@ -319,6 +320,7 @@
{
tvModelElements.Nodes.Clear();
+ tvModelElements.Nodes.Add(CreateTreeNode("ORM Model", "Model"));
tvModelElements.Nodes.Add(CreateTreeNode("Entity Type", "EntityType"));
tvModelElements.Nodes.Add(CreateTreeNode("Value Type", "ValueType"));
tvModelElements.Nodes.Add(CreateTreeNode("Fact Type", "FactType"));
Modified: trunk/CustomProperties/GeneratedCode/DomainModel.cs
===================================================================
--- trunk/CustomProperties/GeneratedCode/DomainModel.cs 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/GeneratedCode/DomainModel.cs 2009-12-04 20:19:09 UTC (rev 1421)
@@ -538,7 +538,13 @@
/// ORMSolutions.ORMArchitect.CustomProperties.ORMTypes.AllConstraints
/// </summary>
[DslDesign::DescriptionResource("ORMSolutions.ORMArchitect.CustomProperties.ORMTypes/AllConstraints.Description", typeof(global::ORMSolutions.ORMArchitect.CustomProperties.CustomPropertiesDomainModel), "ORMSolutions.ORMArchitect.CustomProperties.GeneratedCode.DomainModelResx")]
- AllConstraints = 7904,
+ AllConstraints = 8160,
+ /// <summary>
+ /// Model
+ /// Description for ORMSolutions.ORMArchitect.CustomProperties.ORMTypes.Model
+ /// </summary>
+ [DslDesign::DescriptionResource("ORMSolutions.ORMArchitect.CustomProperties.ORMTypes/Model.Description", typeof(global::ORMSolutions.ORMArchitect.CustomProperties.CustomPropertiesDomainModel), "ORMSolutions.ORMArchitect.CustomProperties.GeneratedCode.DomainModelResx")]
+ Model = 8192,
}
}
namespace ORMSolutions.ORMArchitect.CustomProperties
Modified: trunk/CustomProperties/GeneratedCode/DomainModelResx.resx
===================================================================
--- trunk/CustomProperties/GeneratedCode/DomainModelResx.resx 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/CustomProperties/GeneratedCode/DomainModelResx.resx 2009-12-04 20:19:09 UTC (rev 1421)
@@ -429,6 +429,14 @@
<value>Description for ORMSolutions.ORMArchitect.CustomProperties.ORMTypes.AllConstraints</value>
<comment>Description for EnumerationLiteral 'AllConstraints' on DomainEnumeration 'ORMTypes'</comment>
</data>
+ <data name="ORMSolutions.ORMArchitect.CustomProperties.ORMTypes/Model.DisplayName" xml:space="preserve">
+ <value>Model</value>
+ <comment>Display name for EnumerationLiteral 'Model' on DomainEnumeration 'ORMTypes'</comment>
+ </data>
+ <data name="ORMSolutions.ORMArchitect.CustomProperties.ORMTypes/Model.Description" xml:space="preserve">
+ <value>Description for ORMSolutions.ORMArchitect.CustomProperties.ORMTypes.Model</value>
+ <comment>Description for EnumerationLiteral 'Model' on DomainEnumeration 'ORMTypes'</comment>
+ </data>
<data name="ORMSolutions.ORMArchitect.CustomProperties.CustomPropertyDataType/String.DisplayName" xml:space="preserve">
<value>String</value>
<comment>Display name for EnumerationLiteral 'String' on DomainEnumeration 'CustomPropertyDataType'</comment>
Modified: trunk/ORMModel/ObjectModel/ORMModel.cs
===================================================================
--- trunk/ORMModel/ObjectModel/ORMModel.cs 2009-12-04 07:05:01 UTC (rev 1420)
+++ trunk/ORMModel/ObjectModel/ORMModel.cs 2009-12-04 20:19:09 UTC (rev 1421)
@@ -238,7 +238,7 @@
#region IVerbalizeCustomChildren Implementation
/// <summary>
/// Implements <see cref="IVerbalizeCustomChildren.GetCustomChildVerbalizations"/>.
- /// Explicitly verbalizes the definitions and notes fields
+ /// Explicitly verbalizes the definitions, notes, and extension elements
/// </summary>
protected IEnumerable<CustomChildVerbalizer> GetCustomChildVerbalizations(IVerbalizeFilterChildren filter, VerbalizationSign sign)
{
@@ -254,6 +254,14 @@
{
yield return CustomChildVerbalizer.VerbalizeInstance(note);
}
+ foreach (ModelElement extensionElement in ExtensionCollection)
+ {
+ IVerbalize verbalizeExtension = extensionElement as IVerbalize;
+ if (verbalizeExtension != null)
+ {
+ yield return CustomChildVerbalizer.VerbalizeInstance(verbalizeExtension);
+ }
+ }
}
IEnumerable<CustomChildVerbalizer> IVerbalizeCustomChildren.GetCustomChildVerbalizations(IVerbalizeFilterChildren filter, VerbalizationSign sign)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|