/// <summary> /// Closes UI down. /// <paramref name="apply">Whether to apply or process the selection or not.</paramref> /// </summary> public override void OnClose(bool apply) { _optionsService.SetStringOption(this.Feature, "File", this.FileName); _optionsService.SetStringOption(this.Feature, "Search", _search); _optionsService.SetIntOption(this.Feature, "Filter", (int)this.Filter); if (!apply) { return; } if (this.Selection == null) { return; } var member = this.Selection as MemberCodeModel; if (member == null) { return; } _shellSelectionService.SetActiveFilePosition(member.Line, 1); }
/// <summary> /// Navigates to current file bookmark. /// </summary> /// <param name="number">Bookmark number.</param> /// <returns>Whether bookmark's been navigated to or not.</returns> public bool GoToBookmark(int number) { if ((number < 1) || (number > 10)) { throw new ArgumentOutOfRangeException(nameof(number)); } var fileName = _shellSelectionService.GetActiveFileName(); if (string.IsNullOrEmpty(fileName)) { return(false); } if (!_bookmarks.ContainsKey(fileName)) { _shellStatusBarService.SetStatusBarText($"Bookmark {number} not found"); _log.LogMessage($"Bookmark # {number} is not found", LOG_CATEGORY); return(false); } _log.LogMessage($"Looking for '{fileName}' bookmark # {number}", LOG_CATEGORY); var bookmarks = _bookmarks[fileName]; var bookmark = bookmarks.FirstOrDefault(b => (b.Number == number) && (b.Type == BookmarkType.Local)); if (bookmark != null) { if (_shellSelectionService.SetActiveFilePosition(GetBookmarkLine(fileName, bookmark), bookmark.Column)) { _shellStatusBarService.SetStatusBarText($"Bookmark {number}"); _log.LogMessage($"Go to bookmark # {number}", LOG_CATEGORY); return(true); } else { _shellStatusBarService.SetStatusBarText($"Bookmark {number} line is invalid"); _log.LogMessage($"Bookmark # {number} line is invalid", LOG_CATEGORY); return(false); } } else { _shellStatusBarService.SetStatusBarText($"Bookmark {number} not found"); _log.LogMessage($"Bookmark # {number} is not found", LOG_CATEGORY); return(false); } }