public UsageModelOptionsControl(Lifetime lifetime,
                                        OptionsSettingsSmartContext ctx,
                                        KaVEISettingsStore settingsStore,
                                        IActionExecutor actionExecutor,
                                        DataContexts dataContexts,
                                        IMessageBoxCreator messageBoxCreator)
        {
            _messageBoxCreator = messageBoxCreator;
            _lifetime          = lifetime;
            _settingsStore     = settingsStore;
            _actionExecutor    = actionExecutor;
            _dataContexts      = dataContexts;
            InitializeComponent();

            _modelStoreSettings = settingsStore.GetSettings <ModelStoreSettings>();

            DataContext = new UsageModelOptionsViewModel
            {
                ModelStoreSettings = _modelStoreSettings
            };

            if (ctx != null)
            {
                // Binding to ModelStorePath
                ctx.SetBinding(
                    lifetime,
                    (ModelStoreSettings s) => s.ModelStorePath,
                    ModelStorePathTextBox,
                    TextBox.TextProperty);
            }
        }
    public UseIntMaxValueOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settings)
      : base(lifetime, Pid)
    {
      if (lifetime == null) throw new ArgumentNullException("lifetime");

      Control = InitView(lifetime, settings);
    }
Ejemplo n.º 3
0
        public ZenCodingOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext settings, IThreading threading, IThemedIconManager iconManager)
        {
            myLifetime         = lifetime;
            mySettings         = settings;
            myThreading        = threading;
            myIconManager      = iconManager;
            myLambdaExpression = s => s.FileAssociations;

            InitializeComponent();

            myFileAssociations = new SortedDictionary <int, FileAssociation>();
            foreach (var pair in mySettings.EnumerateIndexedEntry(myLambdaExpression))
            {
                myFileAssociations[pair.First] = pair.Second;
            }

            var model = BuildModel();

            myView = new FileAssociationsTreeView(model, new FileAssociationViewController())
            {
                Presenter = new FileAssociationPresenter(),
                Dock      = DockStyle.Fill
            };
            myView.DoubleClick += EditFileAssociation;
            myRules.Controls.Add(myView);

            _buttons.Items.Add("Create", myIconManager.Icons[ZenCodingCommonThemedIcons.Add.Id].CurrentGdipBitmap96, CreateFileAssociation);
            _buttons.Items.Add("Edit", myIconManager.Icons[CommonThemedIcons.Edit.Id].CurrentGdipBitmap96, EditFileAssociation);
            _buttons.Items.Add("Remove", myIconManager.Icons[CommonThemedIcons.Remove.Id].CurrentGdipBitmap96, RemoveFileAssociation);
            _buttons.Items.Add("Up", myIconManager.Icons[CommonThemedIcons.Up.Id].CurrentGdipBitmap96, MoveUp);
            _buttons.Items.Add("Down", myIconManager.Icons[CommonThemedIcons.Down.Id].CurrentGdipBitmap96, MoveDown);
        }
Ejemplo n.º 4
0
 public MockMetricsOptionPage(Lifetime lifetime, UIApplication environment, OptionsSettingsSmartContext settings)
     : base(lifetime, environment, PID)
 {
     myLifetime = lifetime;
     mySettings = settings;
     InitControls();
 }
Ejemplo n.º 5
0
        public PrimaryOptionsControl([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            _settings = settings;

            InitializeComponent();

            groupBoxUserDictionary.Text = ResourceAccessor.GetString("UI_UserDictionaryListTitle")
                                          ?? "User Dictionary";
            groupBoxIgnoredWords.Text = ResourceAccessor.GetString("UI_IgnoredWordListTitle")
                                        ?? "Ignored Words";

            // Extract the string keys from the settings and apply them to the UI list boxes.
            UserWords.Initialize(
                settings.EnumEntryIndices <SpellCheckSettings, string, byte>(x => x.UserEntries)
                .ToArray()
                );

            IgnoreWords.Initialize(
                settings.EnumEntryIndices <SpellCheckSettings, string, byte>(x => x.IgnoreEntries)
                .ToArray()
                );

            // Monitor the changed properties on the UI list boxes and when changed apply the modifications to the settings collection to be saved.

            var userWordsProperty = WinFormsProperty.Create(lifetime, UserWords, x => x.CurrentItems, true);

            userWordsProperty.Change.Advise_NoAcknowledgement(lifetime, x => ApplyChanges(settings, UserWords, p => p.UserEntries));

            var ignoreWordsProperty = WinFormsProperty.Create(lifetime, IgnoreWords, x => x.CurrentItems, true);

            ignoreWordsProperty.Change.Advise_NoAcknowledgement(lifetime, x => ApplyChanges(settings, IgnoreWords, p => p.IgnoreEntries));

            ResetDictionariesGrid(settings);
        }
Ejemplo n.º 6
0
        public UnityOptionsPage(
            Lifetime lifetime,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            RunsProducts.ProductConfigurations productConfigurations)
            : base(lifetime, optionsSettingsSmartContext)
        {
            Header("General");

            CheckBox((UnitySettings s) => s.InstallUnity3DRiderPlugin, "Install or update Rider plugin automatically");

            Header("ShaderLab");

            CheckBox((UnitySettings s) => s.EnableShaderLabHippieCompletion, "Enable simple word-based completion in ShaderLab files");
            AddEmptyLine();

            CheckBox((UnitySettings s) => s.EnableShaderLabParsing,
                     "Parse ShaderLab files for syntax errors");

            AddEmptyLine();
            AddText("Disable this to avoid incorrect syntax error highlighting in .shader files.");
            AddText("The solution must be reopened when changed.");
            AddEmptyLine();
            AddText("Note that CGPROGRAM blocks are not currently checked for syntax errors.");

            if (productConfigurations.IsInternalMode())
            {
                CheckBox((UnitySettings s) => s.EnableCgErrorHighlighting, "Parse Cg files for syntax errors. Only works in internal mode.");
                AddText("Requires solution reopen, same as ShaderLab settings.");
            }

            FinishPage();
        }
Ejemplo n.º 7
0
        public UnityOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext settingsStore,
                                RunsProducts.ProductConfigurations productConfigurations)
            : base(lifetime, settingsStore)
        {
            Header("General");

            CheckBox((UnitySettings s) => s.InstallUnity3DRiderPlugin, "Install or update Rider plugin automatically");
            CheckBox((UnitySettings s) => s.AllowAutomaticRefreshInUnity, "Automatically refresh Assets in Unity");

            AddNamingSection(lifetime, settingsStore);

            Header("ShaderLab");

            CheckBox((UnitySettings s) => s.EnableShaderLabHippieCompletion,
                     "Enable simple word-based completion in ShaderLab files");

            if (productConfigurations.IsInternalMode())
            {
                AddEmptyLine();
                CheckBox((UnitySettings s) => s.EnableCgErrorHighlighting,
                         "Parse Cg files for syntax errors. Only works in internal mode.");
                AddText("Requires solution reopen.");
            }

            Header("C# code analysis");
            CheckBox((UnitySettings s) => s.EnablePerformanceCriticalCodeHighlighting,
                     "Enable highlighting of costly methods and indirect calls for these methods in performance critical code sections");

            FinishPage();
        }
