From: <mcu...@us...> - 2007-08-20 22:30:52
|
Revision: 1095 http://orm.svn.sourceforge.net/orm/?rev=1095&view=rev Author: mcurland Date: 2007-08-20 15:30:52 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Added verbalization support for column selections. The items displayed may change in the future, but this is a good start and important for debugging other relational mappings. refs #328 Changed VerbalizationToolWindow to use same main verbalization loop as the report verbalizer. This will be broken out more in the future as we refactor the report engine externally. refs #315 Also sorted the extension manager dialog and added license information to some files. Modified Paths: -------------- trunk/ORMModel/ObjectModel/VerbalizationReport.cs trunk/ORMModel/Shell/ExtensionManager.cs trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs trunk/Oial/ORMOialBridge/ModificationTracker.cs trunk/Oial/ORMOialBridge/ORMElementGateway.cs trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs trunk/RelationalModel/DcilModel/DcilModel.csproj trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs Added Paths: ----------- trunk/RelationalModel/DcilModel/Verbalization.cs trunk/RelationalModel/OialDcilBridge/Verbalization.cs Modified: trunk/ORMModel/ObjectModel/VerbalizationReport.cs =================================================================== --- trunk/ORMModel/ObjectModel/VerbalizationReport.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/ORMModel/ObjectModel/VerbalizationReport.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -218,6 +218,11 @@ false, ref firstCall); + if (!firstCall) + { + writer.WriteDocumentFooter(); + } + textWriter.Flush(); textWriter.Close(); #endregion // Object Type List Report @@ -331,6 +336,11 @@ false, ref firstCall); + if (!firstCall) + { + writer.WriteDocumentFooter(); + } + textWriter.Flush(); textWriter.Close(); } @@ -455,52 +465,6 @@ myDocumentHeaderReplacementFields = documentHeaderReplacementFields; } /// <summary> - /// Retrieves replacement fields for the Document Header snippet from the given IORMFontAndColorService implementation - /// </summary> - /// <param name="colorService"></param> - /// <param name="snippets"></param> - /// <returns></returns> - public static string[] GetDocumentHeaderReplacementFields(IORMFontAndColorService colorService, IVerbalizationSets<CoreVerbalizationSnippetType> snippets) - { - string[] retVal; - // The replacement fields, pulled from VerbalizationGenerator.xsd - //{0} font-family - //{1} font-size - //{2} predicate text color - //{3} predicate text bold - //{4} object name color - //{5} object name bold - //{6} formal item color - //{7} formal item bold - //{8} notes item color - //{9} notes item bold - //{10} refmode item color - //{11} refmode item bold - //{12} instance value item color - //{13} instance value item bold - string boldWeight = snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerFontWeightBold); - string normalWeight = snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerFontWeightNormal); - retVal = new string[] { "Tahoma", "8", "darkgreen", normalWeight, "purple", normalWeight, "mediumblue", boldWeight, "brown", normalWeight, "darkgray", normalWeight, "brown", normalWeight }; - using (Font font = colorService.GetFont(ORMDesignerColorCategory.Verbalizer)) - { - retVal[0] = font.FontFamily.Name; - retVal[1] = (font.Size * 72f).ToString(CultureInfo.InvariantCulture); - retVal[2] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerPredicateText)); - retVal[3] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerPredicateText) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[4] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerObjectName)); - retVal[5] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerObjectName) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[6] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerFormalItem)); - retVal[7] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerFormalItem) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[8] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerNotesItem)); - retVal[9] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerNotesItem) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[10] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerRefMode)); - retVal[11] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerRefMode) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[12] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerInstanceValue)); - retVal[13] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerInstanceValue) & FontStyle.Bold)) ? boldWeight : normalWeight; - } - return retVal; - } - /// <summary> /// Gets the underlying TextWriter /// </summary> public TextWriter Writer Modified: trunk/ORMModel/Shell/ExtensionManager.cs =================================================================== --- trunk/ORMModel/Shell/ExtensionManager.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/ORMModel/Shell/ExtensionManager.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -31,6 +31,8 @@ using Neumont.Tools.Modeling.Design; using Neumont.Tools.ORM.ObjectModel; using Neumont.Tools.Modeling.Shell; +using System.Collections; +using System.Globalization; namespace Neumont.Tools.ORM.Shell { @@ -293,7 +295,23 @@ { AddItemToListView(type); } + lvExtensions.ListViewItemSorter = ItemComparer.Instance; } + + private sealed class ItemComparer : IComparer + { + public static readonly IComparer Instance = new ItemComparer(); + private ItemComparer() + { + } + + public int Compare(object obj1, object obj2) + { + ListViewItem item1 = (ListViewItem) obj1; + ListViewItem item2 = (ListViewItem) obj2; + return string.Compare(item1.SubItems[1].Text, item2.SubItems[1].Text, false, CultureInfo.CurrentCulture); + } + } /// <summary> /// This method adds the passed in ORMExtensionType to the ListView on the ExtensionManager dialogue. /// </summary> Modified: trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs =================================================================== --- trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -33,6 +33,7 @@ using Microsoft.VisualStudio.TextManager.Interop; using Neumont.Tools.ORM.ObjectModel; using Neumont.Tools.Modeling; +using Neumont.Tools.ORM.ObjectModel.Verbalization; namespace Neumont.Tools.ORM.Shell { @@ -289,6 +290,7 @@ ICollection selectedObjects = base.GetSelectedComponents(); IDictionary<Type, IVerbalizationSets> snippetsDictionary = null; IVerbalizationSets<CoreVerbalizationSnippetType> snippets = null; + VerbalizationCallbackWriter callbackWriter = null; bool showNegative = ORMDesignerPackage.VerbalizationWindowSettings.ShowNegativeVerbalizations; bool firstCallPending = true; Dictionary<IVerbalize, IVerbalize> verbalized = myAlreadyVerbalized; @@ -317,16 +319,23 @@ { snippetsDictionary = (mel.Store as IORMToolServices).GetVerbalizationSnippetsDictionary(ORMCoreDomainModel.VerbalizationTargetName); snippets = (IVerbalizationSets<CoreVerbalizationSnippetType>)snippetsDictionary[typeof(CoreVerbalizationSnippetType)]; - myStringWriter.NewLine = snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerNewLine); + callbackWriter = new VerbalizationCallbackWriter(snippets, myStringWriter, GetDocumentHeaderReplacementFields(mel, snippets)); } - VerbalizeElement(mel, snippetsDictionary, verbalized, showNegative, myStringWriter, ref firstCallPending); + VerbalizationHelper.VerbalizeElement( + mel, + snippetsDictionary, + verbalized, + showNegative, + callbackWriter, + true, + ref firstCallPending); } } } if (!firstCallPending) { // Write footer - myStringWriter.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDocumentFooter)); + callbackWriter.WriteDocumentFooter(); // Clear cache verbalized.Clear(); } @@ -341,238 +350,6 @@ } } } - private sealed class VerbalizationContextImpl : IVerbalizationContext - { - /// <summary> - /// A callback delegate enabling a verbalizer to tell - /// the hosting window that it is about to begin verbalizing. - /// This enables the host window to delay writing content outer - /// content until it knows that text is about to be written by - /// the verbalizer to the writer - /// </summary> - /// <param name="content">The style of verbalization content</param> - public delegate void NotifyBeginVerbalization(VerbalizationContent content); - public delegate void NotifyDeferVerbalization(object target, IVerbalizeFilterChildren childFilter); - private NotifyBeginVerbalization myBeginCallback; - private NotifyDeferVerbalization myDeferCallback; - public VerbalizationContextImpl(NotifyBeginVerbalization beginCallback, NotifyDeferVerbalization deferCallback) - { - myBeginCallback = beginCallback; - myDeferCallback = deferCallback; - } - #region IVerbalizationContext Implementation - void IVerbalizationContext.BeginVerbalization(VerbalizationContent content) - { - myBeginCallback(content); - } - void IVerbalizationContext.DeferVerbalization(object target, IVerbalizeFilterChildren childFilter) - { - if (myDeferCallback != null) - { - myDeferCallback(target, childFilter); - } - } - #endregion // IVerbalizationContext Implementation - } - /// <summary> - /// Determine the indentation level for verbalizing a ModelElement, and fire - /// the delegate for verbalization - /// </summary> - /// <param name="element">The element to verbalize</param> - /// <param name="snippetsDictionary">The default or loaded verbalization sets. Passed through all verbalization calls.</param> - /// <param name="alreadyVerbalized">A dictionary of top-level (indentationLevel == 0) elements that have already been verbalized.</param> - /// <param name="isNegative">Use the negative form of the reading</param> - /// <param name="writer">The TextWriter for verbalization output</param> - /// <param name="firstCallPending"></param> - private static void VerbalizeElement(ModelElement element, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IDictionary<IVerbalize, IVerbalize> alreadyVerbalized, bool isNegative, TextWriter writer, ref bool firstCallPending) - { - int lastLevel = 0; - bool firstWrite = true; - bool localFirstCallPending = firstCallPending; - IVerbalizationSets<CoreVerbalizationSnippetType> snippets = (IVerbalizationSets<CoreVerbalizationSnippetType>)snippetsDictionary[typeof(CoreVerbalizationSnippetType)]; - VerbalizeElement( - element, - snippetsDictionary, - null, - delegate(IVerbalize verbalizer, int indentationLevel) - { - if (indentationLevel == 0) - { - if (alreadyVerbalized.ContainsKey(verbalizer)) - { - return VerbalizationResult.AlreadyVerbalized; - } - } - bool retVal = verbalizer.GetVerbalization( - writer, - snippetsDictionary, - new VerbalizationContextImpl( - delegate(VerbalizationContent content) - { - // Prepare for verbalization on this element. Everything - // is delayed to this point in case the verbalization implementation - // does not callback to the text writer. - if (firstWrite) - { - if (localFirstCallPending) - { - localFirstCallPending = false; - // Write the HTML header to the buffer - writer.Write(string.Format(CultureInfo.InvariantCulture, snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDocumentHeader), GetDocumentHeaderReplacementFields(element, snippets))); - } - - // write open tag for new verbalization - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerOpenVerbalization)); - firstWrite = false; - } - else - { - writer.WriteLine(); - } - - // Write indentation tags as needed - if (indentationLevel > lastLevel) - { - do - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerIncreaseIndent)); - ++lastLevel; - } while (lastLevel != indentationLevel); - } - else if (lastLevel > indentationLevel) - { - do - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDecreaseIndent)); - --lastLevel; - } while (lastLevel != indentationLevel); - } - }, - null), - isNegative); - if (retVal) - { - if (indentationLevel == 0) - { - alreadyVerbalized.Add(verbalizer, verbalizer); - } - return VerbalizationResult.Verbalized; - } - else - { - return VerbalizationResult.NotVerbalized; - } - }, - isNegative, - 0); - while (lastLevel > 0) - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDecreaseIndent)); - --lastLevel; - } - // close the opening tag for the new verbalization - if (!firstWrite) - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerCloseVerbalization)); - } - firstCallPending = localFirstCallPending; - } - /// <summary> - /// Verbalize the passed in element and all its children - /// </summary> - private static void VerbalizeElement(ModelElement element, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IVerbalizeFilterChildren filter, VerbalizationHandler callback, bool isNegative, int indentLevel) - { - IVerbalize parentVerbalize = null; - IRedirectVerbalization surrogateRedirect; - if (indentLevel == 0 && - null != (surrogateRedirect = element as IRedirectVerbalization) && - null != (parentVerbalize = surrogateRedirect.SurrogateVerbalizer)) - { - element = parentVerbalize as ModelElement; - } - else - { - parentVerbalize = element as IVerbalize; - } - bool disposeVerbalizer = false; - if (filter != null && parentVerbalize != null) - { - CustomChildVerbalizer filterResult = filter.FilterChildVerbalizer(parentVerbalize, isNegative); - parentVerbalize = filterResult.Instance; - disposeVerbalizer = filterResult.Options; - } - try - { - VerbalizationResult result = (parentVerbalize != null) ? callback(parentVerbalize, indentLevel) : VerbalizationResult.NotVerbalized; - if (result == VerbalizationResult.AlreadyVerbalized) - { - return; - } - bool parentVerbalizeOK = result == VerbalizationResult.Verbalized; - bool verbalizeChildren = parentVerbalizeOK ? (element != null) : (element is IVerbalizeChildren); - if (verbalizeChildren) - { - if (parentVerbalizeOK) - { - ++indentLevel; - } - filter = parentVerbalize as IVerbalizeFilterChildren; - ReadOnlyCollection<DomainRoleInfo> aggregatingList = element.GetDomainClass().AllDomainRolesPlayed; - int aggregatingCount = aggregatingList.Count; - for (int i = 0; i < aggregatingCount; ++i) - { - DomainRoleInfo roleInfo = aggregatingList[i]; - if (roleInfo.IsEmbedding) - { - LinkedElementCollection<ModelElement> children = roleInfo.GetLinkedElements(element); - int childCount = children.Count; - for (int j = 0; j < childCount; ++j) - { - VerbalizeElement(children[j], snippetsDictionary, filter, callback, isNegative, indentLevel); - } - } - } - // TODO: Need BeforeNaturalChildren/AfterNaturalChildren/SkipNaturalChildren settings for IVerbalizeCustomChildren - IVerbalizeCustomChildren customChildren = parentVerbalize as IVerbalizeCustomChildren; - if (customChildren != null) - { - foreach (CustomChildVerbalizer customChild in customChildren.GetCustomChildVerbalizations(filter, isNegative)) - { - IVerbalize childVerbalize = customChild.Instance; - if (childVerbalize != null) - { - try - { - callback(childVerbalize, indentLevel); - } - finally - { - if (customChild.Options) - { - IDisposable dispose = childVerbalize as IDisposable; - if (dispose != null) - { - dispose.Dispose(); - } - } - } - } - } - } - } - } - finally - { - if (disposeVerbalizer) - { - IDisposable dispose = parentVerbalize as IDisposable; - if (dispose != null) - { - dispose.Dispose(); - } - } - } - } #endregion // Verbalization Implementation #region ORMToolWindow Implementation /// <summary> Modified: trunk/Oial/ORMOialBridge/ModificationTracker.cs =================================================================== --- trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/Oial/ORMOialBridge/ORMElementGateway.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Diagnostics; Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/RelationalModel/DcilModel/DcilModel.csproj =================================================================== --- trunk/RelationalModel/DcilModel/DcilModel.csproj 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/DcilModel/DcilModel.csproj 2007-08-20 22:30:52 UTC (rev 1095) @@ -153,6 +153,7 @@ <DependentUpon>ResourceStringsGenerator.xml</DependentUpon> </Compile> <Compile Include="SurveyImplementations\SurveyQuestions.cs" /> + <Compile Include="Verbalization.cs" /> <EmbeddedResource Include="Catalog.resx"> <DependentUpon>Catalog.cs</DependentUpon> <SubType>Designer</SubType> Added: trunk/RelationalModel/DcilModel/Verbalization.cs =================================================================== --- trunk/RelationalModel/DcilModel/Verbalization.cs (rev 0) +++ trunk/RelationalModel/DcilModel/Verbalization.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -0,0 +1,62 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion +using Microsoft.VisualStudio.Modeling; +using Neumont.Tools.ORM.ObjectModel; +using System; +using System.Collections.ObjectModel; + +namespace Neumont.Tools.RelationalModels.ConceptualDatabase +{ + partial class Column : IRedirectVerbalization + { + #region IRedirectVerbalization implementation + /// <summary> + /// The guid for the role in the bridge model we want to defer verbalization to. Lifted + /// from the generated bridge code. + /// </summary> + private static readonly Guid ColumnBridgeRoleId = new Guid(0xbc7ea8a8, 0x8772, 0x4ca4, 0xb9, 0x14, 0xb7, 0x8b, 0x4b, 0x58, 0x33, 0x38); + + /// <summary> + /// Implements <see cref="IRedirectVerbalization.SurrogateVerbalizer"/>. Defers to the + /// first bridge link element, if the bridge is loaded. + /// </summary> + protected IVerbalize SurrogateVerbalizer + { + get + { + // Look up the associated bridge links by guid, this project does not reference + // the bridge elements directly, so the type is not available. + DomainRoleInfo roleInfo; + ReadOnlyCollection<ElementLink> links; + IVerbalize retVal = null; + if (null != (roleInfo = Store.DomainDataDirectory.FindDomainRole(ColumnBridgeRoleId)) && + 0 != (links = roleInfo.GetElementLinks(this)).Count) + { + retVal = links[0] as IVerbalize; + } + return retVal; + } + } + IVerbalize IRedirectVerbalization.SurrogateVerbalizer + { + get + { + return SurrogateVerbalizer; + } + } + #endregion // IRedirectVerbalization implementation + } +} Modified: trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-20 22:30:52 UTC (rev 1095) @@ -156,6 +156,7 @@ <AutoGen>True</AutoGen> <DependentUpon>ResourceStringsGenerator.xml</DependentUpon> </Compile> + <Compile Include="Verbalization.cs" /> </ItemGroup> <ItemGroup> <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" /> Modified: trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -19,7 +19,6 @@ using System.Resources; using System.Windows.Forms; using Neumont.Tools.Modeling.Design; -using Neumont.Tools.ORM.ObjectModel; namespace Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge { Added: trunk/RelationalModel/OialDcilBridge/Verbalization.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/Verbalization.cs (rev 0) +++ trunk/RelationalModel/OialDcilBridge/Verbalization.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -0,0 +1,62 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. 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 * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion +using Microsoft.VisualStudio.Modeling; +using Neumont.Tools.ORM.ObjectModel; +using Neumont.Tools.ORMAbstraction; +using Neumont.Tools.ORMToORMAbstractionBridge; +using Neumont.Tools.RelationalModels.ConceptualDatabase; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; + +namespace Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge +{ + partial class ColumnHasConceptTypeChild : IVerbalize + { + #region IVerbalize Implementation + /// <summary> + /// Implements <see cref="IVerbalize.GetVerbalization"/> + /// </summary> + protected bool GetVerbalization(TextWriter writer, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IVerbalizationContext verbalizationContext, bool isNegative) + { + // We are redirected to this point by the associated Column element + Column column = this.Column; + bool firstWrite = true; + foreach (ConceptTypeChild child in ColumnHasConceptTypeChild.GetConceptTypeChildPath(this.Column)) + { + foreach (FactType factType in ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(child)) + { + if (firstWrite) + { + firstWrite = false; + } + else + { + writer.WriteLine(); + } + verbalizationContext.DeferVerbalization(factType, null); + } + } + return false; + } + bool IVerbalize.GetVerbalization(TextWriter writer, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IVerbalizationContext verbalizationContext, bool isNegative) + { + return GetVerbalization(writer, snippetsDictionary, verbalizationContext, isNegative); + } + #endregion // IVerbalize Implementation + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |