예제 #1
0
        private void PasteNodeFromClipboardToSelection()
        {
            var result = ReClassClipboard.Paste(project, Program.Logger);

            foreach (var classNode in result.Item1)
            {
                if (!project.ContainsClass(classNode.Uuid))
                {
                    project.AddClass(classNode);
                }
            }

            if (selectedNodes.Count == 1)
            {
                var selectedNode = selectedNodes.First().Node;
                var parent       = selectedNode.ParentNode as ClassNode;
                if (parent != null)
                {
                    foreach (var node in result.Item2)
                    {
                        if (IsCycleFree(parent, node))
                        {
                            parent.InsertNode(selectedNode, node);
                        }
                    }
                }
            }
        }
예제 #2
0
        private void PasteNodeFromClipboardToSelection()
        {
            var result = ReClassClipboard.Paste(CurrentProject, Program.Logger);

            foreach (var pastedClassNode in result.Item1)
            {
                if (!CurrentProject.ContainsClass(pastedClassNode.Uuid))
                {
                    CurrentProject.AddClass(pastedClassNode);
                }
            }

            var selectedNodes = memoryViewControl.GetSelectedNodes();

            if (selectedNodes.Count == 1)
            {
                var selectedNode  = selectedNodes[0].Node;
                var containerNode = selectedNode.GetParentContainer();
                var classNode     = selectedNode.GetParentClass();
                if (containerNode != null && classNode != null)
                {
                    containerNode.BeginUpdate();

                    foreach (var node in result.Item2)
                    {
                        if (node is BaseWrapperNode)
                        {
                            var rootWrapper = node.GetRootWrapperNode();
                            Debug.Assert(rootWrapper == node);

                            if (rootWrapper.ShouldPerformCycleCheckForInnerNode())
                            {
                                if (rootWrapper.ResolveMostInnerNode() is ClassNode innerNode)
                                {
                                    if (!IsCycleFree(classNode, innerNode))
                                    {
                                        continue;
                                    }
                                }
                            }
                        }

                        containerNode.InsertNode(selectedNode, node);
                    }

                    containerNode.EndUpdate();
                }
            }
        }