Ejemplo n.º 8
0
        public ComplexityAnalysisOptionPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext,
                                            ILanguages languages, ILanguageManager languageManager)
            : base(lifetime, optionsSettingsSmartContext)
        {
            AddText("Specify cyclomatic complexity thresholds:");

            var thresholds = OptionsSettingsSmartContext.Schema.GetIndexedEntry((CyclomaticComplexityAnalysisSettings s) => s.Thresholds);

            var list = new List <LanguageSpecificComplexityProperties>();

            foreach (var languageType in languages.All.Where(languageManager.HasService <IControlFlowBuilder>).OrderBy(GetPresentableName))
            {
                var presentableName = GetPresentableName(languageType);
                var thing           = new LanguageSpecificComplexityProperties(lifetime, optionsSettingsSmartContext, thresholds, languageType.Name, presentableName, CyclomaticComplexityAnalysisSettings.DefaultThreshold);
                list.Add(thing);
            }

            // TODO: Do we want to add any keywords for the list view?
            // We would use OptionEntities.Add if the view model also implements IOptionEntity,
            // or use RegisterWord if we just want to add keyword(s)
            // (But the list view is just language name + threshold, so not very interesting)
            AddCustomOption(new ComplexityAnalysisOptionsViewModel(list));
            OptionEntities.Add(new HyperlinkOptionViewModel(lifetime, "What is a good threshold value?",
                                                            new DelegateCommand(() => Process.Start("https://github.com/JetBrains/resharper-cyclomatic-complexity/blob/master/docs/ThresholdGuidance.md#readme"))));
            FinishPage();
        }
Ejemplo n.º 9
0
        public RsDocOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsSettingsSmartContext)
        {
            // output path
              IProperty<FileSystemPath> outputPath = new Property<FileSystemPath>(lifetime, "RsDocOptionsPage::OutputPath");
              outputPath.SetValue(FileSystemPath.TryParse(optionsSettingsSmartContext.StoreOptionsTransactionContext.GetValue((RsDocSettingsKey key) => key.RsDocOutputFolder)));
              outputPath.Change.Advise(lifetime, a =>
              {
            if (!a.HasNew || a.New == null) return;
            optionsSettingsSmartContext.StoreOptionsTransactionContext.SetValue((RsDocSettingsKey key) => key.RsDocOutputFolder, a.New.FullPath);
              });
              AddText("Output folder for generated content:");
              var outputPathOption = AddFolderChooserOption(outputPath, null, null);
              outputPathOption.IsEnabledProperty.SetValue(true);

              // folder with samples for context actions
              IProperty<FileSystemPath> caFolder = new Property<FileSystemPath>(lifetime, "RsDocOptionsPage::CaFolder");
              caFolder.SetValue(FileSystemPath.TryParse(optionsSettingsSmartContext.StoreOptionsTransactionContext.GetValue((RsDocSettingsKey key) => key.RsDocCaFolder)));
              caFolder.Change.Advise(lifetime, a =>
              {
            if (!a.HasNew || a.New == null) return;
            optionsSettingsSmartContext.StoreOptionsTransactionContext.SetValue((RsDocSettingsKey key) => key.RsDocCaFolder, a.New.FullPath);
              });
              AddText("Folder with context actions samples:");
              var caFoolderOption = AddFolderChooserOption(caFolder, null, null);
              caFoolderOption.IsEnabledProperty.SetValue(true);
        }
Ejemplo n.º 10
0
        public ReSharperOptionsPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext settingsStore,
                                    RunsProducts.ProductConfigurations productConfigurations)
            : base(lifetime, settingsStore)
        {
            Header("General");

            CheckBox((UnitySettings s) => s.IsYamlParsingEnabled,
                     "Parse text based asset files for implicit script usages");

            Header("C#");
            CheckBox((UnitySettings s) => s.EnablePerformanceCriticalCodeHighlighting,
                     "Highlight expensive method calls in frequently called code");

            // The default is when code vision is disabled. Let's keep this so that if/when ReSharper ever gets Code
            // Vision, we'll show the items, or if the user installs Rider, the copied settings will still be useful
            AddBoolOption((UnitySettings s) => s.GutterIconMode,
                          GutterIconMode.CodeInsightDisabled, GutterIconMode.None,
                          "Show gutter icons for implicit script usages:");

            if (productConfigurations.IsInternalMode())
            {
                Header("Internal");

                CheckBox((UnitySettings s) => s.EnableCgErrorHighlighting,
                         "Parse Cg files for syntax errors (requires internal mode, and re-opening solution)");
            }

            FinishPage();
        }
 public MockMetricsOptionPage(Lifetime lifetime, UIApplication environment, OptionsSettingsSmartContext settings)
     : base(lifetime, environment, PID)
 {
     myLifetime = lifetime;
     mySettings = settings;
     InitControls();
 }
        public GeneralOptionsControl(Lifetime lifetime,
                                     OptionsSettingsSmartContext ctx,
                                     IActionExecutor actionExecutor,
                                     KaVEISettingsStore settingsStore,
                                     DataContexts dataContexts,
                                     IMessageBoxCreator messageBoxCreator)
        {
            _messageBoxCreator = messageBoxCreator;
            _lifetime          = lifetime;
            _ctx            = ctx;
            _actionExecutor = actionExecutor;
            _settingsStore  = settingsStore;
            _dataContexts   = dataContexts;

            InitializeComponent();

            _exportSettings = settingsStore.GetSettings <ExportSettings>();

            DataContext = new GeneralOptionsViewModel
            {
                ExportSettings = _exportSettings
            };

            if (_ctx != null)
            {
                BindToGeneralChanges();
            }
        }
 /// <summary>
 /// Creates new instance of ComplexityAnalysisOptionPage
 /// </summary>
 public ComplexityAnalysisOptionPage(Lifetime lifetime, UIApplication environment, OptionsSettingsSmartContext settings)
     : base(lifetime, environment, PID)
 {
     myLifetime = lifetime;
     mySettings = settings;
     InitControls();
 }
        public PostfixOptionsViewModel([NotNull] Lifetime lifetime,
                                   [NotNull] OptionsSettingsSmartContext settings,
                                   [NotNull] PostfixTemplatesManager templatesManager)
        {
            mySettingsStore = settings;
              myTemplatesManager = templatesManager;
              Templates = new ObservableCollection<PostfixTemplateViewModel>();

              ShowPostfixTemplates = new Property<bool>(lifetime, "ShowPostfixTemplates");
              ShowStaticMembers = new Property<bool>(lifetime, "ShowStaticMembers");
              ShowEnumHelpers = new Property<bool>(lifetime, "ShowEnumHelpers");
              ShowLengthCountItems = new Property<bool>(lifetime, "ShowLengthCountItems");
              UseBracesForStatements = new Property<bool>(lifetime, "UseBracesForStatements");
              InvokeParameterInfo = new Property<bool>(lifetime, "InvokeParameterInfo");
              SearchVarOccurrences = new Property<bool>(lifetime, "SearchVarOccurrences");

              Reset = new DelegateCommand(ResetExecute);

              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowPostfixItems, ShowPostfixTemplates);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowStaticMethods, ShowStaticMembers);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowEnumHelpers, ShowEnumHelpers);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.BracesForStatements, UseBracesForStatements);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.InvokeParameterInfo, InvokeParameterInfo);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowLengthCountItems, ShowLengthCountItems);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.SearchVarOccurrences, SearchVarOccurrences);

              FillTemplates();
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Creates new instance of ComplexityAnalysisOptionPage
 /// </summary>
 public ComplexityAnalysisOptionPage(Lifetime lifetime, FontsManager fontsManager, OptionsSettingsSmartContext settings)
     : base(lifetime, fontsManager, PID)
 {
     myLifetime = lifetime;
     mySettings = settings;
     InitControls();
 }
