示例#1
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);
            }
        }
示例#2
0
        public void ToggleBinding(TaskRunnerBindEvent bindEvent, ITaskRunnerNode task)
        {
            if (config == null)
            {
                return;
            }

            TaskRunnerBindingInformation binding = FindBinding(bindEvent);

            if (binding != null)
            {
                binding.ToggleTask(task);
                if (!binding.AnyTasks())
                {
                    bindings.Remove(binding);
                }
            }
            else
            {
                binding = new TaskRunnerBindingInformation(bindEvent, task);
                bindings.Add(binding);
            }

            config.SaveBindings(configFile, ToXml());
        }
示例#3
0
 void OnUpdateToggleBinding(CommandInfo info, TaskRunnerBindEvent bindEvent)
 {
     info.Enabled = CanRunSelectedTask();
     if (info.Enabled)
     {
         info.Checked = selectedTaskRunnerNode.IsBindingEnabled(bindEvent);
     }
 }
示例#4
0
 void ToggleBinding(TaskRunnerBindEvent bindEvent)
 {
     if (CanRunSelectedTask())
     {
         OnToggleBinding(selectedTaskRunnerNode.TaskInfo, selectedTaskRunnerNode.TaskRunner, bindEvent);
         RefreshBindingNode(selectedTaskRunnerNode, bindEvent);
     }
 }
示例#5
0
        public TaskBindingTreeNode(TaskRunnerBindEvent bindEvent)
        {
            BindEvent = bindEvent;
            RefreshName();
            IsRootNode = true;

            tasks = new HashSet <TaskRunnerInformation> ();
        }
示例#6
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);
        }
示例#7
0
        public int Count(TaskRunnerBindEvent bindEvent)
        {
            TaskRunnerBindingInformation binding = FindBinding(bindEvent);

            if (binding != null)
            {
                return(binding.GetTasks().Count());
            }

            return(0);
        }
示例#8
0
        public bool IsBindingEnabled(TaskRunnerBindEvent bindEvent, ITaskRunnerNode taskRunnerNode)
        {
            TaskRunnerBindingInformation binding = FindBinding(bindEvent);

            if (binding != null)
            {
                return(binding.HasTask(taskRunnerNode));
            }

            return(false);
        }
示例#9
0
        TaskBindingTreeNode GetBindingTreeNode(TaskRunnerBindEvent bindEvent)
        {
            switch (bindEvent)
            {
            case TaskRunnerBindEvent.AfterBuild:
                return(afterBuildBindingNode);

            case TaskRunnerBindEvent.BeforeBuild:
                return(beforeBuildBindingNode);

            case TaskRunnerBindEvent.Clean:
                return(cleanBindingNode);

            case TaskRunnerBindEvent.ProjectOpened:
                return(projectOpenBindingNode);

            default:
                return(null);
            }
        }
示例#10
0
 public IEnumerable <TaskRunnerWithOptions> GetTasks(TaskRunnerBindEvent bindEvent)
 {
     foreach (TaskRunnerInformation task in Tasks)
     {
         foreach (TaskRunnerBindingInformation binding in task.Bindings)
         {
             if (binding.BindEvent == bindEvent)
             {
                 foreach (string taskName in binding.GetTasks())
                 {
                     ITaskRunnerNode node = task.GetInvokableTask(taskName);
                     if (node != null)
                     {
                         yield return(new TaskRunnerWithOptions(node, task.Options));
                     }
                 }
             }
         }
     }
 }
示例#11
0
        public bool RemoveBinding(TaskRunnerBindEvent bindEvent, string name)
        {
            if (config == null)
            {
                return(false);
            }

            TaskRunnerBindingInformation binding = FindBinding(bindEvent);

            if (binding != null)
            {
                if (binding.RemoveTask(name))
                {
                    config.SaveBindings(configFile, ToXml());
                    return(true);
                }
            }

            return(false);
        }
示例#12
0
 public TaskRunnerBindingInformation FindBinding(TaskRunnerBindEvent bindEvent)
 {
     return(bindings.FirstOrDefault(binding => binding.BindEvent == bindEvent));
 }
示例#13
0
 public void ToggleBinding(TaskRunnerBindEvent bindEvent, ITaskRunnerNode taskRunnerNode)
 {
     Bindings.ToggleBinding(bindEvent, taskRunnerNode);
 }
示例#14
0
 public bool IsBindingEnabled(TaskRunnerBindEvent bindEvent, ITaskRunnerNode taskRunnerNode)
 {
     return(Bindings.IsBindingEnabled(bindEvent, taskRunnerNode));
 }
示例#15
0
        public async Task <BuildResult> RunBuildTasks(GroupedTaskRunnerInformation tasks, TaskRunnerBindEvent bindEvent)
        {
            var buildResult = new BuildResult();

            foreach (TaskRunnerWithOptions node in tasks.GetTasks(bindEvent))
            {
                ITaskRunnerCommandResult result = await TaskRunnerServices.Workspace.RunTask(node);

                if (result.ExitCode != 0)
                {
                    buildResult.AddWarning(node.TaskRunner, result);
                }
            }

            return(buildResult);
        }
示例#16
0
 public bool RemoveBinding(TaskRunnerBindEvent bindEvent, string name)
 {
     return(Bindings.RemoveBinding(bindEvent, name));
 }
示例#17
0
 public bool IsBindingEnabled(TaskRunnerBindEvent bindEvent)
 {
     return(taskRunnerInfo.IsBindingEnabled(bindEvent, taskRunnerNode));
 }
示例#18
0
 public TaskRunnerBindingInformation(TaskRunnerBindEvent bindEvent, ITaskRunnerNode task)
 {
     this.bindEvent = bindEvent;
     taskNames.Add(task.Name);
 }
示例#19
0
 void ToggleBinding(TaskRunnerInformation taskRunnerInfo, ITaskRunnerNode node, TaskRunnerBindEvent bindEvent)
 {
     try {
         taskRunnerInfo.ToggleBinding(bindEvent, node);
     } catch (Exception ex) {
         LoggingService.LogError("Toggle binding failed.", ex);
         MessageService.ShowError(GettextCatalog.GetString("Unable to change binding."), ex);
     }
 }