|
From: <mcu...@us...> - 2009-04-03 17:21:44
|
Revision: 1377
http://orm.svn.sourceforge.net/orm/?rev=1377&view=rev
Author: mcurland
Date: 2009-04-03 17:21:34 +0000 (Fri, 03 Apr 2009)
Log Message:
-----------
* Enable conditional serialization of top-level link elements. refs #329
* Hyphen binding incorrectly bound a hyphen directly to a replacement field on its left. A reading of the form 'A- B' would lead to incorrect verbalization, and crashes or unsaveable files with the relational extension turned on. refs #263
* Fixed FactEditor activation issue (opening the window did not respect the current selection). Fixed by flagging a tool window as visible before setting the selection container during the activation sequence.
Modified Paths:
--------------
trunk/ORMModel/Framework/Shell/SerializationEngine.cs
trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs
trunk/ORMModel/ObjectModel/Verbalization.cs
trunk/ORMModel/Transforms/SerializationExtensions.xsd
trunk/ORMModel/Transforms/SerializationExtensions.xslt
Modified: trunk/ORMModel/Framework/Shell/SerializationEngine.cs
===================================================================
--- trunk/ORMModel/Framework/Shell/SerializationEngine.cs 2009-04-01 01:49:40 UTC (rev 1376)
+++ trunk/ORMModel/Framework/Shell/SerializationEngine.cs 2009-04-03 17:21:34 UTC (rev 1377)
@@ -2884,26 +2884,41 @@
for (int k = 0; k < linkCount; ++k)
{
ElementLink link = relationshipElements[k] as ElementLink;
- if (relationship.IsPrimaryLinkElement)
+ if (ns.ShouldSerializeRootElement(link))
{
- SerializeElement(file, link, new SerializeExtraAttributesCallback(delegate(XmlWriter xmlFile)
+ int testSerialize = 0;
+ for (; testSerialize < customRelationshipRoles.Length; ++testSerialize)
{
+ if (!ShouldSerializeElement(DomainRoleInfo.GetRolePlayer(link, customRelationshipRoles[testSerialize].DomainRoleId)))
+ {
+ break;
+ }
+ }
+ if (testSerialize != customRelationshipRoles.Length)
+ {
+ continue;
+ }
+ if (relationship.IsPrimaryLinkElement)
+ {
+ SerializeElement(file, link, new SerializeExtraAttributesCallback(delegate(XmlWriter xmlFile)
+ {
+ for (int l = 0; l < customRelationshipRoles.Length; ++l)
+ {
+ CustomSerializedStandaloneRelationshipRole role = customRelationshipRoles[l];
+ xmlFile.WriteAttributeString(role.AttributeName, ToXml(DomainRoleInfo.GetRolePlayer(link, role.DomainRoleId).Id));
+ }
+ }));
+ }
+ else
+ {
+ file.WriteStartElement(relationship.ElementPrefix, relationship.ElementName, relationship.ElementNamespace);
for (int l = 0; l < customRelationshipRoles.Length; ++l)
{
CustomSerializedStandaloneRelationshipRole role = customRelationshipRoles[l];
- xmlFile.WriteAttributeString(role.AttributeName, ToXml(DomainRoleInfo.GetRolePlayer(link, role.DomainRoleId).Id));
+ file.WriteAttributeString(role.AttributeName, ToXml(DomainRoleInfo.GetRolePlayer(link, role.DomainRoleId).Id));
}
- }));
- }
- else
- {
- file.WriteStartElement(relationship.ElementPrefix, relationship.ElementName, relationship.ElementNamespace);
- for (int l = 0; l < customRelationshipRoles.Length; ++l)
- {
- CustomSerializedStandaloneRelationshipRole role = customRelationshipRoles[l];
- file.WriteAttributeString(role.AttributeName, ToXml(DomainRoleInfo.GetRolePlayer(link, role.DomainRoleId).Id));
+ file.WriteEndElement();
}
- file.WriteEndElement();
}
}
}
Modified: trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs
===================================================================
--- trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs 2009-04-01 01:49:40 UTC (rev 1376)
+++ trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs 2009-04-03 17:21:34 UTC (rev 1377)
@@ -479,8 +479,8 @@
monitor.SelectionChanged += new EventHandler<MonitorSelectionEventArgs>(MonitorSelectionChanged);
monitor.DocumentWindowChanged += new EventHandler<MonitorSelectionEventArgs>(DocumentWindowChanged);
SetCurrentDocument(SafeGetCurrentDocument(monitor) as DocDataType, monitor.CurrentDocumentView as DocViewType);
+ myFrameVisibility = FrameVisibilityFlags.Visible | (flags & FrameVisibilityFlags.PersistentFlagsMask) | FrameVisibilityFlags.HasBeenVisible;
CurrentSelectionContainer = monitor.CurrentSelectionContainer as SelectionContainerType ?? monitor.CurrentDocumentView as SelectionContainerType;
- myFrameVisibility = FrameVisibilityFlags.Visible | (flags & FrameVisibilityFlags.PersistentFlagsMask) | FrameVisibilityFlags.HasBeenVisible;
break;
}
}
Modified: trunk/ORMModel/ObjectModel/Verbalization.cs
===================================================================
--- trunk/ORMModel/ObjectModel/Verbalization.cs 2009-04-01 01:49:40 UTC (rev 1376)
+++ trunk/ORMModel/ObjectModel/Verbalization.cs 2009-04-03 17:21:34 UTC (rev 1377)
@@ -1134,7 +1134,7 @@
//# Test if there is a hyphen binding match before the next format replacement field
//(?(.*?\S-\s.*?(?<!\{)\{\d+\}(?!\}))
// # If there is a hyphen bind before the next replacement field then use it
- // ((?<BeforeLeftHyphenWord>.*?\s??)(?<LeftHyphenWord>\S+?)-(?<AfterLeftHyphen>\s.*?))
+ // ((?<BeforeLeftHyphenWord>.*?\s??)(?<LeftHyphenWord>\S+?)(?<!(?<!\{)\{\d+\}(?!\}))-(?<AfterLeftHyphen>\s.*?))
// |
// # Otherwise, pick up all text before the next format replacement field
// ((?<BeforeLeftHyphenWord>.*?))
@@ -1163,7 +1163,7 @@
System.Threading.Interlocked.CompareExchange<Regex>(
ref myMainRegex,
new Regex(
- @"(?n)\G(?(.*?\S-\s.*?(?<!\{)\{\d+\}(?!\}))((?<BeforeLeftHyphenWord>.*?\s??)(?<LeftHyphenWord>\S+?)-(?<AfterLeftHyphen>\s.*?))|((?<BeforeLeftHyphenWord>.*?)))((?<!\{)\{)(?<ReplaceIndex>\d+)(\}(?!\}))((?=(?(.+(?<!\{)\{\d+\}(?!\}))(((?!(?<!\{)\{\d+\}(?!\})).)*?\s-\S.*?(?<!\{)\{\d+\}(?!\}))|([^\-]*?\s-\S.*?)))(?<BeforeRightHyphen>.*?\s+?)-(?<RightHyphenWord>\S+))?",
+ @"(?n)\G(?(.*?\S-\s.*?(?<!\{)\{\d+\}(?!\}))((?<BeforeLeftHyphenWord>.*?\s??)(?<LeftHyphenWord>\S+?)(?<!(?<!\{)\{\d+\}(?!\}))-(?<AfterLeftHyphen>\s.*?))|((?<BeforeLeftHyphenWord>.*?)))((?<!\{)\{)(?<ReplaceIndex>\d+)(\}(?!\}))((?=(?(.+(?<!\{)\{\d+\}(?!\}))(((?!(?<!\{)\{\d+\}(?!\})).)*?\s-\S.*?(?<!\{)\{\d+\}(?!\}))|([^\-]*?\s-\S.*?)))(?<BeforeRightHyphen>.*?\s+?)-(?<RightHyphenWord>\S+))?",
RegexOptions.Compiled),
null);
regexMain = myMainRegex;
Modified: trunk/ORMModel/Transforms/SerializationExtensions.xsd
===================================================================
--- trunk/ORMModel/Transforms/SerializationExtensions.xsd 2009-04-01 01:49:40 UTC (rev 1376)
+++ trunk/ORMModel/Transforms/SerializationExtensions.xsd 2009-04-03 17:21:34 UTC (rev 1377)
@@ -14,6 +14,7 @@
Natural Object-Role Modeling Architect for Visual Studio
Copyright © Neumont University. All rights reserved.
+ Copyright © 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
@@ -320,7 +321,15 @@
<xs:element name="Container">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element name="RootLink" type="StandaloneLinkType"/>
+ <xs:element name="RootLink">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="ConditionalSerialization" minOccurs="0"/>
+ <xs:group ref="StandaloneLinkRoleGroup"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="StandaloneLinkAttributeGroup"/>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required"/>
<xs:attribute name="Prefix" type="xs:string" use="optional"/>
@@ -388,6 +397,10 @@
<xs:annotation>
<xs:documentation>Represents a link that is created directly without being in the parent context of one of its role players.</xs:documentation>
</xs:annotation>
+ <xs:group ref="StandaloneLinkRoleGroup"/>
+ <xs:attributeGroup ref="StandaloneLinkAttributeGroup"/>
+ </xs:complexType>
+ <xs:group name="StandaloneLinkRoleGroup">
<xs:sequence>
<xs:element name="Role" minOccurs="2" maxOccurs="2">
<xs:complexType>
@@ -404,6 +417,8 @@
</xs:complexType>
</xs:element>
</xs:sequence>
+ </xs:group>
+ <xs:attributeGroup name="StandaloneLinkAttributeGroup">
<xs:attribute name="Class" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The name of the link class.</xs:documentation>
@@ -424,7 +439,7 @@
<xs:documentation>If true, then an id attribute will be written out for this link and serialization will defer to the link treated as a class after the source and target role player elements are written.</xs:documentation>
</xs:annotation>
</xs:attribute>
- </xs:complexType>
+ </xs:attributeGroup>
<xs:complexType name="ElementType">
<xs:sequence>
<xs:sequence>
Modified: trunk/ORMModel/Transforms/SerializationExtensions.xslt
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|