Ejemplo n.º 16
0
        public AsyncConverterConfigureAwaitPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext store,
                                                IPromptWinForm promptWinForms)
            : base(lifetime, store)
        {
            AddHeader("In class and method will be ignored ConfigureAwait suggestion");
            var editItemViewModelFactory = new DefaultCollectionEditItemViewModelFactory(null);
            var buttonProviderFactory    = new DefaultButtonProviderFactory(lifetime, promptWinForms, editItemViewModelFactory);
            var attributeTypes           = new StringCollectionEditViewModel(lifetime, "Attributes:",
                                                                             buttonProviderFactory, editItemViewModelFactory);

            foreach (var type in store.EnumIndexedValues(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes))
            {
                attributeTypes.AddItem(type);
            }

            attributeTypes.Items.CollectionChanged += (o, e) =>
            {
                foreach (
                    var entryIndex in
                    OptionsSettingsSmartContext.EnumEntryIndices(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes)
                    .ToArray())
                {
                    OptionsSettingsSmartContext.RemoveIndexedValue(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes,
                                                                   entryIndex);
                }
                foreach (
                    var editItemViewModel in
                    attributeTypes.Items)
                {
                    OptionsSettingsSmartContext.SetIndexedValue(AsyncConverterSettingsAccessor.ConfigureAwaitIgnoreAttributeTypes,
                                                                editItemViewModel.PresentableName, editItemViewModel.PresentableName);
                }
            };
            AddCustomOption(attributeTypes);
        }
Ejemplo n.º 17
0
        public AnonymizationOptionsControl(Lifetime lifetime,
                                           OptionsSettingsSmartContext ctx,
                                           KaVEISettingsStore settingsStore,
                                           IActionExecutor actionExecutor,
                                           DataContexts dataContexts,
                                           IMessageBoxCreator messageBoxCreator)
        {
            _lifetime       = lifetime;
            _ctx            = ctx;
            _settingsStore  = settingsStore;
            _actionExecutor = actionExecutor;
            _dataContexts   = dataContexts;

            InitializeComponent();

            _anonymizationSettings = settingsStore.GetSettings <AnonymizationSettings>();

            var anonymizationContext = new AnonymizationContext(_anonymizationSettings);

            DataContext = anonymizationContext;

            if (_ctx != null)
            {
                BindChangesToAnonymization();
            }

            _messageBoxCreator = messageBoxCreator;
        }
 /// <summary>
 /// Creates new instance of ComplexityAnalysisOptionPage
 /// </summary>
 public ComplexityAnalysisOptionPage(Lifetime lifetime, FontsManager fontsManager, OptionsSettingsSmartContext settings)
   : base(lifetime, fontsManager, PID)
 {
   myLifetime = lifetime;
   mySettings = settings;
   InitControls();
 }
Ejemplo n.º 19
0
 public PostfixOptionsPage([NotNull] Lifetime lifetime,
                           [NotNull] OptionsSettingsSmartContext store)
 {
     InitializeComponent();
     DataContext = new ContractExtensionsOptionsViewModel(lifetime, store);
     Control     = this;
 }
    public ZenCodingOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext settings, IThreading threading, IThemedIconManager iconManager)
    {
      myLifetime = lifetime;
      mySettings = settings;
      myThreading = threading;
      myIconManager = iconManager;
      myLambdaExpression = s => s.FileAssociations;

      InitializeComponent();

      myFileAssociations = new SortedDictionary<int, FileAssociation>();
      foreach (var pair in mySettings.EnumerateIndexedEntry(myLambdaExpression))
      {
        myFileAssociations[pair.First] = pair.Second;
      }

      var model = BuildModel();

      myView = new FileAssociationsTreeView(model, new FileAssociationViewController())
      {
        Presenter = new FileAssociationPresenter(),
        Dock = DockStyle.Fill
      };
      myView.DoubleClick += EditFileAssociation;
      myRules.Controls.Add(myView);

      _buttons.Items.Add("Create", myIconManager.Icons[ZenCodingCommonThemedIcons.Add.Id].CurrentGdipBitmap96, CreateFileAssociation);
      _buttons.Items.Add("Edit", myIconManager.Icons[CommonThemedIcons.Edit.Id].CurrentGdipBitmap96, EditFileAssociation);
      _buttons.Items.Add("Remove", myIconManager.Icons[CommonThemedIcons.Remove.Id].CurrentGdipBitmap96, RemoveFileAssociation);
      _buttons.Items.Add("Up", myIconManager.Icons[CommonThemedIcons.Up.Id].CurrentGdipBitmap96, MoveUp);
      _buttons.Items.Add("Down", myIconManager.Icons[CommonThemedIcons.Down.Id].CurrentGdipBitmap96, MoveDown);
    }
        public ComplexityAnalysisOptionPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext, 
                                        ILanguages languages, ILanguageManager languageManager)
            : base(lifetime, optionsSettingsSmartContext)
        {
            AddText("Specify cyclomatic complexity thresholds:");

              var thresholds = OptionsSettingsSmartContext.Schema.GetIndexedEntry((CyclomaticComplexityAnalysisSettings s) => s.Thresholds);

              var list = new List<LanguageSpecificComplexityProperties>();
              foreach (var languageType in languages.All.Where(languageManager.HasService<IControlFlowBuilder>).OrderBy(GetPresentableName))
              {
            var presentableName = GetPresentableName(languageType);
            var thing = new LanguageSpecificComplexityProperties(lifetime, optionsSettingsSmartContext, thresholds, languageType.Name, presentableName, CyclomaticComplexityAnalysisSettings.DefaultThreshold);
            list.Add(thing);
              }

              // TODO: Do we want to add any keywords for the list view?
              // We would use OptionEntities.Add if the view model also implements IOptionEntity,
              // or use RegisterWord if we just want to add keyword(s)
              // (But the list view is just language name + threshold, so not very interesting)
              AddCustomOption(new ComplexityAnalysisOptionsViewModel(list));
              OptionEntities.Add(new HyperlinkOptionViewModel(lifetime, "What is a good threshold value?",
            new DelegateCommand(() => Process.Start("https://github.com/JetBrains/resharper-cyclomatic-complexity/blob/master/docs/ThresholdGuidance.md#readme"))));
              FinishPage();
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
0
        public UnityOptionsPage(
            Lifetime lifetime,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            RunsProducts.ProductConfigurations productConfigurations)
            : base(lifetime, optionsSettingsSmartContext)
        {
            Header("General");

            CheckBox((UnitySettings s) => s.InstallUnity3DRiderPlugin, "Install or update Rider plugin automatically");
            CheckBox((UnitySettings s) => s.AllowAutomaticRefreshInUnity, "Automatically refresh Assets in Unity");

            Header("UI");
            CheckBox((UnitySettings s) => s.HideSolutionConfiguration, "Hide Solution Configuration (requires solution reopen)");

            Header("ShaderLab");

            CheckBox((UnitySettings s) => s.EnableShaderLabHippieCompletion, "Enable simple word-based completion in ShaderLab files");

            if (productConfigurations.IsInternalMode())
            {
                AddEmptyLine();
                CheckBox((UnitySettings s) => s.EnableCgErrorHighlighting, "Parse Cg files for syntax errors. Only works in internal mode.");
                AddText("Requires solution reopen.");
            }

            FinishPage();
        }
Ejemplo n.º 24
0
        public ComplexityAnalysisOptionPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            ILanguages languages,
            ILanguageManager languageManager)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
        {
            AddText("Specify cyclomatic complexity thresholds:");

            var thresholds = OptionsSettingsSmartContext.Schema.GetIndexedEntry((CyclomaticComplexityAnalysisSettings s) => s.Thresholds);

            var list = new List <LanguageSpecificComplexityProperty>();

            foreach (var languageType in languages.All.Where(languageManager.HasService <IControlFlowBuilder>).OrderBy(GetPresentableName))
            {
                var presentableName = GetPresentableName(languageType);
                var thing           = new LanguageSpecificComplexityProperty(lifetime, optionsSettingsSmartContext, thresholds, languageType.Name, presentableName, CyclomaticComplexityAnalysisSettings.DefaultThreshold);
                list.Add(thing);
            }

            var treeGrid = list.GetBeList(lifetime,
                                          (l, e, p) => new List <BeControl>
            {
                e.Name.GetBeLabel(),
                e.Threshold.GetBeSpinner(lifetime, min: 1)
            },
                                          new TreeConfiguration(new [] { "Language,*", "Threshold,auto" }));

            AddControl(treeGrid, isStar: true);
        }
        public StructuredLoggingOptionsPage(
            Lifetime lifetime,
            OptionsPageContext optionsPageContext,
            OptionsSettingsSmartContext optionsSettingsSmartContext,
            bool wrapInScrollablePanel = false)
            : base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
        {
            AddHeader("Log properties naming style");
            AddComboOptionFromEnum(
                (StructuredLoggingSettings settings) => settings.PropertyNamingType,
                type =>
            {
                switch (type)
                {
                case PropertyNamingType.PascalCase:
                    return("PascalCase");

                case PropertyNamingType.CamelCase:
                    return("camelCase");

                case PropertyNamingType.SnakeCase:
                    return("snake_case");

                default:
                    throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            });
        }
Ejemplo n.º 26
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 XamlAttributeOrderingOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settings, UIApplication environment)
            : base(lifetime, environment, Pid)
        {
            if (lifetime == null) throw new ArgumentNullException("lifetime");

            Control = InitView(lifetime, settings);
        }
        public RazorConverterOptionsPage(
            [NotNull] Lifetime lifetime,
            [NotNull] OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsSettingsSmartContext)
        {
            IProperty <bool> deleteOriginalFile = new Property <bool>(
                lifetime,
                "RazorConverterOptionsPage::DeleteOriginalFile");

            deleteOriginalFile.SetValue(optionsSettingsSmartContext
                                        .StoreOptionsTransactionContext
                                        .GetValue((RazorConverterSettings key) => key.DeleteOriginalFile));

            deleteOriginalFile.Change.Advise(lifetime, a =>
            {
                if (!a.HasNew)
                {
                    return;
                }
                optionsSettingsSmartContext
                .StoreOptionsTransactionContext
                .SetValue((RazorConverterSettings key) => key.DeleteOriginalFile, a.New);
            });

            AddBoolOption((RazorConverterSettings key) => key.DeleteOriginalFile, "Delete original file");
        }
