public void OnSelectionChange(object sender, DeclarationChangedEventArgs e) { var caption = e.ActivePane != null ? _formatter.Format(e.ActivePane, e.Declaration) : _formatter.Format(e.Declaration, e.MultipleControlsSelected); if (string.IsNullOrEmpty(caption) && e.VBComponent != null) { //Fallback caption for selections in the Project window. caption = string.Format("{0}.{1} ({2})", e.VBComponent.ParentProject.Name, e.VBComponent.Name, e.VBComponent.Type); } var refCount = e.Declaration == null ? 0 : e.Declaration.References.Count(); SetContextSelectionCaption(caption, refCount); EvaluateCanExecute(_parser.State, e.Declaration); }
private void OnSelectionChange(object sender, DeclarationChangedEventArgs e) { var caption = e.ActivePane != null ? _formatter.Format(e.ActivePane, e.Declaration) : _formatter.Format(e.Declaration, e.MultipleControlsSelected); if (string.IsNullOrEmpty(caption) && e.VBComponent != null) { //Fallback caption for selections in the Project window. caption = $"{e.VBComponent.ParentProject.Name}.{e.VBComponent.Name} ({e.VBComponent.Type})"; } var refCount = e.Declaration?.References.Count() ?? 0; var description = e.Declaration?.DescriptionString ?? string.Empty; SetContextSelectionCaption(caption, refCount, description); EvaluateCanExecute(_parser.State, e.Declaration); }
private void OnSelectionChange(object sender, DeclarationChangedEventArgs e) { var caption = _formatter.Format(e.Declaration, e.MultipleControlsSelected); if (string.IsNullOrEmpty(caption)) { //Fallback caption for selections in the Project window. caption = e.FallbackCaption; } var refCount = e.Declaration?.References.Count() ?? 0; var description = e.Declaration?.DescriptionString ?? string.Empty; //& renders the next character as if it was an accelerator. SetContextSelectionCaption(caption?.Replace("&", "&&"), refCount, description); EvaluateCanExecute(_parser.State, e.Declaration); }