protected override void Run()
        {
            MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
            HighlightUsagesExtension     ext = MoveToPrevUsageHandler.GetHighlightUsageExtension(doc);

            if (ext == null)
            {
                return;
            }
            if (ext.IsTimerOnQueue)
            {
                ext.ForceUpdate();
            }
            if (ext == null || ext.Markers.Count == 0)
            {
                return;
            }

            var caretOffset = doc.Editor.CaretOffset;

            for (int i = 0; i < ext.Markers.Count; i++)
            {
                if (ext.Markers [i].Contains(caretOffset))
                {
                    MoveToNextUsageHandler.MoveToSegment(doc, ext.Markers [(i + 1) % ext.Markers.Count]);
                }
            }
        }
        protected override void Run()
        {
            MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
            HighlightUsagesExtension     ext = GetHighlightUsageExtension(doc);

            if (ext == null)
            {
                return;
            }
            if (ext.IsTimerOnQueue)
            {
                ext.ForceUpdate();
            }
            if (ext.Markers.Count == 0)
            {
                return;
            }


            if (ext.Markers.ContainsKey(doc.Editor.Caret.Line))
            {
                var      marker  = ext.Markers[doc.Editor.Caret.Line];
                ISegment segment = null;
                for (int i = 0; i < marker.Usages.Count; i++)
                {
                    if (marker.Usages[i].EndOffset < doc.Editor.Caret.Offset)
                    {
                        segment = marker.Usages[i];
                    }
                }
                if (segment != null)
                {
                    MoveToNextUsageHandler.MoveToSegment(doc, segment);
                    return;
                }
            }

            int max = int.MinValue;

            foreach (var pair in ext.Markers)
            {
                if (pair.Key > max && pair.Key < doc.Editor.Caret.Line)
                {
                    max = pair.Key;
                }
            }
            if (max >= 0)
            {
                MoveToNextUsageHandler.MoveToSegment(doc, ext.Markers[max].Usages.Last());
                return;
            }
            MoveToNextUsageHandler.MoveToSegment(doc, ext.Markers.Last().Value.Usages.Last());
        }