private void ShowRelevantSuggestionMenu(MouseEventArgs e) { if (SelectionLength > 0) { SmartContextMenu menu = GetSuggestionMenu(null); menu.Show(this, e.Location); } else { if (ActiveScope != null) { SmartContextMenu menu = GetSuggestionMenu(ActiveScope); menu.ShowForScope(this, e.Location); } } }
private SmartContextMenu GetSuggestionMenu(Scope target) { ActionHelper.Txt = this; ActionHelper.SetSuggestionProvider(new UIActionSuggestionProvider(this)); ScopeActionsInfo actions = ActionHelper.GetActions(target); SmartContextMenu menu = new SmartContextMenu(target, this); AddActionsToMenu(menu, actions.UserActions); if (actions.UserActions.Count > 0) { menu.MenuItems.Add(new MenuItem("-")); } AddActionsToMenu(menu, actions.RuleSuggestions); return(menu); }