Ejemplo n.º 29
0
 public ReflowAndRetagOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext, IUIApplication environment)
     : base(lifetime, environment, PID)
 {
     _settings    = settingsSmartContext;
     _optionsUI   = new ReflowAndRetagOptionsUI(_settings);
     this.Control = _optionsUI;
 }
        public UserProfileOptionsControl(Lifetime lifetime,
                                         OptionsSettingsSmartContext ctx,
                                         KaVEISettingsStore settingsStore,
                                         IActionExecutor actionExecutor,
                                         DataContexts dataContexts,
                                         IMessageBoxCreator messageBoxCreator,
                                         IUserProfileSettingsUtils userProfileUtils)
        {
            _messageBoxCreator = messageBoxCreator;
            _userProfileUtils  = userProfileUtils;
            _lifetime          = lifetime;
            _ctx            = ctx;
            _settingsStore  = settingsStore;
            _actionExecutor = actionExecutor;
            _dataContexts   = dataContexts;

            InitializeComponent();

            userProfileUtils.EnsureProfileId();

            _userProfileSettings = userProfileUtils.GetSettings();

            _userProfileContext = new UserProfileContext(_userProfileSettings, userProfileUtils);
            _userProfileContext.PropertyChanged += UserProfileContextOnPropertyChanged;

            DataContext = _userProfileContext;

            if (_ctx != null)
            {
                BindToUserProfileChanges();
            }
        }
        public PostfixOptionsViewModel([NotNull] Lifetime lifetime,
                                       [NotNull] OptionsSettingsSmartContext settings,
                                       [NotNull] PostfixTemplatesManager templatesManager)
        {
            mySettingsStore    = settings;
            myTemplatesManager = templatesManager;
            Templates          = new ObservableCollection <PostfixTemplateViewModel>();

            ShowPostfixTemplates   = new Property <bool>(lifetime, "ShowPostfixTemplates");
            ShowStaticMembers      = new Property <bool>(lifetime, "ShowStaticMembers");
            ShowEnumHelpers        = new Property <bool>(lifetime, "ShowEnumHelpers");
            ShowLengthCountItems   = new Property <bool>(lifetime, "ShowLengthCountItems");
            UseBracesForStatements = new Property <bool>(lifetime, "UseBracesForStatements");
            InvokeParameterInfo    = new Property <bool>(lifetime, "InvokeParameterInfo");
            SearchVarOccurrences   = new Property <bool>(lifetime, "SearchVarOccurrences");

            Reset = new DelegateCommand(ResetExecute);

            settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowPostfixItems, ShowPostfixTemplates);
            settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowStaticMethods, ShowStaticMembers);
            settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowEnumHelpers, ShowEnumHelpers);
            settings.SetBinding(lifetime, PostfixSettingsAccessor.BracesForStatements, UseBracesForStatements);
            settings.SetBinding(lifetime, PostfixSettingsAccessor.InvokeParameterInfo, InvokeParameterInfo);
            settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowLengthCountItems, ShowLengthCountItems);
            settings.SetBinding(lifetime, PostfixSettingsAccessor.SearchVarOccurrences, SearchVarOccurrences);

            FillTemplates();
        }
