Beispiel #1
0
        public void UpdateOccurrences(
            [NotNull] IList <LocalOccurrence> occurrences,
            [NotNull] IEnumerable <LocalOccurrence> tailOccurrences = null)
        {
            lock (mySyncRoot)
            {
                myOccurrences        = occurrences;
                mySelectedOccurrence = (occurrences.Count == 0) ? null : occurrences[0];

                if (!myShouldDropHighlightings && occurrences.Count == 0)
                {
                    return;
                }

                mySequentialOccurrences.Next(lifetime =>
                {
                    myShellLocks.ExecuteOrQueueReadLock(
                        lifetime, Prefix + "UpdateOccurrence", () =>
                        UpdateOccurrencesHighlighting(lifetime, occurrences));

                    myUpdateSelectedScheduled = true;
                });

                mySequentialFocused.Next(lifetime =>
                {
                    myShellLocks.AssertReadAccessAllowed();

                    myShellLocks.ExecuteOrQueueReadLock(
                        lifetime, Prefix + "UpdateOccurrence", UpdateFocusedOccurrence);
                });
            }
        }
            public Foo1(LocalOccurrence occurrence, string displayName, IconId sourceFileIcon)
                : base(displayName + ":" + occurrence.LineNumber)
            {
                Icon  = sourceFileIcon ?? PsiSymbolsThemedIcons.Const.Id;
                Style = MenuItemStyle.Enabled;

                //var left = Gradient(100, 255, occurrence.LeftFragment, SystemColors.GrayText);
                //var right = Gradient(255, 100, occurrence.RightFragment, SystemColors.GrayText);

                ShortcutText = RichText.Empty
                               .Append(occurrence.LeftFragment, TextStyle.FromForeColor(SystemColors.GrayText))
                               .Append(occurrence.FoundText, new TextStyle(FontStyle.Bold, TextStyle.DefaultForegroundColor))
                               .Append(occurrence.RightFragment, TextStyle.FromForeColor(SystemColors.GrayText));
            }
Beispiel #3
0
        void DropHighlightings()
        {
            lock (mySyncRoot)
            {
                mySequentialOccurrences.TerminateCurrent();
                mySequentialFocused.TerminateCurrent();

                myOccurrences        = null;
                mySelectedOccurrence = null;

                if (myShouldDropHighlightings)
                {
                    myShellLocks.ExecuteOrQueueReadLock(Prefix + "DropHighlightings", () =>
                    {
                        UpdateOccurrencesHighlighting(
                            EternalLifetime.Instance, EmptyList <LocalOccurrence> .InstanceList);
                        UpdateFocusedOccurrence();
                    });
                }
            }
        }
Beispiel #4
0
        public void UpdateSelectedOccurrence([NotNull] LocalOccurrence occurrence)
        {
            lock (mySyncRoot)
            {
                var occurrences = myOccurrences.NotNull("occurrences != null");

                // late selection change event may happend - ignore
                if (!occurrences.Contains(occurrence))
                {
                    return;
                }

                mySelectedOccurrence = occurrence;

                if (!myUpdateSelectedScheduled)
                {
                    mySequentialFocused.Next(lifetime =>
                    {
                        myShellLocks.ExecuteOrQueueReadLock(
                            lifetime, Prefix + "UpdateSelectedOccurrence", UpdateFocusedOccurrence);
                    });
                }
            }
        }