private void RenderMenu()
        {
            if (ExternalTools == null)
            {
                return;
            }

            if (_externalToolsDialogMenuItem == null)
            {
                return;
            }

            CleanUpMenu();

            ToolStripMenuItem parentMenuItem = (ToolStripMenuItem)_externalToolsDialogMenuItem.OwnerItem;

            int index = parentMenuItem.DropDownItems.IndexOf(_externalToolsDialogMenuItem);

            for (int i = ExternalTools.Count - 1; i >= 0; i--)
            {
                ExternalToolEntry externalTool = ExternalTools[i];

                string menuText = externalTool.Title;
                if (!string.IsNullOrEmpty(menuText))
                {
                    ToolStripMenuItem externalToolMenuItem = new ToolStripMenuItem(menuText);
                    externalToolMenuItem.Tag    = externalTool;
                    externalToolMenuItem.Click += new EventHandler(externalToolMenuItem_Click);
                    parentMenuItem.DropDownItems.Insert(index, externalToolMenuItem);
                    _addedToolStripItems.Add(externalToolMenuItem);
                }
            }
        }
        private void MoveEntry(int offset)
        {
            ExternalToolEntry entry = CurrentEntry;
            int index = listBoxTool.SelectedIndex;

            _manager.ExternalTools.RemoveAt(index);
            int newIndex = index + offset;

            _manager.ExternalTools.Insert(newIndex, entry);
            listBoxTool.SelectedIndex = newIndex;
            listBoxTool.Focus();
        }
        internal string ComposeCommandToExecute(ExternalToolEntry entry)
        {
            if (entry == null)
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            sb.Append(entry.Command);

            if (!string.IsNullOrEmpty(entry.Arguments))
            {
                sb.Append(" ");
                sb.Append(GetArgumentExpression(entry.Arguments));
            }

            return(sb.ToString());
        }
        public void ExecuteCommand(ExternalToolEntry entry)
        {
            RaiseGetUpToDateValuesEvent();

            Process proc = new Process();

            proc.StartInfo.FileName = entry.Command;

            string args = GetArgumentExpression(entry.Arguments);

            if (!string.IsNullOrEmpty(args))
            {
                proc.StartInfo.Arguments = args;
            }

            string initDirExpr = GetInitialDirectoryExpression(entry.InitialDirectory);

            if (!string.IsNullOrEmpty(initDirExpr) && Directory.Exists(initDirExpr))
            {
                proc.StartInfo.WorkingDirectory = initDirExpr;
            }

            proc.Start();
        }