Пример #1
0
        void AddBindingChildNodes(
            TaskRunnerInformation task,
            TaskRunnerBindingInformation binding,
            TreeNavigator navigator,
            TaskBindingTreeNode node)
        {
            foreach (TaskBindingTreeNode childNode in node.CreateChildNodes(task, binding))
            {
                TreeNavigator childNavigator = navigator.AddChild();

                if (!childNode.Icon.IsNull)
                {
                    childNavigator.SetValue(bindingNodeIconField, ImageService.GetIcon(childNode.Icon, Gtk.IconSize.Menu));
                }
                childNavigator.SetValue(bindingNodeNameField, childNode.Name);
                childNavigator.SetValue(bindingNodeField, childNode);

                AddBindingChildNodes(task, binding, childNavigator, childNode);
                navigator.MoveToParent();
            }

            if (node.IsRootNode)
            {
                RefreshBindingNodeName(node, navigator);
            }
        }
Пример #2
0
        /// <summary>
        /// Removes the binding child nodes and then adds the children back again if there are any.
        /// </summary>
        void RefreshBindingNode(TaskRunnerTreeNode taskRunnerNode, TaskRunnerBindEvent bindEvent)
        {
            // Ensure binding tab is displayed.
            notebook.CurrentTab = notebook.Tabs [0];

            TaskRunnerBindingInformation binding     = taskRunnerNode.TaskInfo.Bindings.FindBinding(bindEvent);
            TaskBindingTreeNode          bindingNode = GetBindingTreeNode(bindEvent);

            TreeNavigator navigator = GetNavigator(bindingNode);

            if (navigator == null)
            {
                return;
            }

            navigator.RemoveChildren();

            if (binding != null)
            {
                AddBindingChildNodes(taskRunnerNode.TaskInfo, binding, navigator, bindingNode);
                bindingsTreeView.ExpandRow(navigator.CurrentPosition, true);
            }
            else
            {
                // No more bindings. Last binding has been removed.
                RefreshBindingNodeName(bindingNode, navigator);
            }
        }
Пример #3
0
 void AddBindingsTreeNodes()
 {
     beforeBuildBindingNode = AddBindingsTreeNode(TaskRunnerBindEvent.BeforeBuild);
     afterBuildBindingNode  = AddBindingsTreeNode(TaskRunnerBindEvent.AfterBuild);
     cleanBindingNode       = AddBindingsTreeNode(TaskRunnerBindEvent.Clean);
     projectOpenBindingNode = AddBindingsTreeNode(TaskRunnerBindEvent.ProjectOpened);
 }
Пример #4
0
        TaskBindingTreeNode AddBindingsTreeNode(TaskRunnerBindEvent bindEvent)
        {
            var node = new TaskBindingTreeNode(bindEvent);

            TreeNavigator navigator = bindingsTreeStore.AddNode();

            navigator.SetValue(bindingNodeNameField, node.Name);
            navigator.SetValue(bindingNodeField, node);

            return(node);
        }
Пример #5
0
        void MoveBindingDown()
        {
            TaskBindingTreeNode bindingNode = GetSelectedBindingNode();

            if (bindingNode?.MoveDown() == true)
            {
                TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(bindingsTreeView.SelectedRow);
                navigator.MoveNext();

                TaskBindingTreeNode otherBindingNode = navigator.GetValue(bindingNodeField);
                navigator.SetValue(bindingNodeNameField, bindingNode.Name);
                navigator.SetValue(bindingNodeField, bindingNode);

                navigator.MovePrevious();
                navigator.SetValue(bindingNodeNameField, otherBindingNode.Name);
                navigator.SetValue(bindingNodeField, otherBindingNode);
            }
        }
Пример #6
0
        void AddBindingNodes(TaskRunnerInformation task, TaskRunnerBindingInformation binding)
        {
            TaskBindingTreeNode parentNode = GetBindingTreeNode(binding.BindEvent);

            if (parentNode == null)
            {
                return;
            }

            TreeNavigator navigator = GetNavigator(parentNode);

            if (navigator == null)
            {
                return;
            }

            AddBindingChildNodes(task, binding, navigator, parentNode);
        }
Пример #7
0
        TreeNavigator GetNavigator(TaskBindingTreeNode node)
        {
            TreeNavigator       navigator   = bindingsTreeStore.GetFirstNode();
            TaskBindingTreeNode currentNode = navigator.GetValue(bindingNodeField);

            while (currentNode != node)
            {
                if (navigator.MoveNext())
                {
                    currentNode = navigator.GetValue(bindingNodeField);
                }
                else
                {
                    LoggingService.LogError("Unable to find TreeNavigator for binding tree node {0}", node.Name);
                    return(null);
                }
            }

            return(navigator);
        }
Пример #8
0
        void RemoveBinding()
        {
            TreeNavigator navigator = bindingsTreeStore.GetNavigatorAt(bindingsTreeView.SelectedRow);

            if (navigator == null)
            {
                return;
            }

            TaskBindingTreeNode bindingNode = navigator.GetValue(bindingNodeField);

            if (bindingNode == null)
            {
                return;
            }

            bindingNode.RemoveBinding();
            navigator.Remove();

            TaskBindingTreeNode parentNode = GetBindingTreeNode(bindingNode.BindEvent);

            if (parentNode == null)
            {
                return;
            }

            navigator = GetNavigator(parentNode);
            if (navigator != null)
            {
                RefreshBindingNodeName(parentNode, navigator);
                if (!parentNode.AnyBindings())
                {
                    navigator.RemoveChildren();
                }
            }
        }
Пример #9
0
        void UpdateMoveBindingDown(CommandInfo info)
        {
            TaskBindingTreeNode bindingNode = GetSelectedBindingNode();

            info.Enabled = bindingNode?.CanMoveDown() == true;
        }
Пример #10
0
 void RefreshBindingNodeName(TaskBindingTreeNode node, TreeNavigator navigator)
 {
     node.RefreshName();
     navigator.SetValue(bindingNodeNameField, node.Name);
 }