Example #1
0
        public CopyFqnProvidersOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext) : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddText("\"Copy Fully-qualified name/ Source browser URI to Clipboard\" will be extended by the following entries.");

            AddSpacer();

            AddBoolOption((CopyFqnProvidersSettings s) => s.EnableShortNames, "Short names");

            AddSpacer();

            AddText("URL templates:");

            // Use BeControls.GetTextControl() + manual Bind() instead of GetBeTextBox() to support multi-line
            // editing (no handling of the "Enter" key). Just like the `ReSpellerSettingsPage`.

            var textControl = BeControls.GetTextControl(isReadonly: false);

            OptionsSettingsSmartContext
            .GetValueProperty(Lifetime, (CopyFqnProvidersSettings s) => s.UrlTemplates)
            .Bind(Lifetime, textControl.Text);

            AddControl(textControl);
        }
Example #2
0
        private void CreateRichTextExceptionTypesAsHint(Lifetime lifetime, IContextBoundSettingsStoreLive storeOptionsTransactionContext)
        {
            IProperty <string> property = new Property <string>(lifetime, "Exceptional::ExceptionTypesAsHint::ExceptionTypes");

            property.SetValue(storeOptionsTransactionContext.GetValue((Settings.ExceptionalSettings key) => key.OptionalExceptions2));

            property.Change.Advise(lifetime, a =>
            {
                if (!a.HasNew)
                {
                    return;
                }

                storeOptionsTransactionContext.SetValue((Settings.ExceptionalSettings key) => key.OptionalExceptions2, a.New);
            });

            var textControl = BeControls.GetTextControl(isReadonly: false);

            textControl.Text.SetValue(property.GetValue());
            textControl.Text.Change.Advise(lifetime, str =>
            {
                storeOptionsTransactionContext.SetValue((Settings.ExceptionalSettings key) => key.OptionalExceptions2, str);
            });

            AddControl(textControl);
        }
Example #3
0
        public AdditionalFileLayoutOptionsPage(Lifetime lifetime, OptionsPageContext optionsPageContext,
                                               OptionsSettingsSmartContext optionsSettingsSmartContext,
                                               RiderDialogHost dialogHost)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            var fileLayoutSettings = new AdditionalFileLayoutSettingsHelper(lifetime, optionsSettingsSmartContext, dialogHost);
            var textControl        = BeControls.GetLanguageTextControl(fileLayoutSettings.Text, lifetime, false, myFileLayoutLanguage, DummyFileName, true);
            var toolbar            = BeControls.GetToolbar(textControl);

            var emptyPatternItem = BeControls.GetButton("Empty", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.Empty));
            var defaultPatternWithoutRegionsItem = BeControls.GetButton("Default", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.WithoutRegions));
            var defaultPatternWithRegionsItem    = BeControls.GetButton("Default with regions", lifetime, () => fileLayoutSettings.LoadDefaultPattern(DefaultPatternKind.WithRegions));

            toolbar.AddItem("Load patterns:".GetBeLabel());
            toolbar.AddItem(emptyPatternItem);
            toolbar.AddItem(defaultPatternWithoutRegionsItem);
            toolbar.AddItem(defaultPatternWithRegionsItem);

            var grid = BeControls.GetGrid();

            grid.AddElement(toolbar, BeSizingType.Fill);

            var margin = BeMargins.Create(5, 1, 5, 1);

            AddControl(grid.WithMargin(margin), true);

            AddKeyword("File Layout");
        }
        public ReSharperHelpersOptionsPage(Lifetime lifetime, [NotNull] OptionsPageContext optionsPageContext, [NotNull] OptionsSettingsSmartContext settingsSmart) :
            base(lifetime, optionsPageContext, settingsSmart)
        {
            this.AddControl(
                BeControls
                .GetGrid(
                    GridOrientation.Vertical,
                    (BeControls.GetSpacer(), BeSizingType.Fit),
                    (BeControls.GetRichText("It's recommended to save project specific settings to .editorconfig file instead of configuring them here."), BeSizingType.Fit),
                    (BeControls.GetLinkButton("Read documentation", lifetime, () => Process.Start("https://github.com/zvirja/ReSharperHelpers#editor-config")), BeSizingType.Fit),
                    (BeControls.GetSpacer(), BeSizingType.Fit)
                    )
                .WithColor(Color.LightYellow)
                .InGroupBox("⚠ Use Editor Config")
                );
            this.AddSpacer();

            var projectNameProperty = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.TestsProjectName);

            this.AddHeader("Test project name [deprecated, use .editorconfig]");
            this.AddControl(projectNameProperty.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .AppendLine("This setting is used to explicitly specify single project in solution where all unit tests are located.")
                             .Append("The setting has less priority than ")
                             .Append("[assembly: AssemblyMetadata(\"ReSharperHelpers.TestProject\", \"<name>\")]) ", new TextStyle(FontStyle.Italic))
                             .Append("project attribute.", TextStyle.Default).AppendLine()
                             .Append("Save it to .editorconfig file instead", new TextStyle(FontStyle.Bold)).AppendLine()
                             );
            this.AddSpacer();

            var testClassNameSuffix = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.TestClassNameSuffix);

            this.AddHeader("New test class name suffix");
            this.AddControl(testClassNameSuffix.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .AppendLine("This setting specifies test class name suffix that should be used for the new tests.")
                             .Append("Consider saving this setting to .editorconfig file or solution specific layer.", new TextStyle(FontStyle.Italic)));

            this.AddSpacer();

            var validTestClassNameSuffixes = settingsSmart.GetValueProperty(lifetime, (ReSharperHelperSettings settings) => settings.ValidTestClassNameSuffixes);

            this.AddHeader("Existing test class name suffixes");
            this.AddControl(validTestClassNameSuffixes.GetBeTextBox(lifetime));
            this.AddRichText(new RichText()
                             .AppendLine("This setting defines additional test suffixes valid for discovering the existing test classes.")
                             .AppendLine("Suffixes should be delimited by comma (e.g. value1,value2).")
                             .Append("Consider saving this setting to .editorconfig file or solution specific layer.", new TextStyle(FontStyle.Italic)));
        }
