コード例 #1
0
        void UpdateDeclarationView()
        {
            if (completionDataList == null || List.SelectionFilterIndex >= completionDataList.Count || List.SelectionFilterIndex == -1)
            {
                return;
            }
            if (List.GdkWindow == null)
            {
                return;
            }
            RemoveDeclarationViewTimer();
            // no selection, try to find a selection
            if (List.SelectedItem < 0 || List.SelectedItem >= completionDataList.Count)
            {
                List.CompletionString = PartialWord;
                bool hasMismatches;
                List.SelectionFilterIndex = FindMatchedEntry(List.CompletionString, out hasMismatches);
            }
            // no success, hide declaration view
            if (List.SelectedItem < 0 || List.SelectedItem >= completionDataList.Count)
            {
                HideDeclarationView();
                return;
            }
            var data = completionDataList [List.SelectedItem];

            IEnumerable <ICompletionData> filteredOverloads;

            if (data.HasOverloads)
            {
                filteredOverloads = data.OverloadedData;
                if (PropertyService.Get("HideObsoleteItems", false))
                {
                    filteredOverloads = filteredOverloads.Where(x => !x.DisplayFlags.HasFlag(DisplayFlags.Obsolete));
                }
            }
            else
            {
                filteredOverloads = new ICompletionData[] { data };
            }

            var overloads = new List <ICompletionData> (filteredOverloads);

            if (data != currentData)
            {
                HideDeclarationView();

                declarationviewwindow.Clear();
                declarationviewwindow.Realize();

                foreach (var overload in overloads)
                {
                    bool hasMarkup = (overload.DisplayFlags & DisplayFlags.DescriptionHasMarkup) != 0;
                    declarationviewwindow.AddOverload(hasMarkup ? overload.Description : GLib.Markup.EscapeText(overload.Description));
                }

                declarationviewwindow.Multiple = data.HasOverloads;
                currentData = data;
                if (data.HasOverloads)
                {
                    for (int i = 0; i < overloads.Count; i++)
                    {
                        if (!overloads[i].DisplayFlags.HasFlag(DisplayFlags.Obsolete))
                        {
                            declarationviewwindow.CurrentOverload = i;
                            break;
                        }
                    }
                }
            }

            if (declarationviewwindow.DescriptionMarkup.Length == 0)
            {
                HideDeclarationView();
                return;
            }

            if (currentData != null)
            {
                declarationViewTimer = GLib.Timeout.Add(250, DelayedTooltipShow);
            }
        }
コード例 #2
0
        void UpdateDeclarationView()
        {
            if (completionDataList == null || List.Selection >= completionDataList.Count || List.Selection == -1)
            {
                return;
            }
            if (List.GdkWindow == null)
            {
                return;
            }
            RemoveDeclarationViewTimer();
            // no selection, try to find a selection
            if (List.SelectionIndex < 0 || List.SelectionIndex >= completionDataList.Count)
            {
                List.CompletionString = PartialWord;
                bool hasMismatches;
                List.Selection = FindMatchedEntry(List.CompletionString, out hasMismatches);
            }
            // no success, hide declaration view
            if (List.SelectionIndex < 0 || List.SelectionIndex >= completionDataList.Count)
            {
                HideDeclarationView();
                return;
            }
            CompletionData data = completionDataList[List.SelectionIndex];

            IList <CompletionData> overloads;

            if (data.IsOverloaded)
            {
                overloads = new List <CompletionData> (data.OverloadedData);
            }
            else
            {
                overloads = new CompletionData[] { data };
            }

            if (data != currentData)
            {
                HideDeclarationView();

                declarationviewwindow.Clear();
                declarationviewwindow.Realize();

                foreach (CompletionData overload in overloads)
                {
                    bool hasMarkup = (overload.DisplayFlags & DisplayFlags.DescriptionHasMarkup) != 0;
                    declarationviewwindow.AddOverload(hasMarkup ? overload.Description : GLib.Markup.EscapeText(overload.Description));
                }

                declarationviewwindow.Multiple = data.IsOverloaded;
                currentData = data;
                if (data.IsOverloaded)
                {
                    for (int i = 0; i < overloads.Count; i++)
                    {
                        if ((overloads[i].DisplayFlags & DisplayFlags.Obsolete) != DisplayFlags.Obsolete)
                        {
                            declarationviewwindow.CurrentOverload = i;
                            break;
                        }
                    }
                }
            }

            if (declarationviewwindow.DescriptionMarkup.Length == 0)
            {
                HideDeclarationView();
                return;
            }

            if (currentData != null)
            {
                declarationViewTimer = GLib.Timeout.Add(250, DelayedTooltipShow);
            }
        }