protected override NodeResultBuilder GetValue() { var builder = new NodeResultBuilder(Input.Value); if (Input.ConnectedNode is OrNode || Input.ConnectedNode is IntegerNode ) { builder.StripNonCaptureGroup(); } string prefix = InputGroupType.Value switch { GroupTypes.capturing => "(", GroupTypes.nonCapturing => "(?:", GroupTypes.named => $"(?<{GroupName.GetValue()}>", GroupTypes.atomic => $"(?>", GroupTypes.custom => "(" + CustomPrefix.GetValue(), _ => "", }; builder.Prepend(prefix, this); builder.Append(")", this); return(builder); }
private async void GroupByHandler(object sender, EventArgs eventArgs) { if (eventArgs == EventArgs.Empty) { return; } var args = eventArgs as OleMenuCmdEventArgs; if (args == null) { return; } string newChoice = args.InValue as string; IntPtr vOut = args.OutValue; if (vOut != IntPtr.Zero && newChoice != null) { throw new ArgumentException("Both in and out parameters can't be null!"); } if (vOut != IntPtr.Zero) { // Set combo value. Marshal.GetNativeVariantForObject(selectedGrouping, vOut); } else if (newChoice != null && newChoice != selectedGrouping) { selectedGrouping = newChoice; try { await _rootViewModel.TreeViewModel.SetGroupingAsync(GroupName.GetValue(selectedGrouping)); } catch (Exception ex) { await UIHelper.ShowErrorAsync(_package, ex.Message); } } }
private async void Refresh(object sender, EventArgs arguments) { try { var discoverer = new WorkspaceBenchmarkDiscoverer(Workspace); _rootViewModel.TreeViewModel.IsLoading = true; await discoverer.InitializeAsync(); _expandAllCommand.Enabled = true; _collapseAllCommand.Enabled = true; await _rootViewModel.TreeViewModel.RefreshAsync(discoverer, GroupName.GetValue(selectedGrouping)); _runCommand.Enabled = _rootViewModel.TreeViewModel.IsFinished; _runDryCommand.Enabled = _rootViewModel.TreeViewModel.IsFinished; _groupByCommand.Enabled = _rootViewModel.TreeViewModel.IsFinished; } catch (Exception ex) { await UIHelper.ShowErrorAsync(_package, ex.Message); } }
protected override string GetValue() { string input = Input.GetValue().RemoveNonCapturingGroup(); string prefix = ""; switch (InputGroupType.DropdownValue) { case "Capturing": prefix = "("; break; case "Non-capturing": prefix = "(?:"; break; case "Named": prefix = $"(?<{GroupName.GetValue()}>"; break; case "Custom": prefix = "(" + CustomPrefix.GetValue(); break; } ; //string prefix = (InputGroupType.Value == "Capturing") ? "(" : "(?:"; //if (input.StartsWith("(?:") && input.EndsWith(")")) //{ // return UpdateCache(prefix + input.Substring(3)); //} return(UpdateCache($"{prefix}{input})")); }