private void FillContextPopupChoices(Syncfusion.Windows.Forms.Edit.ContextChoicePopupEventArgs e) { if (NamedGroupsMode) { return; } InitContextChoices(e); try { foreach (QuickMenu.MenuItemRow row in AppContext.Instance.Settings.QuickMenuData.MenuItem) { if (row.IsvalueNull() || !row.value.StartsWith(e.ContextChoiceChar)) { continue; } string suggestion = row.value; string description = row.name; string toAdd = suggestion + " : " + description; e.Choices.Add(toAdd); e.ImageIndexes.Add(IMG_REGEX_INTELLISENSE); } if (e.Choices.Count == 0) { e.Choices = null; } } catch (Exception ex) { e.Choices.Add("Error adding coices..."); e.ImageIndexes.Add(IMG_ERROR); } }
private void InitContextChoices(Syncfusion.Windows.Forms.Edit.ContextChoicePopupEventArgs e) { e.ItemFont = new Font("Tahoma", 8, FontStyle.Bold); e.Choices = new ArrayList(); e.ImageIndexes = new ArrayList(); e.ItemImageList = imgLst; }
private void FillNamedGroups(Syncfusion.Windows.Forms.Edit.ContextChoicePopupEventArgs e) { InitContextChoices(e); try { string pattern = "\\(\\?<(?<GroupName>.*?)>"; string regex = AppContext.Instance.ActiveProject.Regex; RegexOptions options = RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline | RegexOptions.IgnoreCase; MatchCollection matches = Regex.Matches(regex, pattern, options); foreach (Match match in matches) { string groupName = match.Groups["GroupName"].Value; if (groupName != null && groupName.Trim() != string.Empty) { e.Choices.Add("{" + groupName + "}"); e.ImageIndexes.Add(IMG_NAMED_GROUP); } } if (e.Choices.Count == 0) { e.Choices.Add("No groups found..."); e.ImageIndexes.Add(IMG_NOT_FOUND); } } catch (Exception ex) { e.Choices.Add("Error parsing for group names..."); e.ImageIndexes.Add(IMG_ERROR); } }
private void txtRegex_ContextChoicePopup(object sender, Syncfusion.Windows.Forms.Edit.ContextChoicePopupEventArgs e) { if (!m_booIntellisenseEnabled) { return; } _IsPopupContextActive = true; InitContextChoices(e); try { if (NamedGroupsMode) { FillNamedGroups(e); } else { FillContextPopupChoices(e); } } catch (Exception) { } }