Ejemplo n.º 32
0
 public UnityCustomOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext)
     : base(lifetime, optionsSettingsSmartContext)
 {
     myUnityKey         = (SettingsIndexedKey)optionsSettingsSmartContext.Schema.GetKey <UnityCustomSettings>();
     myCustomUnityItems = new ObservableCollection <UnityClassItem>();
     foreach (GuidIndex id in ((IContextBoundSettingsStore)OptionsSettingsSmartContext).
              EnumIndexedKey(myUnityKey, null))
     {
         Dictionary <SettingsKey, object> unityKeyIndices = new Dictionary <SettingsKey, object>
         {
             {
                 myUnityKey,
                 id
             }
         };
         if (OptionsSettingsSmartContext.IsIndexedKeyDefined(myUnityKey, unityKeyIndices))
         {
             string unityClass = UnitySettingsUtil.ReadCustomPattern(optionsSettingsSmartContext, unityKeyIndices);
             if (unityClass != null)
             {
                 myCustomUnityItems.Add(new UnityClassItem(id, unityClass, this.OptionsSettingsSmartContext));
             }
         }
     }
     lifetime.AddBracket((Action)(() => this.myCustomUnityItems.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnCustomPatternItemsCollectionChanged)), (Action)(() => this.myCustomUnityItems.CollectionChanged -= new NotifyCollectionChangedEventHandler(this.OnCustomPatternItemsCollectionChanged)));
     this.AddCustomOption((IAutomation) new CustomPatternsViewModel2(locks, engine, psiProjectFileTypeCoordinator, mainWindow, windowBranding, formValidators, windowsHookManager, documentMarkupManager, solution, this.OptionsSettingsSmartContext, documentManager, structuralSearchActionManager, searchDomainFactory, languages, this.myCustomUnityItems));
 }
        public MismatchedFileNamesOptionsPage([NotNull] Lifetime lifetime, [NotNull] OptionsSettingsSmartContext optionsSettingsSmartContext) :
            base(lifetime, optionsSettingsSmartContext)
        {
            AddStringOption((MismatchedFileNamesSettings s) => s.AllowedFileNamePostfixRegex, "Allowed file name postfix regex: ");

            FinishPage();
        }
        private EitherControl InitView(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            var grid = new Grid {
                Background = SystemColors.ControlBrush
            };

            var col1 = new ColumnDefinition {
                Width = GridLength.Auto
            };

            grid.ColumnDefinitions.Add(col1);
            var row1 = new RowDefinition {
                Height = GridLength.Auto
            };

            grid.RowDefinitions.Add(row1);

            var enabledBox = new CheckBoxDisabledNoCheck2 {
                Content = "Enable changing 2147483647 to int.MaxValue"
            };

            settings.SetBinding <UseIntMaxValueSettings, bool>(lifetime, x => x.Enable, enabledBox, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            Grid.SetRow(enabledBox, 0);
            Grid.SetColumn(enabledBox, 0);

            grid.Children.Add(enabledBox);
            return(grid);
        }
Ejemplo n.º 35
0
        public TestCopOptionPage(Lifetime lifetime, OptionsSettingsSmartContext settings, TemplateScopeManager scopeManager
                                 , IThemedIconManager iconManager, UIApplication application
                                 , StoredTemplatesProvider storedTemplatesProvider, ILiveTemplatesUIHelper templatesUiHelper, FileTemplatesManager fileTemplatesManager, ISolution solution = null)
        {
            _lifetime                = lifetime;
            _settings                = settings;
            _scopeManager            = scopeManager;
            _application             = application;
            _solution                = solution;
            _fileTemplatesManager    = fileTemplatesManager;
            _storedTemplatesProvider = storedTemplatesProvider;
            _templatesUiHelper       = templatesUiHelper;

            InitializeComponent();
            var testFileAnalysisSettings = settings.GetKey <TestFileAnalysisSettings>(SettingsOptimization.DoMeSlowly);

            InitializeComponent();
            BuildTestStrategyCombo(testFileAnalysisSettings);

            //Do this first as it is reference by other display fields
            testClassSuffixTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.TestClassSuffix), "^[_a-zA-Z,]*$");

            //Regex Config for Multiple Test Assemply Logic via project naming
            testProjectNameRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.TestProjectNameToCodeProjectNameRegEx));
            testProjectNameRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.TestProjectNameToCodeProjectNameRegExReplace), "^[\\$\\.a-zA-Z1-9]*$");

            //Regex Config for Multiple Test Assemply Logic via namespace naming
            testNamespaceRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.TestProjectToCodeProjectNameSpaceRegEx));
            testNamespaceRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.TestProjectToCodeProjectNameSpaceRegExReplace), "^[\\$\\.a-zA-Z1-9]*$");
            //
            //Regex Config for Single Test Assemply Logic
            SingleTestNamespaceRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.SingleTestRegexTestToAssembly));
            SingleTestNamespaceToAssemblyRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.SingleTestRegexTestToAssemblyProjectReplace), "^[\\$\\.a-zA-Z1-9]*$");
            SingleTestNamespaceToAssemblySubNameSpaceRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.SingleTestRegexTestToAssemblyProjectSubNamespaceReplace), "^[\\$\\.a-zA-Z1-9]*$");
            SingleTestCodeNamespaceRegExTextBox.BindWithValidationMustBeARegex(testFileAnalysisSettings, P(x => x.SingleTestRegexCodeToTestAssembly));
            SingleTestCodeNamespaceToTestRegExReplaceTextBox.BindWithRegexMatchesValidation(testFileAnalysisSettings, P(x => x.SingleTestRegexCodeToTestReplace), "^[\\$\\.a-zA-Z1-9]*$");
            //
            testFileAnalysisSettings.TestingAttributes().ForEach(p => testingAttributesListBox.Items.Add(p));
            testFileAnalysisSettings.BddPrefixes().ForEach(p => contextPrefixesListBox.Items.Add(p));

            SwitchBetweenFilesShortcutTextBox.Text = testFileAnalysisSettings.ShortcutToSwitchBetweenFiles;
            RunTestsShortcutTextBox.Text           = testFileAnalysisSettings.ShortcutToRunTests;

            OrphanedFilesPatternsTextBox.Text = testFileAnalysisSettings.OrphanedFilesPatterns;

            BindWithValidationMustBeAFileTemplate(testFileAnalysisSettings, codeTemplateTextBox, P(x => x.CodeFileTemplateName));
            BindWithValidationMustBeAFileTemplate(testFileAnalysisSettings, unitTestTemplateTextBox, P(x => x.UnitTestFileTemplateName));

            ShowAllTestsWithUsageCheckBox.IsChecked   = testFileAnalysisSettings.FindAnyUsageInTestAssembly;
            CheckTestNamespaces.IsChecked             = testFileAnalysisSettings.CheckTestNamespaces;
            CheckSearchForOrphanedCodeFiles.IsChecked = testFileAnalysisSettings.FindOrphanedProjectFiles;
            SupportRenameRefactor.IsChecked           = testFileAnalysisSettings.SupportRenameRefactor;

            OutputPanelOpenOnKeyboardMapping.IsChecked = testFileAnalysisSettings.OutputPanelOpenOnKeyboardMapping;

            TestCopLogoImage.Source =
                (ImageSource) new BitmapToImageSourceConverter().Convert(
                    iconManager.Icons[UnnamedThemedIcons.Agent64x64.Id].CurrentGdipBitmap96, null, null, null);
        }
 public DisposePluginOptionsPage(Lifetime lifetime, UIApplication environment,
     OptionsSettingsSmartContext settings)
     : base(lifetime, environment, PID)
 {
     _lifetime = lifetime;
     _settings = settings;
     InitControls();
 }
        public LanguageSpecificComplexityProperties(Lifetime lifetime, OptionsSettingsSmartContext settings, SettingsIndexedEntry settingsIndexedEntry, string index, string languagePresentableName, int defaultValue)
        {
            Name = languagePresentableName;

              Threshold = new Property<int>(lifetime, index);
              Threshold.Change.Advise(lifetime, () => OnPropertyChanged("Threshold"));
              settings.SetBinding(lifetime, settingsIndexedEntry, index, Threshold, defaultValue);
        }
Ejemplo n.º 38
0
 public ShaderLabFormattingStylePage(Lifetime lifetime,
                                     [NotNull] OptionsSettingsSmartContext smartContext,
                                     [NotNull] IUIApplication environment,
                                     [NotNull] ShaderLabFormattingStylePageSchema schema,
                                     [NotNull] CodeStylePreview preview, IComponentContainer container)
     : base(lifetime, smartContext, environment, schema, preview, container)
 {
 }
    /// <summary>
    /// Initializes a new instance of the <see cref="CodeAnnotationsOptionsPage"/> class.
    /// </summary>
    /// <param name="lifetime">
    /// The lifetime.
    /// </param>
    /// <param name="settings">
    /// The settings.
    /// </param>
    public CodeAnnotationsOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext settings)
    {
      this.InitializeComponent();

      settings.SetBinding(lifetime, (CodeAnnotationPackSettings s) => s.PublicAssertion, WinFormsProperty.Create(lifetime, this.PublicAssertion, box => box.Text, true));
      settings.SetBinding(lifetime, (CodeAnnotationPackSettings s) => s.NonPublicAssertion, WinFormsProperty.Create(lifetime, this.NonPublicAssertion, box => box.Text, true));
      settings.SetBinding(lifetime, (CodeAnnotationPackSettings s) => s.AlternativeAssertions, WinFormsProperty.Create(lifetime, this.AlternativeAssertions, box => box.Text, true));
    }
        public ExceptionalOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settings, UIApplication environment)
            : base(lifetime, environment, Pid)
        {
            if (lifetime == null)
                throw new ArgumentNullException("lifetime");

            Control = new SettingsView(lifetime, settings);
        }
