Esempio n. 1
0
        public void ComilerErrors(Document doc, System.CodeDom.Compiler.CompilerErrorCollection Errors)
        {
            //delete all previous compiler errors
            string fileName = "";

            foreach (ListViewItem lvExisting in lvErrorList.Items)
            {
                if (Convert.ToInt32(lvExisting.SubItems[1].Text) > 0)   //compiler Warnings and errors
                {
                    fileName = lvExisting.SubItems[3].Text;
                    doc      = ParentSc.ShowFile(fileName);
                    if (doc != null)
                    {
                        doc.HighlightRemove(Convert.ToInt32("0" + lvExisting.SubItems[4].Text), Convert.ToInt32("0" + lvExisting.SubItems[5].Text));
                    }
                    lvExisting.Remove();
                }
            }
            //Add Errors
            ListViewItem lvItem;

            if (Errors.HasErrors || Errors.HasWarnings)
            {
                foreach (System.CodeDom.Compiler.CompilerError e in Errors)
                {
                    int lineNo = (e.Line - 1);
                    int ColNo  = (e.Column - 1);

                    lineNo = lineNo < 0 ? 0 : lineNo;
                    ColNo  = ColNo < 0 ? 0 : ColNo;

                    fileName = System.IO.Path.GetFileName(e.FileName);
                    if (e.IsWarning)
                    {
                        lvItem = new ListViewItem(new string[] { "", "2", e.ErrorText, fileName, lineNo.ToString(), ColNo.ToString() });

                        lvItem.StateImageIndex = 2;
                    }
                    else
                    {
                        lvItem = new ListViewItem(new string[] { "", "1", e.ErrorText, fileName, lineNo.ToString(), ColNo.ToString() });
                        lvItem.StateImageIndex = 3;
                    }

                    lvItem.Tag = fileName + "-" + lineNo.ToString() + "-" + ColNo.ToString();
                    lvErrorList.Items.Add(lvItem);
                    doc = ParentSc.ShowFile(fileName);
                    if (doc != null)
                    {
                        doc.HighlightError(lineNo, ColNo, e.IsWarning, e.ErrorText);
                    }
                }
            }
            UpdateSummary();
        }
        void ComboBoxSelectedIndexChanged(object sender, System.EventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            if (textAreaControl == null)
            {
                return;
            }
            if (autoselect)
            {
                ComboBoxItem item = (ComboBoxItem)comboBox.Items[comboBox.SelectedIndex];
                if (item.IsInCurrentPart)
                {
                    textAreaControl.ActiveViewControl.Caret.Position = new TextPoint(item.Column, item.Line);
                    textAreaControl.ActiveViewControl.ScrollIntoView();
                    textAreaControl.ActiveViewControl.Focus();
                }
                else
                {
                    IMember m = item.Item as IMember;
                    if (m != null)
                    {
                        string fileName = m.DeclaringType.CompilationUnit.FileName;
                        if (fileName == this.textAreaControl.FileName)
                        {
                            this.textAreaControl.ActiveViewControl.Caret.Position = new TextPoint(item.Column, item.Line);
                            textAreaControl.ActiveViewControl.ScrollIntoView();
                            textAreaControl.ActiveViewControl.Focus();
                        }
                        else
                        {
                            Document      doc    = (Document)this.textAreaControl.Parent;
                            ScriptControl sc     = (ScriptControl)doc.ParentScriptControl;
                            Document      docnew = sc.ShowFile(fileName);
                            if (docnew != null)
                            {
                                docnew.ParseContentsNow();
                                docnew.Editor.ActiveViewControl.Caret.Position = new TextPoint(item.Column, item.Line);
                                docnew.Editor.ActiveViewControl.ScrollIntoView();
                                docnew.Editor.ActiveViewControl.Focus();
                            }
                            else
                            {
                                docnew = ((Document)this.textAreaControl.Parent);
                                docnew.ParseContentsNow();
                                docnew.Editor.ActiveViewControl.Caret.Position = new TextPoint(item.Column, item.Line);
                                docnew.Editor.ActiveViewControl.ScrollIntoView();
                                docnew.Editor.ActiveViewControl.Focus();
                            }
                        }
                    }
                }
                if (comboBox == classComboBox)
                {
                    FillMembersComboBox();
                    UpdateMembersComboBox();
                }
            }
        }