private void Invoke() { INodeSourceContext sourceContext = this.documentNode.SourceContext; this.documentNode.SourceContext = this.sourceContext; this.sourceContext = sourceContext; }
private void Invoke() { this.documentNode.ClearOldSourceContainerContext(); INodeSourceContext containerSourceContext = this.documentNode.ContainerSourceContext; this.documentNode.ContainerSourceContext = this.containerSourceContext; this.containerSourceContext = containerSourceContext; }
internal SourceContextContainer(INodeSourceContext containerContext, T content) { if ((object)content == null) { throw new ArgumentNullException("content"); } this.containerContext = containerContext; this.content = content; }
public override void SetContainerSourceContext(DocumentNode node, INodeSourceContext sourceContext) { if (this.undoService != null) { this.undoService.Add((IUndoUnit) new SceneXamlDocument.ContainerSourceContextUndoUnit(node, sourceContext)); } else { base.SetContainerSourceContext(node, sourceContext); } }
protected void SetSourceContext(DocumentNode node, INodeSourceContext sourceContext) { if (node.DocumentRoot != null) { node.DocumentRoot.SetSourceContext(node, sourceContext); } else { node.SourceContext = sourceContext; } }
private static void ClearSourceContextInitialRange(INodeSourceContext sourceContext) { XamlSourceContext xamlSourceContext = sourceContext as XamlSourceContext; if (xamlSourceContext == null) { return; } xamlSourceContext.InitialTextSpan = TextRange.Null; XmlElementReference elementReference = xamlSourceContext as XmlElementReference; if (elementReference == null) { return; } elementReference.InitialStartTagSpan = TextRange.Null; }
private void OffsetSourceContext(INodeSourceContext context, int offset) { XamlSourceContext xamlSourceContext = context as XamlSourceContext; if (xamlSourceContext == null || xamlSourceContext.TextRange == null) { return; } int start = xamlSourceContext.TextRange.Offset + offset; xamlSourceContext.InitialTextSpan = (ITextRange) new TextRange(start, start + xamlSourceContext.TextRange.Length); XmlElementReference elementReference = xamlSourceContext as XmlElementReference; if (elementReference == null || elementReference.StartTagRange == null) { return; } elementReference.InitialStartTagSpan = (ITextRange) new TextRange(start, elementReference.StartTagRange.Length); }
private void ProcessChangePropertyAction(DataBindingProcessingContext context) { INodeSourceContext containerContext = (INodeSourceContext)null; DocumentCompositeNode bindingNode = context.DocumentCompositeNode.GetValue(DataBindingProcessor.ChangePropetyActionTargetObject, out containerContext) as DocumentCompositeNode; if (bindingNode == null || !bindingNode.Type.IsBinding) { return; } RawDataSourceInfoBase sourceInfoFromBinding = DataContextHelper.GetDataSourceInfoFromBinding(bindingNode); RawDataSourceInfoBase bindingInfo = this.CombineDataSources(context.DataContext, sourceInfoFromBinding); if (!bindingInfo.IsValid) { bindingInfo = this.GetRelativeSourceTargetBindingDataSource(context); } if (bindingInfo == null || !bindingInfo.IsValid) { return; } this.HandleBinding(context, bindingInfo); }
internal virtual void SetSite(DocumentCompositeNode parent, IProperty propertyKey, int childIndex) { if (parent == null) { this.oldContainerSourceContext = this.ContainerSourceContext; DocumentNode.UpdateNameScopes((DocumentNode)this.Parent, this.SitePropertyKey, this, false); this.parent = (DocumentCompositeNode)null; this.propertyKey = (IProperty)null; this.childIndex = -1; this.SetDocumentRoot((IDocumentRoot)null); } else { if (this.parent != null) { throw new InvalidOperationException(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.DocumentNodeCannotReparentNode, (object)this, (object)this.Parent, (object)parent)); } this.parent = parent; this.propertyKey = propertyKey; this.childIndex = childIndex; this.SetDocumentRoot(parent.DocumentRoot); DocumentNode.UpdateNameScopes((DocumentNode)parent, propertyKey, this, true); } }
public XamlParserResults(ITypeId expectedRootType, DocumentNode rootNode, IList <XamlParseError> errors, INodeSourceContext xmlDocumentReference, IReadableSelectableTextBuffer textBuffer) { this.expectedRootType = expectedRootType; this.rootNode = rootNode; this.errors = errors; this.xmlDocumentReference = (XmlDocumentReference)xmlDocumentReference; this.textBuffer = textBuffer; }
public ContainerSourceContextUndoUnit(DocumentNode documentNode, INodeSourceContext containerSourceContext) { this.containerSourceContext = containerSourceContext; this.documentNode = documentNode; }
public SourceContextUndoUnit(DocumentNode documentNode, INodeSourceContext sourceContext) { this.sourceContext = sourceContext; this.documentNode = documentNode; }
private static void UpdateSourceContextRangeFromInitialRange(IReadableSelectableTextBuffer textBuffer, INodeSourceContext context, int offset) { XamlSourceContext xamlSourceContext = context as XamlSourceContext; if (xamlSourceContext == null) { return; } if (!TextRange.IsNull(xamlSourceContext.InitialTextSpan)) { ITextRange initialTextSpan = xamlSourceContext.InitialTextSpan; ITextRange textRange1 = (ITextRange) new TextRange(initialTextSpan.Offset + offset, initialTextSpan.Offset + initialTextSpan.Length + offset); xamlSourceContext.InitialTextSpan = textRange1; xamlSourceContext.SetTextRange(textBuffer, textRange1.Offset, textRange1.Length); XmlElementReference elementReference = xamlSourceContext as XmlElementReference; if (elementReference == null) { return; } foreach (XmlElementReference.Attribute attribute in elementReference.AttributesToPreserve) { XamlSerializerUtilities.UpdateSourceContextRangeFromInitialRange(textBuffer, (INodeSourceContext)attribute.SourceContext, offset); } if (TextRange.IsNull(elementReference.InitialStartTagSpan)) { return; } ITextRange initialStartTagSpan = elementReference.InitialStartTagSpan; ITextRange textRange2 = (ITextRange) new TextRange(initialStartTagSpan.Offset + offset, initialStartTagSpan.Offset + initialStartTagSpan.Length + offset); elementReference.InitialStartTagSpan = textRange2; elementReference.StartTagRange = textBuffer.CreateRange(textRange2.Offset, textRange2.Length); } else { xamlSourceContext.ClearTextRange(); XmlElementReference elementReference = xamlSourceContext as XmlElementReference; if (elementReference == null) { return; } elementReference.StartTagRange = (ITextRange)null; } }
public void ClearOldSourceContainerContext() { this.oldContainerSourceContext = (INodeSourceContext)null; }
public override void Execute() { Dictionary <IType, bool> dictionary = new Dictionary <IType, bool>(); foreach (ITypeId typeId in DefaultTypeInstantiator.InteractiveElementTypes) { IType key = this.SceneViewModel.ProjectContext.ResolveType(typeId); if (!this.SceneViewModel.ProjectContext.PlatformMetadata.IsNullType((ITypeId)key)) { dictionary.Add(key, true); } } List <SceneNode> list = new List <SceneNode>(); foreach (DocumentNode node in this.SceneViewModel.RootNode.DocumentNode.DescendantNodes) { for (IType key = node.Type; key != null; key = key.BaseType) { if (dictionary.ContainsKey(key)) { SceneNode sceneNode = this.SceneViewModel.GetSceneNode(node); if (string.IsNullOrEmpty(sceneNode.Name)) { list.Add(sceneNode); break; } break; } } } if (list.Count > 0) { list.Sort((Comparison <SceneNode>)((a, b) => { INodeSourceContext sourceContext1 = a.DocumentNode.SourceContext; INodeSourceContext sourceContext2 = b.DocumentNode.SourceContext; if (sourceContext1 == null || sourceContext2 == null) { return(a.DocumentNode.Marker.CompareTo((object)b.DocumentNode.Marker)); } return(sourceContext1.TextRange.Offset.CompareTo(sourceContext2.TextRange.Offset)); })); using (SceneEditTransaction editTransaction = this.SceneViewModel.CreateEditTransaction(StringTable.UndoNameInteractiveElements)) { foreach (SceneNode sceneNode in list) { sceneNode.EnsureNamed(); } editTransaction.Commit(); } } if (this.DesignerContext.MessageDisplayService == null) { return; } string message; if (list.Count > 0) { message = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.InteractiveElementsNamedSome, new object[1] { (object)list.Count }); } else { message = StringTable.InteractiveElementsNamedNone; } int num = (int)this.DesignerContext.MessageDisplayService.ShowMessage(message); }