Ejemplo n.º 41
0
 public UnrealLinkOptionsPage(Lifetime lifetime,
                              OptionsPageContext optionsPageContext,
                              OptionsSettingsSmartContext optionsSettingsSmartContext)
     : base(lifetime, optionsPageContext, optionsSettingsSmartContext)
 {
     AddBoolOption((UnrealLinkSettings k) => k.InstallRiderLinkPlugin,
                   "Automatically install and update Rider's UnrealLink editor plugin (recommended)");
 }
        public LanguageSpecificComplexityProperties(Lifetime lifetime, OptionsSettingsSmartContext settings, SettingsIndexedEntry settingsIndexedEntry, string index, string languagePresentableName, int defaultValue)
        {
            Name = languagePresentableName;

            Threshold = new Property <int>(lifetime, index);
            Threshold.Change.Advise(lifetime, () => OnPropertyChanged(nameof(Threshold)));
            settings.SetBinding(lifetime, settingsIndexedEntry, index, Threshold, defaultValue);
        }
 /// <summary>
 /// Creates new instance of InjectionHappyDetectorOptionPage
 /// </summary>
 public InjectionHappyDetectorOptionPage(Lifetime lifetime, FontsManager fontsManager,
     OptionsSettingsSmartContext settings)
     : base(lifetime, fontsManager, PID)
 {
     _lifetime = lifetime;
     _settings = settings;
     InitControls();
 }
        private EitherControl InitView(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            var grid = new Grid { Background = SystemColors.ControlBrush };

            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition());

            var margin = new Thickness(3);
            var label = new Label { Content = "Configuration:", Margin = margin };
            var text = new TextBox { AcceptsReturn = true, Margin = margin };
            settings.SetBinding<OrderUsingsSettings, string>(
                lifetime,
                x => x.OrderSpecificationXml,
                text,
                TextBox.TextProperty);

            Grid.SetRow(text, 1);
            Grid.SetColumnSpan(text, 3);

            var buttonPadding = new Thickness(3);
            var resetButton = new Button
            {
                Content = "Reset",
                Margin = margin,
                Padding = buttonPadding
            };
            resetButton.Click += (s, e) => text.SetCurrentValue(TextBox.TextProperty, string.Empty);
            Grid.SetColumn(resetButton, 1);

            var addBasicButton = new Button
            {
                Content = "Create basic configuration",
                Margin = margin,
                Padding = buttonPadding
            };
            addBasicButton.Click += (s, e) =>
            {
                var asm = typeof(OrderUsingsOptionsPage).Assembly;
                Stream stream = asm.GetManifestResourceStream("OrderUsings.ReSharper.Settings.DefaultConfiguration.xml");
                if (stream != null)
                {
                    using (var reader = new StreamReader(stream))
                    {
                        text.SetCurrentValue(TextBox.TextProperty, reader.ReadToEnd());
                    }
                }
            };
            Grid.SetColumn(addBasicButton, 2);

            grid.Children.Add(label);
            grid.Children.Add(text);
            grid.Children.Add(resetButton);
            grid.Children.Add(addBasicButton);
            return grid;
        }
Ejemplo n.º 45
0
 public ZenSettingsPage(Lifetime lifetime, OptionsSettingsSmartContext settings, IComponentContainer container)
 {
     settings.SetBinding(lifetime, (ZenSharpSettings s) => s.TreeFilename, this, PathProperty);
     InitializeComponent();
     Id = pageId;
     _zenWatcher = Shell.Instance.GetComponent<LtgConfigWatcher>();
     // show exception info if any
     OnOk();
 }
Ejemplo n.º 46
0
        public ReTrackOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext ctx)
        {
            InitializeComponent();

              ctx.SetBinding(lifetime, (ReTrackSettingsReSharper s) => s.YouTrackUsername, UsernameBox, TextBox.TextProperty);
              ctx.SetBinding(lifetime, (ReTrackSettingsReSharper s) => s.YouTrackPassword, PasswordBox, TextBox.TextProperty);
              ctx.SetBinding(lifetime, (ReTrackSettingsReSharper s) => s.YouTrackUrl, UrlBox, TextBox.TextProperty);
              ctx.SetBinding(lifetime, (ReTrackSettingsReSharper s) => s.Port, PortBox, TextBox.TextProperty);
        }
