|
From: <mcu...@us...> - 2009-09-16 07:46:00
|
Revision: 1410
http://orm.svn.sourceforge.net/orm/?rev=1410&view=rev
Author: mcurland
Date: 2009-09-16 07:45:45 +0000 (Wed, 16 Sep 2009)
Log Message:
-----------
* Modify grouping mechanism to integrate properties from group types directly in the group properties. Also added a category to all group properties and display the currently selected GroupTypes directly in the properties window. refs #387
* Added EditorUtility helpers to modify displayed information for a property without modifying its behavior. Enables properties from a base class (Name is a common example) to be explicitly named and categorized by a derived class.
* Extensions can now be attached to the main properties section of an objectified FactTypeShape by attaching property providers to the Objectification type.
* Relaxed sealed overrides on EnumConverter to enable context-based modification of enum values. The typical use allows a 'default' enum item to display the current default setting.
Modified Paths:
--------------
trunk/ORMModel/Framework/Design/Editors/EditorUtility.cs
trunk/ORMModel/Framework/Design/EnumConverter.cs
trunk/ORMModel/ObjectModel/Design/ElementGroupingTypeDescriptor.cs
trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs
trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx
trunk/ORMModel/ObjectModel/Grouping.cs
trunk/ORMModel/ObjectModel/ORMCore.dsl
trunk/ORMModel/Resources/ResourceStringsGenerator.cs
trunk/ORMModel/Resources/ResourceStringsGenerator.xml
trunk/ORMModel/ShapeModel/Design/FactTypeShapeTypeDescriptor.cs
trunk/ORMModel/Shell/ORMDocDataServices.cs
Modified: trunk/ORMModel/Framework/Design/Editors/EditorUtility.cs
===================================================================
--- trunk/ORMModel/Framework/Design/Editors/EditorUtility.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/Framework/Design/Editors/EditorUtility.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -3,6 +3,7 @@
* Natural Object-Role Modeling Architect for Visual Studio *
* *
* Copyright \xA9 Neumont University. All rights reserved. *
+* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
* *
* The use and distribution terms for this software are covered by the *
* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
@@ -131,6 +132,7 @@
/// </summary>
public static class EditorUtility
{
+ #region ResolveContextInstance
/// <summary>
/// Selection context is often based on a wrapper shape, such
/// as a NodeShape or a tree node in a model browser. Use this
@@ -166,6 +168,8 @@
}
return instance;
}
+ #endregion // ResolveContextInstance
+ #region ActivatePropertyEditor
/// <summary>
/// Helper method to recursively find a control of a given type
/// </summary>
@@ -333,5 +337,182 @@
}
}
}
+ #endregion // ActivatePropertyEditor
+ #region ModifyPropertyDescriptorDisplay
+ /// <summary>
+ /// Modify the display settings for a <see cref="PropertyDescriptor"/> by
+ /// wrapping the base descriptor with another property descriptor instance.
+ /// </summary>
+ /// <param name="basedOnDescriptor">The original descriptor.</param>
+ /// <param name="displayName">The modified display name. If this is <see langword="null"/>, then the original display name is used.</param>
+ /// <param name="description">The modified description. If this is <see langword="null"/>, then the original description is used.</param>
+ /// <param name="category">The modified category. If this is <see langword="null"/>, then the original category is used.</param>
+ /// <returns>A wrapper <see cref="PropertyDescriptor"/></returns>
+ public static PropertyDescriptor ModifyPropertyDescriptorDisplay(PropertyDescriptor basedOnDescriptor, string displayName, string description, string category)
+ {
+ return new DisplayModifiedPropertyDescriptor(basedOnDescriptor, displayName, description, category);
+ }
+ /// <summary>
+ /// Modify the display settings for a <see cref="PropertyDescriptor"/> by
+ /// wrapping the base descriptor with another property descriptor instance.
+ /// </summary>
+ /// <param name="descriptorCollection">A collection of descriptors.</param>
+ /// <param name="propertyName">The non-localized name of the property to modify.</param>
+ /// <param name="displayName">The modified display name. If this is <see langword="null"/>, then the original display name is used.</param>
+ /// <param name="description">The modified description. If this is <see langword="null"/>, then the original description is used.</param>
+ /// <param name="category">The modified category. If this is <see langword="null"/>, then the original category is used.</param>
+ /// <returns>A wrapper <see cref="PropertyDescriptor"/></returns>
+ public static void ModifyPropertyDescriptorDisplay(PropertyDescriptorCollection descriptorCollection, string propertyName, string displayName, string description, string category)
+ {
+ PropertyDescriptor descriptor;
+ if (descriptorCollection != null &&
+ null != (descriptor = descriptorCollection[propertyName]))
+ {
+ descriptorCollection.Remove(descriptor);
+ descriptorCollection.Add(ModifyPropertyDescriptorDisplay(descriptor, displayName, description, category));
+ }
+ }
+ /// <summary>
+ /// Wrapper <see cref="PropertyDescriptor"/> class to support display modification
+ /// </summary>
+ private sealed class DisplayModifiedPropertyDescriptor : PropertyDescriptor
+ {
+ #region Member Variables
+ private PropertyDescriptor myInner;
+ private string myDisplayName;
+ private string myDescription;
+ private string myCategory;
+ #endregion // Member Variables
+ #region Constructor
+ /// <summary>
+ /// Create a wrapped descriptor
+ /// </summary>
+ /// <param name="modifyDescriptor"></param>
+ /// <param name="displayName">The modified display name. If this is <see langword="null"/>, then the original display name is used.</param>
+ /// <param name="description">The modified description. If this is <see langword="null"/>, then the original description is used.</param>
+ /// <param name="category">The modified category. If this is <see langword="null"/>, then the original category is used.</param>
+ public DisplayModifiedPropertyDescriptor(PropertyDescriptor modifyDescriptor, string displayName, string description, string category)
+ : base(modifyDescriptor.Name, GetAttributeArray(modifyDescriptor.Attributes))
+ {
+ myInner = modifyDescriptor;
+ myDisplayName = displayName;
+ myDescription = description;
+ myCategory = category;
+ }
+ private static Attribute[] GetAttributeArray(AttributeCollection attributes)
+ {
+ int attributeCount;
+ if (attributes == null || 0 == (attributeCount = attributes.Count))
+ {
+ return null;
+ }
+ Attribute[] retVal = new Attribute[attributeCount];
+ attributes.CopyTo(retVal, 0);
+ return retVal;
+ }
+ #endregion // Constructor
+ #region Display overrides
+ public override string Category
+ {
+ get
+ {
+ return myCategory ?? myInner.Category;
+ }
+ }
+ public override string DisplayName
+ {
+ get
+ {
+ return myDisplayName ?? myInner.DisplayName;
+ }
+ }
+ public override string Description
+ {
+ get
+ {
+ return myDescription ?? myInner.Description;
+ }
+ }
+ #endregion // Display overrides
+ #region Other overrides
+ public override bool CanResetValue(object component)
+ {
+ return myInner.CanResetValue(component);
+ }
+ public override Type ComponentType
+ {
+ get { return myInner.ComponentType; }
+ }
+ public override object GetValue(object component)
+ {
+ return myInner.GetValue(component);
+ }
+ public override bool IsReadOnly
+ {
+ get { return myInner.IsReadOnly; }
+ }
+ public override Type PropertyType
+ {
+ get { return myInner.PropertyType; }
+ }
+ public override void ResetValue(object component)
+ {
+ myInner.ResetValue(component);
+ }
+ public override void SetValue(object component, object value)
+ {
+ myInner.SetValue(component, value);
+ }
+ public override bool ShouldSerializeValue(object component)
+ {
+ return myInner.ShouldSerializeValue(component);
+ }
+ public override void AddValueChanged(object component, EventHandler handler)
+ {
+ myInner.AddValueChanged(component, handler);
+ }
+ public override AttributeCollection Attributes
+ {
+ get { return myInner.Attributes; }
+ }
+ public override TypeConverter Converter
+ {
+ get { return myInner.Converter; }
+ }
+ public override bool DesignTimeOnly
+ {
+ get { return myInner.DesignTimeOnly; }
+ }
+ public override PropertyDescriptorCollection GetChildProperties(object instance, Attribute[] filter)
+ {
+ return myInner.GetChildProperties(instance, filter);
+ }
+ public override object GetEditor(Type editorBaseType)
+ {
+ return myInner.GetEditor(editorBaseType);
+ }
+ public override bool IsBrowsable
+ {
+ get { return myInner.IsBrowsable; }
+ }
+ public override bool IsLocalizable
+ {
+ get { return myInner.IsLocalizable; }
+ }
+ public override void RemoveValueChanged(object component, EventHandler handler)
+ {
+ myInner.RemoveValueChanged(component, handler);
+ }
+ public override bool SupportsChangeEvents
+ {
+ get { return myInner.SupportsChangeEvents; }
+ }
+ public override string ToString()
+ {
+ return myInner.ToString();
+ }
+ #endregion // Other overrides
+ }
+ #endregion // ModifyPropertyDescriptorDisplay
}
}
Modified: trunk/ORMModel/Framework/Design/EnumConverter.cs
===================================================================
--- trunk/ORMModel/Framework/Design/EnumConverter.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/Framework/Design/EnumConverter.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -3,6 +3,7 @@
* Natural Object-Role Modeling Architect for Visual Studio *
* *
* Copyright \xA9 Neumont University. All rights reserved. *
+* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
* *
* The use and distribution terms for this software are covered by the *
* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
@@ -360,7 +361,7 @@
#region ConvertFrom method
/// <summary>See <see cref="EnumConverter.ConvertFrom"/>.</summary>
- public sealed override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
string stringValue = value as string;
if ((object)stringValue != null && culture != null && !culture.Equals(CultureInfo.InvariantCulture))
@@ -377,7 +378,7 @@
#region ConvertTo method
/// <summary>See <see cref="EnumConverter.ConvertTo"/>.</summary>
- public sealed override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string) && culture != null && !culture.Equals(CultureInfo.InvariantCulture) &&
(value is TEnum ||
Modified: trunk/ORMModel/ObjectModel/Design/ElementGroupingTypeDescriptor.cs
===================================================================
--- trunk/ORMModel/ObjectModel/Design/ElementGroupingTypeDescriptor.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/ObjectModel/Design/ElementGroupingTypeDescriptor.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -2,7 +2,7 @@
/**************************************************************************\
* Natural Object-Role Modeling Architect for Visual Studio *
* *
-* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
+* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
* *
* The use and distribution terms for this software are covered by the *
* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
@@ -16,20 +16,21 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Design;
using System.Globalization;
using System.Security.Permissions;
+using System.Text;
+using System.Windows.Forms;
+using System.Windows.Forms.Design;
using Microsoft.VisualStudio.Modeling;
using Microsoft.VisualStudio.Modeling.Design;
+using Microsoft.VisualStudio.VirtualTreeGrid;
+using ORMSolutions.ORMArchitect.Core.Shell;
+using ORMSolutions.ORMArchitect.Core.ObjectModel;
using ORMSolutions.ORMArchitect.Framework.Design;
-using ORMSolutions.ORMArchitect.Core.ObjectModel;
-using System.Drawing.Design;
-using System.Windows.Forms.Design;
-using ORMSolutions.ORMArchitect.Core.Shell;
-using System.Windows.Forms;
-using Microsoft.VisualStudio.VirtualTreeGrid;
-using System.Collections.ObjectModel;
-using System.Drawing;
namespace ORMSolutions.ORMArchitect.Core.ObjectModel.Design
{
@@ -57,7 +58,15 @@
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
PropertyDescriptorCollection retVal = base.GetProperties(attributes);
+ EditorUtility.ModifyPropertyDescriptorDisplay(retVal, "Name", null, null, ResourceStrings.ElementGroupingPropertyCategory);
retVal.Add(GroupingTypesPropertyDescriptor.Instance);
+ foreach (ElementGroupingType groupingType in ModelElement.GroupingTypeCollection)
+ {
+ foreach (PropertyDescriptor groupTypeDescriptor in TypeDescriptor.GetProperties(groupingType, attributes))
+ {
+ retVal.Add(groupTypeDescriptor);
+ }
+ }
return retVal;
}
#endregion // Base overrides
@@ -111,7 +120,7 @@
}
public override bool ShouldSerializeValue(object component)
{
- return false;
+ return true;
}
public override string Description
{
@@ -127,6 +136,13 @@
return ResourceStrings.ElementGroupingTypesPropertyDescriptorDisplayName;
}
}
+ public override string Category
+ {
+ get
+ {
+ return ResourceStrings.ElementGroupingPropertyCategory;
+ }
+ }
public override object GetEditor(Type editorBaseType)
{
if (editorBaseType == typeof(UITypeEditor))
@@ -135,6 +151,13 @@
}
return base.GetEditor(editorBaseType);
}
+ public override TypeConverter Converter
+ {
+ get
+ {
+ return GroupingTypesTypeConverter.Instance;
+ }
+ }
#endregion // Base overrides
#region GroupingTypesEditor class
/// <summary>
@@ -460,6 +483,58 @@
#endregion // GroupingTypesBranch class
}
#endregion // GroupingTypesEditor class
+ #region GroupingTypesTypeConverter class
+ /// <summary>
+ /// Provide display text for grouping types
+ /// </summary>
+ private class GroupingTypesTypeConverter : TypeConverter
+ {
+ #region Constructor and Instance
+ public static readonly TypeConverter Instance = new GroupingTypesTypeConverter();
+ private GroupingTypesTypeConverter()
+ {
+ }
+ #endregion // Constructor and Instance
+ #region Base overrides
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ ElementGrouping grouping;
+ LinkedElementCollection<ElementGroupingType> groupingTypes;
+ int groupingTypeCount;
+ if (destinationType == typeof(string) &&
+ null != context &&
+ null != (grouping = context.Instance as ElementGrouping) &&
+ 0 != (groupingTypeCount = (groupingTypes = grouping.GroupingTypeCollection).Count))
+ {
+ if (groupingTypeCount == 1)
+ {
+ return DomainTypeDescriptor.GetDisplayName(groupingTypes[0].GetType());
+ }
+ else
+ {
+ StringBuilder builder = new StringBuilder();
+ TextInfo textInfo = culture.TextInfo;
+ string separator = textInfo.ListSeparator;
+ if (!char.IsWhiteSpace(separator, separator.Length - 1))
+ {
+ separator += " ";
+ }
+ for (int i = 0; i < groupingTypeCount; ++i)
+ {
+ if (i != 0)
+ {
+ builder.Append(separator);
+ }
+ builder.Append(DomainTypeDescriptor.GetDisplayName(groupingTypes[i].GetType()));
+ }
+ return builder.ToString();
+ }
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ #endregion // Base overrides
+ }
+ #endregion // GroupingTypesTypeConverter class
}
#endregion // GroupingTypesPropertyDescriptor class
}
Modified: trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs
===================================================================
--- trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/ObjectModel/GeneratedCode/DomainClasses.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -1709,6 +1709,7 @@
[global::System.ComponentModel.Editor(typeof(global::ORMSolutions.ORMArchitect.Framework.Design.MultilineTextEditor<global::ORMSolutions.ORMArchitect.Core.ObjectModel.Definition>), typeof(global::System.Drawing.Design.UITypeEditor))]
[global::System.ComponentModel.MergableProperty(false)]
[DslDesign::DisplayNameResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/DefinitionText.DisplayName", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
+ [DslDesign::CategoryResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/DefinitionText.Category", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslDesign::DescriptionResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/DefinitionText.Description", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslModeling::DomainProperty(Kind = DslModeling::DomainPropertyKind.CustomStorage)]
[DslModeling::DomainObjectId("d1539042-2a67-413b-8b3b-12d00775bb8d")]
@@ -1803,6 +1804,7 @@
[global::System.ComponentModel.Editor(typeof(global::ORMSolutions.ORMArchitect.Framework.Design.MultilineTextEditor<global::ORMSolutions.ORMArchitect.Core.ObjectModel.Note>), typeof(global::System.Drawing.Design.UITypeEditor))]
[global::System.ComponentModel.MergableProperty(false)]
[DslDesign::DisplayNameResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/NoteText.DisplayName", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
+ [DslDesign::CategoryResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/NoteText.Category", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslDesign::DescriptionResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/NoteText.Description", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslModeling::DomainProperty(Kind = DslModeling::DomainPropertyKind.CustomStorage)]
[DslModeling::DomainObjectId("39b0228b-8884-4e4e-b595-4f058f192b50")]
@@ -1904,6 +1906,7 @@
/// GroupTypes.
/// </summary>
[DslDesign::DisplayNameResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.DisplayName", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
+ [DslDesign::CategoryResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.Category", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslDesign::DescriptionResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.Description", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[global::System.ComponentModel.DefaultValue(ORMSolutions.ORMArchitect.Core.ObjectModel.GroupingMembershipTypeCompliance.NotExcluded)]
[DslModeling::DomainObjectId("16e7b546-46ce-4a46-aed5-1437edb5fa6c")]
@@ -1994,6 +1997,7 @@
/// GroupPriority are given precedence.
/// </summary>
[DslDesign::DisplayNameResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/Priority.DisplayName", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
+ [DslDesign::CategoryResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/Priority.Category", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslDesign::DescriptionResource("ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/Priority.Description", typeof(global::ORMSolutions.ORMArchitect.Core.ObjectModel.ORMCoreDomainModel), "ORMSolutions.ORMArchitect.Core.GeneratedCode.CoreDomainModelResx")]
[DslModeling::DomainObjectId("c290cb24-0f2c-4e67-a561-fcd25dda53e8")]
public global::System.Int32 Priority
Modified: trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx
===================================================================
--- trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/ObjectModel/GeneratedCode/DomainModelResx.resx 2009-09-16 07:45:45 UTC (rev 1410)
@@ -350,6 +350,10 @@
<value>InformalDescription</value>
<comment>DisplayName for DomainProperty 'DefinitionText' on DomainClass 'ElementGrouping'</comment>
</data>
+ <data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/DefinitionText.Category" xml:space="preserve">
+ <value>Group</value>
+ <comment>Category for DomainProperty 'DefinitionText' on DomainClass 'ElementGrouping'</comment>
+ </data>
<data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/NoteText.Description" xml:space="preserve">
<value>A note to associate with this group.
To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' tool window.</value>
@@ -359,6 +363,10 @@
<value>Note</value>
<comment>DisplayName for DomainProperty 'NoteText' on DomainClass 'ElementGrouping'</comment>
</data>
+ <data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/NoteText.Category" xml:space="preserve">
+ <value>Group</value>
+ <comment>Category for DomainProperty 'NoteText' on DomainClass 'ElementGrouping'</comment>
+ </data>
<data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.Description" xml:space="preserve">
<value>Specify the level of GroupType compliance for elements in this group.
Not Excluded: Allow elements not explicitly excluded by a selected GroupType.
@@ -370,6 +378,10 @@
<value>GroupTypeCompliance</value>
<comment>DisplayName for DomainProperty 'TypeCompliance' on DomainClass 'ElementGrouping'</comment>
</data>
+ <data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.Category" xml:space="preserve">
+ <value>Group</value>
+ <comment>Category for DomainProperty 'TypeCompliance' on DomainClass 'ElementGrouping'</comment>
+ </data>
<data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/Priority.Description" xml:space="preserve">
<value>Specify a priority relative to other Groups. If an element is included in two groups of the same type, the settings for the Group with the highest GroupPriority are given precedence.</value>
<comment>Description for DomainProperty 'Priority' on DomainClass 'ElementGrouping'</comment>
@@ -378,6 +390,10 @@
<value>GroupPriority</value>
<comment>DisplayName for DomainProperty 'Priority' on DomainClass 'ElementGrouping'</comment>
</data>
+ <data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/Priority.Category" xml:space="preserve">
+ <value>Group</value>
+ <comment>Category for DomainProperty 'Priority' on DomainClass 'ElementGrouping'</comment>
+ </data>
<data name="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGroupingType.Description" xml:space="preserve">
<value>A type for a group. Each Group is associated with a new instance of each of its GroupTypes, allowing individual settings per group.</value>
<comment>Description for DomainClass 'ElementGroupingType'</comment>
Modified: trunk/ORMModel/ObjectModel/Grouping.cs
===================================================================
--- trunk/ORMModel/ObjectModel/Grouping.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/ObjectModel/Grouping.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -2,7 +2,7 @@
/**************************************************************************\
* Natural Object-Role Modeling Architect for Visual Studio *
* *
-* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
+* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
* *
* The use and distribution terms for this software are covered by the *
* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
@@ -522,6 +522,23 @@
}
}
}
+ /// <summary>
+ /// Get the <see cref="ElementGroupingType"/> instance associated with this <see cref="ElementGrouping"/>
+ /// </summary>
+ /// <typeparam name="T">The <see cref="ElementGroupingType"/> to retrieve.</typeparam>
+ /// <returns>The <see cref="ElementGroupingType"/> instance, or <see langword="null"/></returns>
+ public T GetGroupingType<T>() where T : ElementGroupingType
+ {
+ foreach (ElementGroupingType groupingType in GroupingTypeCollection)
+ {
+ T testGroupingType = groupingType as T;
+ if (testGroupingType != null)
+ {
+ return testGroupingType;
+ }
+ }
+ return null;
+ }
#endregion // Public Helper Methods
#region Rule methods
/// <summary>
Modified: trunk/ORMModel/ObjectModel/ORMCore.dsl
===================================================================
--- trunk/ORMModel/ObjectModel/ORMCore.dsl 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/ObjectModel/ORMCore.dsl 2009-09-16 07:45:45 UTC (rev 1410)
@@ -189,7 +189,7 @@
<DomainClassMoniker Name="ORMNamedElement"/>
</BaseClass>
<Properties>
- <DomainProperty Name="DefinitionText" DefaultValue="" DisplayName="InformalDescription" Description="An informal description of this group.
 To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Informal Description Editor' tool window." Id="D1539042-2A67-413B-8B3B-12D00775BB8D" Kind="CustomStorage">
+ <DomainProperty Name="DefinitionText" DefaultValue="" DisplayName="InformalDescription" Category="Group" Description="An informal description of this group.
 To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Informal Description Editor' tool window." Id="D1539042-2A67-413B-8B3B-12D00775BB8D" Kind="CustomStorage">
<Attributes>
<ClrAttribute Name="global::System.ComponentModel.Editor">
<Parameters>
@@ -207,7 +207,7 @@
<ExternalTypeMoniker Name="/System/String"/>
</Type>
</DomainProperty>
- <DomainProperty Name="NoteText" DefaultValue="" DisplayName="Note" Description="A note to associate with this group.
 To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' tool window." Id="39B0228B-8884-4E4E-B595-4F058F192B50" Kind="CustomStorage">
+ <DomainProperty Name="NoteText" DefaultValue="" DisplayName="Note" Category="Group" Description="A note to associate with this group.
 To insert new lines, use Control-Enter in the dropdown editor, or open the 'ORM Notes Editor' tool window." Id="39B0228B-8884-4E4E-B595-4F058F192B50" Kind="CustomStorage">
<Attributes>
<ClrAttribute Name="global::System.ComponentModel.Editor">
<Parameters>
@@ -225,12 +225,12 @@
<ExternalTypeMoniker Name="/System/String"/>
</Type>
</DomainProperty>
- <DomainProperty Name="TypeCompliance" DefaultValue="NotExcluded" DisplayName="GroupTypeCompliance" Id="16E7B546-46CE-4A46-AED5-1437EDB5FA6C" Description="Specify the level of GroupType compliance for elements in this group.
 Not Excluded: Allow elements not explicitly excluded by a selected GroupType.
 Approved by Some Type: Allow elements explicitly approved by at least one GroupType.
 Approved by All Types: Allow elements explicitly approved by all selected GroupTypes.">
+ <DomainProperty Name="TypeCompliance" DefaultValue="NotExcluded" DisplayName="GroupTypeCompliance" Category="Group" Id="16E7B546-46CE-4A46-AED5-1437EDB5FA6C" Description="Specify the level of GroupType compliance for elements in this group.
 Not Excluded: Allow elements not explicitly excluded by a selected GroupType.
 Approved by Some Type: Allow elements explicitly approved by at least one GroupType.
 Approved by All Types: Allow elements explicitly approved by all selected GroupTypes.">
<Type>
<DomainEnumerationMoniker Name="GroupingMembershipTypeCompliance"/>
</Type>
</DomainProperty>
- <DomainProperty Name="Priority" DefaultValue="0" DisplayName="GroupPriority" Id="C290CB24-0F2C-4E67-A561-FCD25DDA53E8" Description="Specify a priority relative to other Groups. If an element is included in two groups of the same type, the settings for the Group with the highest GroupPriority are given precedence.">
+ <DomainProperty Name="Priority" DefaultValue="0" DisplayName="GroupPriority" Category="Group" Id="C290CB24-0F2C-4E67-A561-FCD25DDA53E8" Description="Specify a priority relative to other Groups. If an element is included in two groups of the same type, the settings for the Group with the highest GroupPriority are given precedence.">
<Type>
<ExternalTypeMoniker Name="/System/Int32"/>
</Type>
Modified: trunk/ORMModel/Resources/ResourceStringsGenerator.cs
===================================================================
--- trunk/ORMModel/Resources/ResourceStringsGenerator.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/Resources/ResourceStringsGenerator.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -581,6 +581,13 @@
return ResourceStrings.GetString(ResourceManagers.Diagram, "DropShape.TransactionName");
}
}
+ public static string ElementGroupingPropertyCategory
+ {
+ get
+ {
+ return ResourceStrings.GetString(ResourceManagers.ObjectModel, "ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.Category");
+ }
+ }
/// <summary>The base name used to create a name for a new ElementGrouping. This is a format string with {0} being the placeholder for the number placement.</summary>
public static string ElementGroupingDefaultNamePattern
{
Modified: trunk/ORMModel/Resources/ResourceStringsGenerator.xml
===================================================================
--- trunk/ORMModel/Resources/ResourceStringsGenerator.xml 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/Resources/ResourceStringsGenerator.xml 2009-09-16 07:45:45 UTC (rev 1410)
@@ -122,6 +122,7 @@
<ResourceString name="ExclusiveOrCouplerTransactionName" model="Diagram" resourceName="ExclusiveOrCoupler.TransactionName"/>
<ResourceString name="ExclusiveOrDecouplerTransactionName" model="Diagram" resourceName="ExclusiveOrDecoupler.TransactionName"/>
<ResourceString name="DropShapeTransactionName" model="Diagram" resourceName="DropShape.TransactionName"/>
+ <ResourceString name="ElementGroupingPropertyCategory" model="ObjectModel" resourceName="ORMSolutions.ORMArchitect.Core.ObjectModel.ElementGrouping/TypeCompliance.Category"/>
<ResourceString name="ElementGroupingDefaultNamePattern" model="Model" resourceName="ElementGrouping.DefaultNamePattern"/>
<ResourceString name="ElementGroupingAddElementTransactionName" model="Model" resourceName="ElementGrouping.AddElement.TransactionName"/>
<ResourceString name="ElementGroupingAddGroupTransactionName" model="Model" resourceName="ElementGrouping.AddGroup.TransactionName"/>
Modified: trunk/ORMModel/ShapeModel/Design/FactTypeShapeTypeDescriptor.cs
===================================================================
--- trunk/ORMModel/ShapeModel/Design/FactTypeShapeTypeDescriptor.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/ShapeModel/Design/FactTypeShapeTypeDescriptor.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -28,6 +28,7 @@
using ORMSolutions.ORMArchitect.Core.ObjectModel;
using ORMSolutions.ORMArchitect.Core.ObjectModel.Design;
using ORMSolutions.ORMArchitect.Core.ShapeModel;
+using ORMSolutions.ORMArchitect.Framework;
namespace ORMSolutions.ORMArchitect.Core.ShapeModel.Design
{
@@ -134,7 +135,8 @@
if (FactTypeShape.ShouldDrawObjectification(factType))
{
FactTypeShape factTypeShape = PresentationElement;
- ObjectType nestingType = factType.NestingType;
+ Objectification objectification = factType.Objectification;
+ ObjectType nestingType = objectification.NestingType;
bool nestingTypeHasRelatedTypes = nestingType.IsSubtypeOrSupertype;
DomainDataDirectory domainDataDirectory = factType.Store.DomainDataDirectory;
EnsureDomainAttributesInitialized(domainDataDirectory);
@@ -152,7 +154,13 @@
descriptors[7] = CreatePropertyDescriptor(factTypeShape, domainDataDirectory.FindDomainProperty(FactTypeShape.DisplayRelatedTypesDomainPropertyId), DisplayRelatedTypesDomainPropertyAttributes);
}
- return new PropertyDescriptorCollection(descriptors);
+ PropertyDescriptorCollection retVal = new PropertyDescriptorCollection(descriptors);
+
+ // This mockup of important properties means that extension providers cannot add properties
+ // here by adding to the objecttype or facttype. Use an extension on the Objectification type
+ // itself to add extension properties.
+ ((IFrameworkServices)factType.Store).PropertyProviderService.GetProvidedProperties(objectification, retVal);
+ return retVal;
}
return base.GetProperties(attributes);
}
Modified: trunk/ORMModel/Shell/ORMDocDataServices.cs
===================================================================
--- trunk/ORMModel/Shell/ORMDocDataServices.cs 2009-09-10 23:39:38 UTC (rev 1409)
+++ trunk/ORMModel/Shell/ORMDocDataServices.cs 2009-09-16 07:45:45 UTC (rev 1410)
@@ -3,7 +3,7 @@
* Natural Object-Role Modeling Architect for Visual Studio *
* *
* Copyright \xA9 Neumont University. All rights reserved. *
-* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
+* Copyright \xA9 ORM Solutions, LLC. All rights reserved. *
* *
* The use and distribution terms for this software are covered by the *
* Common Public License 1.0 (http://opensource.org/licenses/cpl) which *
@@ -2140,7 +2140,13 @@
if (null != modelError &&
null != (activator = shape as IModelErrorActivation))
{
- activator.ActivateModelError(modelError);
+ if (!activator.ActivateModelError(modelError))
+ {
+ // The shape itself could not activate this error.
+ // Attempt to activate using an activator that is tied to the
+ // backing element for the current shape.
+ ModelErrorActivationService.ActivateError(shape.ModelElement, modelError);
+ }
}
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|