void FillMembersComboBox()
        {
            IClass c = GetCurrentSelectedClass();

            if (c != null && lastClassInMembersComboBox != c)
            {
                lastClassInMembersComboBox = c;
                ArrayList items       = new ArrayList();
                bool      partialMode = false;
                IClass    currentPart = c;
                if (c.IsPartial)
                {
                    CompoundClass cc = c.GetCompoundClass() as CompoundClass;
                    if (cc != null)
                    {
                        partialMode = true;
                        c           = cc;
                    }
                }

                lock (c) {
                    int       lastIndex = 0;
                    IComparer comparer  = new Comparer(System.Globalization.CultureInfo.InvariantCulture);

                    foreach (IMethod m in c.Methods)
                    {
                        items.Add(new ComboBoxItem(m, m.Name, (int)ScriptControl.GetIcon(m), partialMode ? currentPart.Methods.Contains(m) : true));
                    }
                    items.Sort(lastIndex, c.Methods.Count, comparer);
                    lastIndex = items.Count;

                    foreach (IProperty p in c.Properties)
                    {
                        items.Add(new ComboBoxItem(p, p.Name, (int)ScriptControl.GetIcon(p), partialMode ? currentPart.Properties.Contains(p) : true));
                    }
                    items.Sort(lastIndex, c.Properties.Count, comparer);
                    lastIndex = items.Count;

                    foreach (IField f in c.Fields)
                    {
                        items.Add(new ComboBoxItem(f, f.Name, (int)ScriptControl.GetIcon(f), partialMode ? currentPart.Fields.Contains(f) : true));
                    }
                    items.Sort(lastIndex, c.Fields.Count, comparer);
                    lastIndex = items.Count;

                    foreach (IEvent evt in c.Events)
                    {
                        items.Add(new ComboBoxItem(evt, evt.Name, (int)ScriptControl.GetIcon(evt), partialMode ? currentPart.Events.Contains(evt) : true));
                    }
                    items.Sort(lastIndex, c.Events.Count, comparer);
                    lastIndex = items.Count;
                }

                membersComboBox.BeginUpdate();
                membersComboBox.Items.Clear();
                membersComboBox.Items.AddRange(items.ToArray());
                membersComboBox.EndUpdate();
                UpdateMembersComboBox();
            }
        }
        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();
                }
            }
        }
 void AddClasses(ArrayList items, ICollection classes)
 {
     foreach (IClass c in classes)
     {
         items.Add(new ComboBoxItem(c, c.FullyQualifiedName, (int)ScriptControl.GetIcon(c), true));
         AddClasses(items, c.InnerClasses);
     }
 }
Exemple #4
0
 public Document(ScriptControl Parent) : this()
 {
     _Parent = Parent;
 }
Exemple #5
0
 public ErrorList(ScriptControl scriptControl)
 {
     ParentSc = scriptControl;
     InitializeComponent();
 }