Ejemplo n.º 47
0
        public Todo2JiraSettings([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext)
            : base(lifetime, Pid)
        {
            _settings = settingsSmartContext;
            _optionsUI = new Todo2JiraSettingsUI();
            Control = _optionsUI;

            _settings.SetBinding(lifetime, (JiraSetting s) => s.BaseUrl, WinFormsProperty.Create(lifetime, _optionsUI.txtJiraBaseUrl, box => box.Text, true));
            _settings.SetBinding(lifetime, (JiraSetting s) => s.ProjectKey, WinFormsProperty.Create(lifetime, _optionsUI.txtProjectKey, box => box.Text, true));
            _settings.SetBinding(lifetime, (JiraSetting s) => s.Username, WinFormsProperty.Create(lifetime, _optionsUI.txtJiraUsername, box => box.Text, true));
            _settings.SetBinding(lifetime, (JiraSetting s) => s.Password, WinFormsProperty.Create(lifetime, _optionsUI.txtJiraPassword, box => box.Text, true));
        }
        public ContractExtensionsOptionsViewModel(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            Contract.Requires(lifetime != null);
            Contract.Requires(settings != null);

            UseGenericContractRequires = new Property<bool>(lifetime, "UseGenericContractRequires");
            CheckStringsForNullOrEmpty = new Property<bool>(lifetime, "CheckStringsForNullOrEmpty");
            UseExcludeFromCodeCoverageAttribute = new Property<bool>(lifetime, "UseExcludeFromCodeCoverageAttribute");

            settings.SetBinding(lifetime, UseGenericRequiresEx, UseGenericContractRequires);
            settings.SetBinding(lifetime, CheckForNullOrEmptyEx, CheckStringsForNullOrEmpty);
            settings.SetBinding(lifetime, UseExcludeFromCodeCoverageAttributeEx, UseExcludeFromCodeCoverageAttribute);

            Reset = new DelegateCommand(ResetExecute);
        }
Ejemplo n.º 49
0
    public GistOptionsPage([NotNull] Lifetime lifetime, DataContexts dataContexts, GitHubService gitHubService, OptionsSettingsSmartContext settings)
      : base(lifetime, Pid)
    {
      if (lifetime == null)
        throw new ArgumentNullException("lifetime");

      myGitHubService = gitHubService;
      myEmptyDataContext = dataContexts.Empty;

      TextBox usernameBox;
      System.Windows.Forms.TextBox passwordBox;
      Control = InitView(out usernameBox, out passwordBox);

      settings.SetBinding(lifetime, (GitHubSettings s) => s.Username, usernameBox, TextBox.TextProperty);
      settings.SetBinding(lifetime, (GitHubSettings s) => s.Password, WinFormsProperty.Create(lifetime, passwordBox, box => box.Text, true));
    }
Ejemplo n.º 50
0
        public CleanCodeOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext optionsSettingsSmartContext)
            : base(lifetime, optionsSettingsSmartContext)
        {
            AddHeader("Single Responsibility");
            AddText("A class should only have a single responsibility. Do not do too much in a class or method.");
            AddIntOption((CleanCodeSettings s) => s.MaximumMethodsInClass,
                Resources.Settings.MaximumMethodsPerClass,
                "Too many method declarations in a class is an indicator that the class is doing too much.");
            AddIntOption((CleanCodeSettings s) => s.MaximumMethodParameters,
                Resources.Settings.MaximumMethodDeclarationParameters,
                "Too many parameters in a method declaration is an indicator of having more than one responsibility");
            AddIntOption((CleanCodeSettings s) => s.MaximumMethodStatements, Resources.Settings.MaximumStatementsPerMethod,
                "Long methods are indicator of having more than one responsibility.");
            AddIntOption((CleanCodeSettings s) => s.MaximumDeclarationsInMethod,
                Resources.Settings.DeclarationsMaximum,
                "Too many variables are an indicator of having more than one responsibility.");
            AddIntOption((CleanCodeSettings s) => s.MaximumIndentationDepth,
                Resources.Settings.MaximumLevelOfNestingInAMethod,
                "Too much nesting in a method is an indicator of having more than one responsibility.");

            AddHeader("Coupling");
            AddText("Avoid excessive coupling beween classes.");
            AddIntOption((CleanCodeSettings s) => s.MaximumConstructorDependencies,
                Resources.Settings.MaximumConstructorDependencies);
            AddIntOption((CleanCodeSettings s) => s.MaximumChainedReferences,
                Resources.Settings.MaximumChainedReferences,
                "Avoid breaking the Law of Demeter.");

            AddHeader("Legibility");
            AddText("Names should be meaningful.");
            AddIntOption((CleanCodeSettings s) => s.MinimumMeaningfulMethodNameLength,
                Resources.Settings.MinimumMethodNameLength);
            AddStringOption((CleanCodeSettings s) => s.MeaninglessClassNameSuffixes,
                Resources.Settings.MeaninglessNameSuffixes,
                Resources.Settings.MeaninglessNameSuffixesTooltip);

            AddHeader("Complexity");
            AddText("Reduce complexity in individual statements.");
            AddIntOption((CleanCodeSettings s) => s.MaximumExpressionsInCondition,
                Resources.Settings.MaximumExpressionsInsideACondition);

            AddRichText(
                new RichText(
                    "Note: All references to Clean Code, including but not limited to the Clean Code icon are used with permission of Robert C. Martin (a.k.a. UncleBob)",
                    new TextStyle(FontStyle.Italic)));
            FinishPage();
        }
    /// <summary>Initializes a new instance of the <see cref="Options"/> class.</summary>
    /// <param name="lifetime">The lifetime.</param>
    /// <param name="settings">The settings.</param>
    public Options(Lifetime lifetime, OptionsSettingsSmartContext settings)
    {
      this.InitializeComponent();

      settings.SetBinding(lifetime, (AutoTemplateSettings s) => s.MaxTemplates, WinFormsProperty.Create(lifetime, this.MaxTemplates, box => box.Text, true));
      settings.SetBinding(lifetime, (AutoTemplateSettings s) => s.Occurances, WinFormsProperty.Create(lifetime, this.Occurances, box => box.Text, true));
      settings.SetBinding(lifetime, (AutoTemplateSettings s) => s.MinPercentage, WinFormsProperty.Create(lifetime, this.MinPercentage, box => box.Text, true));
      settings.SetBinding(lifetime, (AutoTemplateSettings s) => s.UseCompleteStatement, WinFormsProperty.Create(lifetime, this.UseCompleteStatement, box => box.Checked, true));
      settings.SetBinding(lifetime, (AutoTemplateSettings s) => s.FileSaves, WinFormsProperty.Create(lifetime, this.FileSaves, box => box.Text, true));

      this.listView1.Columns[0].Width = this.listView1.Width / 2 - 40;
      this.listView1.Columns[1].Width = this.listView1.Width / 2 - 40;
      this.listView1.Columns[2].Width = 40;
      this.listView1.Columns[3].Width = 40;

      this.RefreshInfo();
    }
        public SettingsView(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            InitializeComponent();

            _lifetime = lifetime;
            _settings = settings;

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.DelegateInvocationsMayThrowExceptions,
                DelegateInvocationsMayThrowExceptions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForThrowStatements,
                IsDocumentationOfExceptionSubtypeSufficientForThrowStatements, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions,
                IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPublicMethods,
                InspectPublicMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectInternalMethods,
                InspectInternalMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectProtectedMethods,
                InspectProtectedMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPrivateMethods,
                InspectPrivateMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalExceptions2,
                OptionalExceptions, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalExceptions2,
                UseOptionalExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalMethodExceptions2,
                OptionalMethodExceptions, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalMethodExceptions2,
                UseOptionalMethodExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.AccessorOverrides2,
                AccessorOverrides, TextBox.TextProperty);
            settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultAccessorOverrides2,
                UseDefaultAccessorOverrides, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

            //settings.Changed.Advise(lifetime, delegate { Dispatcher.BeginInvoke((Action)(UpdateTextFields)); });
            lifetime.AddAction(delegate
            {
                // TODO: Force rescan of all documents if settings have changed
            });
        }
    private EitherControl InitView(Lifetime lifetime, OptionsSettingsSmartContext settings)
    {
      var grid = new Grid {Background = SystemColors.ControlBrush};

      var col1 = new ColumnDefinition {Width = GridLength.Auto};
      grid.ColumnDefinitions.Add(col1);
      var row1 = new RowDefinition {Height = GridLength.Auto};
      grid.RowDefinitions.Add(row1);

      var enabledBox = new CheckBoxDisabledNoCheck2 { Content = "Enable changing 2147483647 to int.MaxValue" };
      settings.SetBinding<UseIntMaxValueSettings, bool>(lifetime, x => x.Enable, enabledBox, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);

      Grid.SetRow(enabledBox, 0);
      Grid.SetColumn(enabledBox, 0);

      grid.Children.Add(enabledBox);
      return grid;
    }
        public ExternalCodeOptionsPage(
            IUIApplication environment,
            OptionsSettingsSmartContext settings,
            Lifetime lifetime,
            IShellLocks shellLocks,
            IWindowsHookManager windowsHookManager,
            FormValidators formValidators,
            IMainWindow mainWindow = null)
            : base(lifetime, environment, Pid)
        {
            _settings = settings;
            _lifetime = lifetime;
            _windowsHookManager = windowsHookManager;
            _formValidators = formValidators;
            _mainWindow = mainWindow;

            InitControls();
            shellLocks.QueueRecurring(lifetime, "Force settings merge", TimeSpan.FromMilliseconds(300.0), () => OnOk());
        }
        public PostfixOptionsViewModel(
      [NotNull] Lifetime lifetime,
      [NotNull] OptionsSettingsSmartContext store,
      [NotNull] PostfixTemplatesManager templatesManager)
        {
            myStore = store;
              myTemplatesManager = templatesManager;
              Templates = new ObservableCollection<PostfixTemplateViewModel>();
              UseBracesForEmbeddedStatements = new Property<bool>(lifetime, "UseBracesForEmbeddedStatements");
              ShowStaticMembersInCodeCompletion = new Property<bool>(lifetime, "ShowStaticMethodsInCodeCompletion");
              ShowEnumHelpersInCodeCompletion = new Property<bool>(lifetime, "ShowEnumHelpersInCodeCompletion");
              Reset = new DelegateCommand(ResetExecute);

              store.SetBinding(lifetime, PostfixSettingsAccessor.UseBracesForEmbeddedStatements, UseBracesForEmbeddedStatements);
              store.SetBinding(lifetime, PostfixSettingsAccessor.ShowStaticMethodsInCodeCompletion, ShowStaticMembersInCodeCompletion);
              store.SetBinding(lifetime, PostfixSettingsAccessor.ShowEnumHelpersInCodeCompletion, ShowEnumHelpersInCodeCompletion);

              FillTemplates();
        }
Ejemplo n.º 56
0
 public OptionsPage(Lifetime lifetime, IUIApplication environment, OptionsSettingsSmartContext settings)
     : this()
 {
     DataContext = new OptionsViewModel(settings);
 }