Example #5
0
        private BeControl AddListControl <TKeyClass>(Expression <Func <TKeyClass, string> > lambdaExpression,
                                                     string[] defaults, string description)
        {
            var property = new Property <string>(description);

            OptionsSettingsSmartContext.SetBinding(Lifetime, lambdaExpression, property);
            if (string.IsNullOrEmpty(property.Value))
            {
                property.Value = string.Join("\n", defaults);
            }

            var model = new StringListViewModel(Lifetime, property);

            var list = model.SelectedEntry.GetBeSingleSelectionListWithToolbar(
                model.Entries,
                Lifetime,
                (entryLt, entry, properties) => new List <BeControl>
            {
                entry.Value.GetBeTextBox(entryLt)
                .WithValidationRule <BeTextBox, string>(
                    Lifetime,
                    value => !value.IsEmpty(),
                    "Value must not be empty.")
            },
                iconHost: _iconHost,
                columnsAndSizes: new[] { "Value,*" },
                dock: BeDock.RIGHT)
                       .AddButtonWithListAction(BeListAddAction.ADD, i => model.CreateNewEntry())
                       .AddButtonWithListAction <StringListViewModel.StringListEntry>(BeListAction.REMOVE, i => model.OnEntryRemoved())
                       .AddButtonWithListAction <StringListViewModel.StringListEntry>(BeListAction.MOVE_UP, i => model.OnEntryMoved())
                       .AddButtonWithListAction <StringListViewModel.StringListEntry>(BeListAction.MOVE_DOWN, i => model.OnEntryMoved());

            var grid  = BeControls.GetGrid();
            var label = description.GetBeLabel();

            grid.AddElement(label);
            grid.AddElement(list);
            AddKeyword(description);

            AddControl(grid.WithMargin(BeMargins.Create(SideMargin, TopMargin, SideMargin)));

            return(list);
        }
        public TodoItemsCountOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext) : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddBoolOption((TodoItemsCountSettings s) => s.IsEnabled, "Enabled");

            AddText("Definitions:");

            // Use BeControls.GetTextControl() + manual Bind() instead of GetBeTextBox() to support multi-line
            // editing (no handling of the "Enter" key). Just like the `ReSpellerSettingsPage`.

            var textControl = BeControls.GetTextControl(isReadonly: false);

            OptionsSettingsSmartContext
            .GetValueProperty(Lifetime, (TodoItemsCountSettings s) => s.Definitions)
            .Bind(Lifetime, textControl.Text);

            AddBinding(textControl, BindingStyle.IsEnabledProperty, (TodoItemsCountSettings s) => s.IsEnabled, x => x);

            AddControl(textControl);
            AddText("Syntax: <To-do title>[<Optional text-matching used to filter the counted items>]");
        }
Example #7
0
 public override BeControl GetPageContent()
 {
     return(BeControls.GetRichText(
                "Please ensure the project is saved in the Unity Editor, or any changes will be lost.", true));
 }
 public override BeControl GetPageContent()
 {
     return(BeControls.GetRichText(GetText(), wrap: true));
 }