FieldDefSettingsCommand(IFieldNode fieldNode, FieldDefOptions options) { this.fieldNode = fieldNode; this.newOptions = options; this.origOptions = new FieldDefOptions(fieldNode.FieldDef); this.origParentNode = (IFileTreeNodeData)fieldNode.TreeNode.Parent.Data; this.origParentChildIndex = this.origParentNode.TreeNode.Children.IndexOf(fieldNode.TreeNode); Debug.Assert(this.origParentChildIndex >= 0); if (this.origParentChildIndex < 0) { throw new InvalidOperationException(); } this.nameChanged = origOptions.Name != newOptions.Name; if (this.nameChanged) { this.memberRefInfos = RefFinder.FindMemberRefsToThisModule(fieldNode.GetModule()).Where(a => RefFinder.FieldEqualityComparerInstance.Equals(a, fieldNode.FieldDef)).Select(a => new MemberRefInfo(a)).ToArray(); } }
FieldDefSettingsCommand(IFieldNode fieldNode, FieldDefOptions options) { this.fieldNode = fieldNode; this.newOptions = options; this.origOptions = new FieldDefOptions(fieldNode.FieldDef); this.origParentNode = (IFileTreeNodeData)fieldNode.TreeNode.Parent.Data; this.origParentChildIndex = this.origParentNode.TreeNode.Children.IndexOf(fieldNode.TreeNode); Debug.Assert(this.origParentChildIndex >= 0); if (this.origParentChildIndex < 0) throw new InvalidOperationException(); this.nameChanged = origOptions.Name != newOptions.Name; if (this.nameChanged) this.memberRefInfos = RefFinder.FindMemberRefsToThisModule(fieldNode.GetModule()).Where(a => RefFinder.FieldEqualityComparerInstance.Equals(a, fieldNode.FieldDef)).Select(a => new MemberRefInfo(a)).ToArray(); }
CreateFieldDefCommand(ITypeNode ownerNode, FieldDefOptions options) { this.ownerNode = ownerNode; this.fieldNode = ownerNode.Create(options.CreateFieldDef(ownerNode.TypeDef.Module)); }
DeleteFieldDefCommand(IFieldNode[] fieldNodes) { this.nodes = new DeletableNodes<IFieldNode>(fieldNodes); }
public void Restore(IFieldNode[] nodes) { Debug.Assert(infos != null); if (infos == null) throw new InvalidOperationException(); Debug.Assert(infos.Length == nodes.Length); if (infos.Length != nodes.Length) throw new InvalidOperationException(); for (int i = infos.Length - 1; i >= 0; i--) { var node = nodes[i]; var info = infos[i]; info.OwnerType.Fields.Insert(info.FieldIndex, node.FieldDef); } infos = null; }
public void Delete(IFieldNode[] nodes) { Debug.Assert(infos == null); if (infos != null) throw new InvalidOperationException(); infos = new ModelInfo[nodes.Length]; for (int i = 0; i < infos.Length; i++) { var node = nodes[i]; var info = new ModelInfo(node.FieldDef); infos[i] = info; info.OwnerType.Fields.RemoveAt(info.FieldIndex); } }
public FieldNodeCreator(IModuleDocumentNode modNode, ITypeNode ownerNode, FieldDef field) { this.ownerNode = ownerNode; this.fieldNode = modNode.Context.DocumentTreeView.Create(field); }
CreateFieldDefCommand(ITypeNode ownerNode, FieldDefOptions options) { this.ownerNode = ownerNode; this.fieldNode = ownerNode.Create(options.CreateFieldDef(ownerNode.TypeDef.Module)); }