Ejemplo n.º 57
0
        /// <summary>
        /// Initializes a new instance of the StyleCopOptionsPage class.
        /// </summary>
        /// <param name="lifetime">
        /// The lifetime of the options page.
        /// </param>
        /// <param name="settingsSmartContext">
        /// Our settings context. 
        /// </param>
        public StyleCopOptionsPage(Lifetime lifetime, OptionsSettingsSmartContext settingsSmartContext)
            : base(lifetime, settingsSmartContext)
        {
            this.AddHeader("Options");

            // TODO: It would be nice to get rid of this option. It doesn't do what you think it does
            // It controls whether a one-time init handler checks options at startup, BUT only if the
            // install date is newer than the last init date. We don't even support the installed version...
            // I think we should do the check when showing the options. But what about at startup? Modal
            // dialogs are a little rude...
            // By providing the correct options in a settings file, we automatically get correct defaults, but
            // they can still be overridden in the global settings, and also per-solution
            // this.AddBoolOption(
            //    (StyleCopOptionsSettingsKey options) => options.CheckReSharperCodeStyleOptionsAtStartUp,
            //    "Check ReSharper code style options at startup");

            // Note that we have to check to see if the lifetime is terminated before accessing the
            // settings context because WPF will continue to call our CanExecute until a garbage collection
            // breaks the weak reference that WPF holds on command
            this.AddButton(
                "Reset code style options",
                new DelegateCommand(
                    () => CodeStyleOptions.CodeStyleOptionsReset(settingsSmartContext),
                    () => !lifetime.IsTerminated && !CodeStyleOptions.CodeStyleOptionsValid(settingsSmartContext)));

            this.AddHeader("Headers");
            this.AddBoolOption(
                (StyleCopOptionsSettingsKey options) => options.InsertTextIntoDocumentation,
                "Insert text into documentation and file headers");
            this.AddBoolOption(
                (StyleCopOptionsSettingsKey options) => options.UseSingleLineDeclarationComments,
                "Use single lines for declaration headers");
            this.AddBoolOption(
                (StyleCopOptionsSettingsKey options) => options.InsertToDoText,
                "Insert TODO into headers");
            this.AddIntOption(
                (StyleCopOptionsSettingsKey options) => options.DashesCountInFileHeader,
                "Number of dashes in file header text:");

            this.AddHeader("Analysis Performance");
            this.AddBoolOption(
                (StyleCopOptionsSettingsKey options) => options.AnalysisEnabled,
                "Run StyleCop as you type");
            BoolOptionViewModel nonUserFiles =
                this.AddBoolOption(
                    (StyleCopOptionsSettingsKey options) => options.AnalyzeReadOnlyFiles,
                    "Analyze non-user files (not recommended)");
            this.AddBinding(
                nonUserFiles,
                BindingStyle.IsEnabledProperty,
                (StyleCopOptionsSettingsKey options) => options.AnalysisEnabled,
                JetFunc<object>.Identity);

            this.AddHeader("Misc");
            this.AddBoolOption(
                (StyleCopOptionsSettingsKey options) => options.UseExcludeFromStyleCopSetting,
                "Use ExcludeFromStyleCop setting in csproj files");
            this.AddStringOption(
                (StyleCopOptionsSettingsKey options) => options.SuppressStyleCopAttributeJustificationText,
                "Justification for SuppressMessage attribute:");

            // TODO: Add "update file header style" that used to be in code cleanup
            this.FinishPage();
        }
        private EitherControl InitView(Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            var grid = new Grid { Background = SystemColors.ControlBrush };

            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
            grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 0
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 1
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 2
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 3
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 4
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 5
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 6
            grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); // 7

            var enabledBox = new CheckBoxDisabledNoCheck2 { Content = "Enable ordering of Xaml Attributes" };
            Grid.SetColumnSpan(enabledBox, 2);
            Grid.SetRow(enabledBox, 0);
            settings.SetBinding<XamlAttributeOrderingSettings, bool>(lifetime, x => x.Enable, enabledBox, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            grid.Children.Add(enabledBox);

            var alphabeticOrderBox = new CheckBoxDisabledNoCheck2 { Content = "Order alphabetically instead of using groups" };
            Grid.SetColumnSpan(alphabeticOrderBox, 2);
            Grid.SetRow(alphabeticOrderBox, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, bool>(lifetime, x => x.IsAlphabeticalOrder, alphabeticOrderBox, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
            grid.Children.Add(alphabeticOrderBox);

            var group1Label = new Label { Content = "Group #1 - Keys" };
            Grid.SetRow(group1Label, 2);
            var group1Box = new TextBox();
            Grid.SetRow(group1Box, 2);
            Grid.SetColumn(group1Box, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, string>(lifetime, x => x.Group1_KeyGroup, group1Box, TextBox.TextProperty);
            grid.Children.Add(group1Label);
            grid.Children.Add(group1Box);

            var group2Label = new Label { Content = "Group #2 - Names" };
            Grid.SetRow(group2Label, 3);
            var group2Box = new TextBox();
            Grid.SetRow(group2Box, 3);
            Grid.SetColumn(group2Box, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, string>(lifetime, x => x.Group2_NameGroup, group2Box, TextBox.TextProperty);
            grid.Children.Add(group2Label);
            grid.Children.Add(group2Box);

            var group3Label = new Label { Content = "Group #3 - Attached Layout Properties" };
            Grid.SetRow(group3Label, 4);
            var group3Box = new TextBox();
            Grid.SetRow(group3Box, 4);
            Grid.SetColumn(group3Box, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, string>(lifetime, x => x.Group3_AttachedLayoutGroup, group3Box, TextBox.TextProperty);
            grid.Children.Add(group3Label);
            grid.Children.Add(group3Box);

            var group4Label = new Label { Content = "Group #4 - Layout Properties" };
            Grid.SetRow(group4Label, 5);
            var group4Box = new TextBox();
            Grid.SetRow(group4Box, 5);
            Grid.SetColumn(group4Box, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, string>(lifetime, x => x.Group4_LayoutGroup, group4Box, TextBox.TextProperty);
            grid.Children.Add(group4Label);
            grid.Children.Add(group4Box);

            var group5Label = new Label { Content = "Group #5 - Alignment Properties" };
            Grid.SetRow(group5Label, 6);
            var group5Box = new TextBox();
            Grid.SetRow(group5Box, 6);
            Grid.SetColumn(group5Box, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, string>(lifetime, x => x.Group5_AlignmentGroup, group5Box, TextBox.TextProperty);
            grid.Children.Add(group5Label);
            grid.Children.Add(group5Box);

            var group6Label = new Label { Content = "Group #6 - Misc Properties" };
            Grid.SetRow(group6Label, 7);
            var group6Box = new TextBox();
            Grid.SetRow(group6Box, 7);
            Grid.SetColumn(group6Box, 1);
            settings.SetBinding<XamlAttributeOrderingSettings, string>(lifetime, x => x.Group6_MiscGroup, group6Box, TextBox.TextProperty);
            grid.Children.Add(group6Label);
            grid.Children.Add(group6Box);

            return grid;
        }
        /// <summary>
        /// Initializes a <see cref="OrderUsingsOptionsPage"/>.
        /// </summary>
        /// <param name="lifetime">Passed by ReSharper. Purpose unclear to me.</param>
        /// <param name="settings">Passed by ReSharper, enabling us to get the
        /// current configuration, and bind controls to the configuration system.</param>
        public OrderUsingsOptionsPage([NotNull] Lifetime lifetime, OptionsSettingsSmartContext settings)
        {
            if (lifetime == null) throw new ArgumentNullException("lifetime");

            Control = InitView(lifetime, settings);
        }
 public SampleOptionPage(Lifetime lifetime, OptionsSettingsSmartContext settings)
 {
   InitializeComponent();
   settings.SetBinding(lifetime, (SampleSettings s) => s.SampleOption, mySampleOptionCheckBox, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
 }