Пример #1
0
        private void FillUsagesTextBox(Nemerle.Completion2.IIdeEngine engine)
        {
            string currentFileName = null;
            var    lastTextLength  = 0;

            rtbFoundUsages.Text = "";
            foreach (var usage in from use in _usages
                     orderby use.Location.File
                     select use)
            {
                var loc = usage.Location;
                if (loc.File != currentFileName)
                {
                    currentFileName = loc.File;
                    var fileString = string.Format("File: {0}\n", Path.GetFileName(currentFileName));
                    rtbFoundUsages.AppendText(fileString);

                    rtbFoundUsages.SelectionStart  = lastTextLength;
                    rtbFoundUsages.SelectionLength = fileString.Length;
                    rtbFoundUsages.SelectionColor  = Color.CornflowerBlue;

                    lastTextLength = rtbFoundUsages.Text.Length;
                }
                var strUsageLine = loc.Line.ToString();
                var line         = string.Format("{0}: {1}\n", strUsageLine, usage.GetLineOfCode(engine));
                rtbFoundUsages.AppendText(line);

                int lineStart       = lastTextLength;
                int selectionLength = loc.EndColumn - loc.Column;
                rtbFoundUsages.SelectionStart  = lineStart + strUsageLine.Length + 2 + loc.Column - 1;
                rtbFoundUsages.SelectionLength = selectionLength;

                if (_oldName == null)
                {
                    _oldName = rtbFoundUsages.SelectedText;
                    NewName  = _oldName;
                }

                rtbFoundUsages.SelectionBackColor = Color.LightGreen;
                lastTextLength = rtbFoundUsages.Text.Length;
            }
            rtbFoundUsages.SelectionStart = rtbFoundUsages.SelectionLength = 0;
        }
Пример #2
0
 public RenameRefactoringDlg(Nemerle.Completion2.IIdeEngine engine, GotoInfo[] usages)
 {
     InitializeComponent();
     _usages = usages;
     FillUsagesTextBox(engine);
 }