コード例 #1
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);
        }
コード例 #2
0
        private void CreateDocumentationSection(Lifetime lifetime, IContextBoundSettingsStoreLive storeOptionsTransactionContext)
        {
            AddHeader(OptionsLabels.General.DocumentationOfThrownExceptionsSubtypeHeader);

            CreateCheckboxIsDocumentationOfExceptionSubtypeSufficientForThrowStatements(lifetime, storeOptionsTransactionContext);
            CreateCheckboxIsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions(lifetime, storeOptionsTransactionContext);
        }
コード例 #3
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            ApplicationPackages applicationPackages,
            ApplicationPackagesLocallyInstalled applicationPackagesLocallyInstalled,
            IEnumerable <ApplicationPackageArtifact> packages, IDeployedPackagesExpandLocationResolver resolver)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime            = lifetime;
            myLogger              = logger;
            mySolution            = solution;
            myShellLocks          = shellLocks;
            myDetector            = detector;
            myNotifications       = notifications;
            myApplicationPackages = applicationPackages;
            myApplicationPackagesLocallyInstalled = applicationPackagesLocallyInstalled;
            myPackages = packages;
            myResolver = resolver;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);
        }
コード例 #4
0
        public ProductSettingsTracker(Lifetime lifetime, IProductNameAndVersion product, ClientFactory clientFactory, GlobalPerProductStorage globalPerProductStorage, IFileSystemTracker fileSystemTracker, JetBoxSettingsStorage jetBoxSettings)
        {
            myClientFactory = clientFactory;
              mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              mySettingsStore.Changed.Advise(lifetime, _ => InitClient());

              myRootFolder = FileSystemPath.Parse(product.ProductName);
              InitClient();

              var productSettingsPath = globalPerProductStorage.XmlFileStorage.Path;

              SyncFromCloud(productSettingsPath.Value);

              var fileTrackingLifetime = new SequentialLifetimes(lifetime);
              productSettingsPath.Change.Advise(lifetime,
            args =>
            {
              var path = args.Property.Value;
              if (lifetime.IsTerminated || path.IsNullOrEmpty())
              {
            fileTrackingLifetime.TerminateCurrent();
              }
              else
              {
            fileTrackingLifetime.Next(lt => fileSystemTracker.AdviseFileChanges(lt, path, delta => delta.Accept(new FileChangesVisitor(myClient, myRootFolder))));
              }
            });
        }
コード例 #5
0
        public ProductSettingsTracker(Lifetime lifetime, ClientFactory clientFactory, IViewable <ISyncSource> syncSources, IFileSystemTracker fileSystemTracker, JetBoxSettingsStorage jetBoxSettings)
        {
            myClientFactory = clientFactory;
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
            mySettingsStore.Changed.Advise(lifetime, _ => InitClient());

            myRootFolder = FileSystemPath.Parse("ReSharperPlatform");
            InitClient();

            syncSources.View(lifetime, (lt1, source) =>
                             source.FilesToSync.View(lt1, (lt2, fileToSync) =>
            {
                SyncFromCloud(fileToSync.Value);

                var fileTrackingLifetime = new SequentialLifetimes(lt2);
                fileToSync.Change.Advise(lt2,
                                         args =>
                {
                    var path = args.Property.Value;
                    if (lifetime.IsTerminated || path.IsNullOrEmpty())
                    {
                        fileTrackingLifetime.TerminateCurrent();
                    }
                    else
                    {
                        fileTrackingLifetime.Next(lt =>
                                                  fileSystemTracker.AdviseFileChanges(lt, path,
                                                                                      delta => delta.Accept(new FileChangesVisitor(myClient, myRootFolder))));
                    }
                });
            }));
        }
コード例 #6
0
        /// <summary>
        /// The initializer for this ShellComponent.
        /// </summary>
        /// <param name="lifetime">
        /// The lifetime for this object.
        /// </param>
        public void Init(JB::JetBrains.DataFlow.Lifetime lifetime)
        {
            RegistryUtils registryUtils = new RegistryUtils();

            object   oneTimeInitializationRequiredRegistryKey = registryUtils.CUGetValue("LastInitializationDate");
            DateTime initializationDate = Convert.ToDateTime(oneTimeInitializationRequiredRegistryKey);

            string todayAsString = DateTime.Today.ToString("yyyy-MM-dd");

            string value = registryUtils.LMGetValue("InstallDate") as string;

            DateTime lastInstalledDate;

            try
            {
                lastInstalledDate = Convert.ToDateTime(value);

                // If the installer stored a date that has now been read back in and seems to be in the future
                // then use the LocalUserInstallDate value.
                if (lastInstalledDate > DateTime.Today)
                {
                    lastInstalledDate = GetInstallDateFromLocalUserRegistry(registryUtils, todayAsString);
                }
            }
            catch (FormatException ex)
            {
                // In some locales the installer saves the date in a format we can't parse back out.
                // Use today as the installed date and store it in the HKCU key.
                lastInstalledDate = GetInstallDateFromLocalUserRegistry(registryUtils, todayAsString);
            }

            if (oneTimeInitializationRequiredRegistryKey == null || initializationDate < lastInstalledDate)
            {
                SettingsStore settingsStore = Shell.Instance.GetComponent <SettingsStore>();

                IContextBoundSettingsStoreLive settings = settingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);

                bool checkReSharperCodeStyleOptionsAtStartUp = settings.GetValue((StyleCopOptionsSettingsKey key) => key.CheckReSharperCodeStyleOptionsAtStartUp);

                if (checkReSharperCodeStyleOptionsAtStartUp)
                {
                    if (!StyleCopOptionsPage.CodeStyleOptionsValid(settings))
                    {
                        DialogResult result =
                            MessageBox.Show(
                                @"Your ReSharper code style settings are not completely compatible with StyleCop. Would you like to reset them now?",
                                @"StyleCop",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button2);
                        if (result == DialogResult.Yes)
                        {
                            StyleCopOptionsPage.CodeStyleOptionsReset(settings);
                        }
                    }
                }
            }

            registryUtils.CUSetValue("LastInitializationDate", todayAsString);
        }
コード例 #7
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            PluginPathsProvider pluginPathsProvider,
            UnityVersionDetector unityVersionDetector)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime             = lifetime;
            myLogger               = logger;
            mySolution             = solution;
            myShellLocks           = shellLocks;
            myDetector             = detector;
            myNotifications        = notifications;
            myPluginPathsProvider  = pluginPathsProvider;
            myUnityVersionDetector = unityVersionDetector;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);
        }
コード例 #8
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
            myLifetimes     = new SequentialLifetimes(lifetime);

            myClient           = clientFactory.CreateClient();
            myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

            // init UI
            myLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true
            };
            myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
            myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

            myNonLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown
            };
            myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus)
            {
                Image      = Environment.Theming.Icons[UnnamedThemedIcons.Dropbox.Id].CurrentGdipBitmapNotSure(),
                ImageAlign = ContentAlignment.MiddleLeft,
                Padding    = new Padding(20, 0, 0, 0)
            });

            Controls.Add(myLoggedPanel);
            Controls.Add(myNonLoggedPanel);

            InitLoginState();
        }
コード例 #9
0
        public LtgConfigWatcher(Lifetime lifetime, ISettingsStore settingsStore)
        {
            _boundSettings = settingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
            _filepath      = _boundSettings.GetValueProperty <string>(lifetime, _boundSettings.Schema.GetScalarEntry((ZenSharpSettings s) => s.TreeFilename), null);

            _filepath.Change.Advise_HasNew(lifetime, v => Initialize(v.New));
        }
コード例 #10
0
ファイル: JetBoxOptionsPage.cs プロジェクト: derigel23/JetBox
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              myLifetimes = new SequentialLifetimes(lifetime);

              myClient = clientFactory.CreateClient();
              myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

              // init UI
              myLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true };
              myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
              myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

              myNonLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown };
              myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus)
              {
            Image = Environment.Theming.Icons[UnnamedThemedIcons.Dropbox.Id].CurrentGdipBitmapScreenDpi,
            ImageAlign = ContentAlignment.MiddleLeft,
            Padding = new Padding(20, 0, 0, 0)
              });

              Controls.Add(myLoggedPanel);
              Controls.Add(myNonLoggedPanel);

              InitLoginState();
        }
コード例 #11
0
        public ProductSettingsTracker(Lifetime lifetime, ClientFactory clientFactory, IViewable<ISyncSource> syncSources, IFileSystemTracker fileSystemTracker, JetBoxSettingsStorage jetBoxSettings)
        {
            myClientFactory = clientFactory;
              mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              mySettingsStore.Changed.Advise(lifetime, _ => InitClient());

              myRootFolder = FileSystemPath.Parse("ReSharperPlatform");
              InitClient();

              syncSources.View(lifetime, (lt1, source) =>
            source.FilesToSync.View(lt1, (lt2, fileToSync) =>
            {
              SyncFromCloud(fileToSync.Value);

              var fileTrackingLifetime = new SequentialLifetimes(lt2);
              fileToSync.Change.Advise(lt2,
            args =>
            {
              var path = args.Property.Value;
              if (lifetime.IsTerminated || path.IsNullOrEmpty())
              {
                fileTrackingLifetime.TerminateCurrent();
              }
              else
              {
                fileTrackingLifetime.Next(lt =>
                    fileSystemTracker.AdviseFileChanges(lt, path,
                      delta => delta.Accept(new FileChangesVisitor(myClient, myRootFolder))));
              }
            });
            }));
        }
コード例 #12
0
 public ShaderLabFormattingStylePageSchema(Lifetime lifetime,
                                           [NotNull] IContextBoundSettingsStoreLive smartContext,
                                           [NotNull] IValueEditorViewModelFactory itemViewModelFactory,
                                           IComponentContainer container, ISettingsToHide settingsToHide)
     : base(lifetime, smartContext, itemViewModelFactory, container, settingsToHide)
 {
 }
コード例 #13
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus, OpensUri opensUri)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
            myOpensUri      = opensUri;

            myClient           = clientFactory.CreateClient();
            myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

            // init UI
            myLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true
            };
            myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
            myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

            myNonLoggedPanel = new FlowLayoutPanel {
                Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown
            };
            myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus));
            myNonLoggedPanel.Controls.Add(new LinkLabel("Get access (click after approving access on the web)", GetInfo, jetPopupMenus));

            Controls.Add(myLoggedPanel);
            Controls.Add(myNonLoggedPanel);

            InitLoginState();
        }
コード例 #14
0
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution, PluginPathsProvider pluginPathsProvider,
                                   ISettingsStore settingsStore, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker, IThreading threading)
        {
            myComponentLifetime   = lifetime;
            myLogger              = logger;
            myDispatcher          = dispatcher;
            myLocks               = locks;
            mySolution            = solution;
            myPluginPathsProvider = pluginPathsProvider;
            myUsageStatistics     = usageStatistics;
            myThreading           = threading;
            myHost = host;
            myBoundSettingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes   = new SequentialLifetimes(lifetime);

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) =>
            {
                if (!args)
                {
                    return;
                }

                var solFolder = mySolution.SolutionFilePath.Directory;
                AdviseModelData(lifetime);

                // todo: consider non-Unity Solution with Unity-generated projects
                var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");
                protocolInstancePath.Directory.CreateDirectory();

                var watcher          = new FileSystemWatcher();
                watcher.Path         = protocolInstancePath.Directory.FullPath;
                watcher.NotifyFilter =
                    NotifyFilters.LastAccess |
                    NotifyFilters.LastWrite; //Watch for changes in LastAccess and LastWrite times
                watcher.Filter = protocolInstancePath.Name;

                // Add event handlers.
                watcher.Changed += OnChanged;
                watcher.Created += OnChanged;

                lf.Bracket(() => { }, () =>
                {
                    watcher.Dispose();
                });

                watcher.EnableRaisingEvents = true; // Begin watching.
                // connect on start of Rider
                CreateProtocols(protocolInstancePath);
            });
        }
コード例 #15
0
 public UnitySettingsSynchronizer(
     Lifetime lifetime,
     ISolution solution,
     SolutionModel solutionModel,
     ISettingsStore settingsStore)
 {
     myLifetime      = lifetime;
     mySolutionModel = solutionModel;
     myBoundStore    = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
 }
コード例 #16
0
 public UnitySettingsSynchronizer(
     Lifetime lifetime,
     ISolution solution,
     UnityHost host,
     ISettingsStore settingsStore)
 {
     myLifetime   = lifetime;
     myHost       = host;
     myBoundStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
 }
コード例 #17
0
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution, PluginPathsProvider pluginPathsProvider,
                                   ISettingsStore settingsStore, Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker)
        {
            myComponentLifetime   = lifetime;
            myLogger              = logger;
            myDispatcher          = dispatcher;
            myLocks               = locks;
            mySolution            = solution;
            myPluginPathsProvider = pluginPathsProvider;
            myUsageStatistics     = usageStatistics;
            myHost = host;
            myBoundSettingsStore =
                settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes = new SequentialLifetimes(lifetime);
            myUnityModel       = new Property <EditorPluginModel>(lifetime, "unityModelProperty", null)
                                 .EnsureReadonly(myReadonlyToken).EnsureThisThread();

            if (!unitySolutionTracker.IsAbleToEstablishProtocolConnectionWithUnity.Value)
            {
                return;
            }

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            var solFolder = mySolution.SolutionFilePath.Directory;

            AdviseModelData(lifetime, mySolution.GetProtocolSolution());

            // todo: consider non-Unity Solution with Unity-generated projects
            var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");

            protocolInstancePath.Directory.CreateDirectory();

            var watcher = new FileSystemWatcher();

            watcher.Path         = protocolInstancePath.Directory.FullPath;
            watcher.NotifyFilter =
                NotifyFilters.LastAccess |
                NotifyFilters.LastWrite; //Watch for changes in LastAccess and LastWrite times
            watcher.Filter = protocolInstancePath.Name;

            // Add event handlers.
            watcher.Changed += OnChanged;
            watcher.Created += OnChanged;

            watcher.EnableRaisingEvents = true; // Begin watching.

            // connect on start of Rider
            CreateProtocols(protocolInstancePath);
        }
コード例 #18
0
 public static IStylerOptions FromSettings(
     IContextBoundSettingsStoreLive settings,
     [CanBeNull] ISolution solution,
     [CanBeNull] IProject project,
     [CanBeNull] IPsiSourceFileWithLocation psiSourceFileWithLocation)
 {
     return(FromSettings(
                settings: settings,
                solution: solution,
                projectPath: project?.ProjectFileLocation?.FullPath,
                sourceFilePath: psiSourceFileWithLocation?.Location.FullPath));
 }
コード例 #19
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            NotificationsModel notifications,
            ISettingsStore settingsStore,
            PluginPathsProvider pluginPathsProvider,
            UnityVersion unityVersion,
            UnityHost unityHost,
            UnitySolutionTracker unitySolutionTracker,
            UnityRefresher refresher)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime             = lifetime;
            myLogger               = logger;
            mySolution             = solution;
            myShellLocks           = shellLocks;
            myDetector             = detector;
            myNotifications        = notifications;
            myPluginPathsProvider  = pluginPathsProvider;
            myUnityVersion         = unityVersion;
            myUnitySolutionTracker = unitySolutionTracker;
            myRefresher            = refresher;

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myQueue = new ProcessingQueue(myShellLocks, myLifetime);

            unityHost.PerformModelAction(rdUnityModel =>
            {
                rdUnityModel.InstallEditorPlugin.AdviseNotNull(lifetime, x =>
                {
                    myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnityPluginInstaller.InstallEditorPlugin", () =>
                    {
                        var installationInfo = myDetector.GetInstallationInfo(myCurrentVersion);
                        QueueInstall(installationInfo, true);
                    });
                });
            });

            unitySolutionTracker.IsUnityProjectFolder.AdviseOnce(lifetime, args =>
            {
                if (!args)
                {
                    return;
                }
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "IsAbleToEstablishProtocolConnectionWithUnity", InstallPluginIfRequired);
                BindToInstallationSettingChange();
            });
        }
コード例 #20
0
        public UnityRefresher(IShellLocks locks, Lifetime lifetime, ISolution solution, UnityEditorProtocol pluginProtocolController, ISettingsStore settingsStore)
        {
            myLocks    = locks;
            myLifetime = lifetime;
            mySolution = solution;
            myPluginProtocolController = pluginProtocolController;

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));

            myPluginProtocolController.Refresh.Advise(lifetime, Refresh);
        }
コード例 #21
0
        public UnityRefresher(IShellLocks locks, Lifetime lifetime, ISolution solution,
                              UnityEditorProtocol editorProtocol, ISettingsStore settingsStore,
                              ILogger logger)
        {
            myLocks          = locks;
            myLifetime       = lifetime;
            mySolution       = solution;
            myEditorProtocol = editorProtocol;
            myLogger         = logger;

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
        }
コード例 #22
0
        public BackendUnityProtocol(Lifetime lifetime, ILogger logger,
                                    BackendUnityHost backendUnityHost, FrontendBackendHost frontendBackendHost,
                                    IScheduler dispatcher, IShellLocks locks, ISolution solution,
                                    IApplicationWideContextBoundSettingStore settingsStore,
                                    UnitySolutionTracker unitySolutionTracker,
                                    UnityVersion unityVersion, NotificationsModel notificationsModel,
                                    IHostProductInfo hostProductInfo, IFileSystemTracker fileSystemTracker)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime            = lifetime;
            myLogger              = logger;
            myBackendUnityHost    = backendUnityHost;
            myDispatcher          = dispatcher;
            myLocks               = locks;
            mySolution            = solution;
            myUnityVersion        = unityVersion;
            myNotificationsModel  = notificationsModel;
            myHostProductInfo     = hostProductInfo;
            myFrontendBackendHost = frontendBackendHost;
            myBoundSettingsStore  = settingsStore.BoundSettingsStore;
            mySessionLifetimes    = new SequentialLifetimes(lifetime);

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) =>
            {
                if (!args)
                {
                    return;
                }

                var solFolder = mySolution.SolutionDirectory;

                // todo: consider non-Unity Solution with Unity-generated projects
                var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");
                fileSystemTracker.AdviseFileChanges(lf, protocolInstancePath, OnProtocolInstanceJsonChange);

                // connect on start of Rider
                CreateProtocol(protocolInstancePath);
            });
        }
コード例 #23
0
        public UnityEditorProtocol(Lifetime lifetime, ILogger logger, UnityHost host,
                                   IScheduler dispatcher, IShellLocks locks, ISolution solution,
                                   ISettingsStore settingsStore, JetBrains.Application.ActivityTrackingNew.UsageStatistics usageStatistics,
                                   UnitySolutionTracker unitySolutionTracker, IThreading threading,
                                   UnityVersion unityVersion, NotificationsModel notificationsModel,
                                   IHostProductInfo hostProductInfo, IFileSystemTracker fileSystemTracker)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myComponentLifetime  = lifetime;
            myLogger             = logger;
            myDispatcher         = dispatcher;
            myLocks              = locks;
            mySolution           = solution;
            myUsageStatistics    = usageStatistics;
            myThreading          = threading;
            myUnityVersion       = unityVersion;
            myNotificationsModel = notificationsModel;
            myHostProductInfo    = hostProductInfo;
            myHost = host;
            myBoundSettingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext()));
            mySessionLifetimes   = new SequentialLifetimes(lifetime);

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) =>
            {
                if (!args)
                {
                    return;
                }

                var solFolder = mySolution.SolutionDirectory;
                AdviseModelData(lifetime);

                // todo: consider non-Unity Solution with Unity-generated projects
                var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json");
                fileSystemTracker.AdviseFileChanges(lf, protocolInstancePath, OnChangeAction);
                // connect on start of Rider
                CreateProtocols(protocolInstancePath);
            });
        }
コード例 #24
0
ファイル: TestCache.cs プロジェクト: sergeyt/karma-resharper
		public TestCache(Lifetime lifetime, ISolution solution, IUnitTestingSettingsAccessor settingsAccessor,
			IShellLocks shellLocks, IPsiConfiguration psiConfiguration, ISettingsStore settingsStore,
			KarmaTestProvider testProvider, JasmineElementFactory jasmineFactory,
			IPersistentIndexManager persistentIndexManager, IJavaScriptDependencyManager javaScriptDependencyManager)
		{
			_lifetime = lifetime;
			_solution = solution;
			_settingsAccessor = settingsAccessor;
			_shellLocks = shellLocks;
			_psiConfiguration = psiConfiguration;
			_testProvider = testProvider;
			myJasmineFactory = jasmineFactory;
			_persistentIndexManager = persistentIndexManager;
			_javaScriptDependencyManager = javaScriptDependencyManager;
			_settingsStore = settingsStore.BindToContextLive(lifetime, ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()), BindToContextFlags.Normal);
			_settingsStore.Changed.Advise(lifetime, OnSettingsChange);
			Active = new Property<bool>(lifetime, "KarmaTestCache", true);
		}
コード例 #25
0
ファイル: TestCache.cs プロジェクト: sergeyt/karma-resharper
 public TestCache(Lifetime lifetime, ISolution solution, IUnitTestingSettingsAccessor settingsAccessor,
                  IShellLocks shellLocks, IPsiConfiguration psiConfiguration, ISettingsStore settingsStore,
                  KarmaTestProvider testProvider, JasmineElementFactory jasmineFactory,
                  IPersistentIndexManager persistentIndexManager, IJavaScriptDependencyManager javaScriptDependencyManager)
 {
     _lifetime                    = lifetime;
     _solution                    = solution;
     _settingsAccessor            = settingsAccessor;
     _shellLocks                  = shellLocks;
     _psiConfiguration            = psiConfiguration;
     _testProvider                = testProvider;
     myJasmineFactory             = jasmineFactory;
     _persistentIndexManager      = persistentIndexManager;
     _javaScriptDependencyManager = javaScriptDependencyManager;
     _settingsStore               = settingsStore.BindToContextLive(lifetime, ContextRange.ManuallyRestrictWritesToOneContext(solution.ToDataContext()), BindToContextFlags.Normal);
     _settingsStore.Changed.Advise(lifetime, OnSettingsChange);
     Active = new Property <bool>(lifetime, "KarmaTestCache", true);
 }
コード例 #26
0
        private void CreateCheckboxUsePredefined(Lifetime lifetime, IContextBoundSettingsStoreLive storeOptionsTransactionContext)
        {
            IProperty <bool> property = new Property <bool>(lifetime, "Exceptional::ExceptionTypesAsHint::UsePredefined");

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

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

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

            AddBoolOption((Settings.ExceptionalSettings key) => key.UseDefaultOptionalExceptions2, OptionsLabels.ExceptionTypesAsHint.UsePredefined);
        }
コード例 #27
0
        private void CreateCheckboxInspectPublic(Lifetime lifetime, IContextBoundSettingsStoreLive storeOptionsTransactionContext)
        {
            IProperty <bool> property = new Property <bool>(lifetime, "Exceptional::General::DelegateInvocationsMayThrowSystemException");

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

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

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

            AddBoolOption((Settings.ExceptionalSettings key) => key.DelegateInvocationsMayThrowExceptions, OptionsLabels.General.DelegateInvocationsMayThrowSystemException);
        }
コード例 #28
0
        private static void BindSettingToProperty <TKeyClass, TEntryMemberType>(
            Lifetime lifetime, ISolution solution, FrontendBackendHost frontendBackendHost,
            IContextBoundSettingsStoreLive boundStore,
            Expression <Func <TKeyClass, TEntryMemberType> > entry,
            Action <FrontendBackendModel, PropertyChangedEventArgs <TEntryMemberType> > action)
        {
            var name    = entry.GetInstanceMemberName();
            var setting = boundStore.Schema.GetScalarEntry(entry);

            boundStore.GetValueProperty <TEntryMemberType>(lifetime, setting, null).Change.Advise_HasNew(lifetime,
                                                                                                         args =>
            {
                solution.Locks.ExecuteOrQueueEx(lifetime, name, () =>
                {
                    frontendBackendHost.Do(m => action(m, args));
                });
            });
        }
コード例 #29
0
        private void CreateCheckboxInspectPrivate(Lifetime lifetime, IContextBoundSettingsStoreLive storeOptionsTransactionContext)
        {
            IProperty <bool> property = new Property <bool>(lifetime, "Exceptional::InspectionLevel::InspectPrivateMethodsAndProperties");

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

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

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

            AddBoolOption((Settings.ExceptionalSettings key) => key.InspectPrivateMethods, OptionsLabels.InspectionLevel.InspectPrivateMethodsAndProperties);
        }
コード例 #30
0
        public UnrealPluginInstaller(Lifetime lifetime, ILogger logger, UnrealPluginDetector pluginDetector,
                                     PluginPathsProvider pathsProvider, ISolution solution, ISettingsStore settingsStore,
                                     IShellLocks shellLocks, UnrealHost unrealHost)
        {
            myLifetime           = lifetime;
            myLogger             = logger;
            myPathsProvider      = pathsProvider;
            myShellLocks         = shellLocks;
            myUnrealHost         = unrealHost;
            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));
            myPluginDetector     = pluginDetector;

            myPluginDetector.InstallInfoProperty.Change.Advise_NewNotNull(myLifetime, installInfo =>
            {
                myShellLocks.ExecuteOrQueueReadLockEx(myLifetime, "UnrealPluginInstaller.CheckAllProjectsIfAutoInstallEnabled",
                                                      () =>
                {
                    var unrealPluginInstallInfo = installInfo.New;
                    if (unrealPluginInstallInfo.EnginePlugin.IsPluginAvailable)
                    {
                        // TODO: add install plugin to Engine
                    }
                    ;

                    if (!myBoundSettingsStore.GetValue((UnrealLinkSettings s) => s.InstallRiderLinkPlugin))
                    {
                        foreach (var installDescription in unrealPluginInstallInfo.ProjectPlugins)
                        {
                            if (installDescription.IsPluginAvailable == false ||
                                installDescription.PluginVersion != myPathsProvider.CurrentPluginVersion)
                            {
                                myUnrealHost.PerformModelAction(model => model.OnEditorModelOutOfSync());
                            }
                        }

                        return;
                    }

                    InstallPluginIfRequired(unrealPluginInstallInfo);
                });
            });
            BindToInstallationSettingChange();
            BindToNotificationFixAction();
        }
コード例 #31
0
        public UnityRefresher(IShellLocks locks, Lifetime lifetime, ISolution solution,
                              BackendUnityHost backendUnityHost,
                              IApplicationWideContextBoundSettingStore settingsStore,
                              ILogger logger, UnityVersion unityVersion)
        {
            myLocks            = locks;
            myLifetime         = lifetime;
            mySolution         = solution;
            myBackendUnityHost = backendUnityHost;
            myLogger           = logger;
            myUnityVersion     = unityVersion;

            if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
            {
                return;
            }

            myBoundSettingsStore = settingsStore.BoundSettingsStore;
        }
コード例 #32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IntSliderViewModel"/> class.
        /// </summary>
        /// <param name="lifetime">
        /// The lifetime of the view model
        /// </param>
        /// <param name="context">
        /// The settings context
        /// </param>
        /// <param name="settingsScalarEntry">
        /// The settings entry this view model is bound to
        /// </param>
        /// <param name="text">
        /// The text to display for this option
        /// </param>
        /// <param name="minValue">
        /// The minimum allowed value
        /// </param>
        /// <param name="maxValue">
        /// The maximum allowed value
        /// </param>
        /// <param name="minValueText">
        /// The text to be displayed next to the lower end of the slider
        /// </param>
        /// <param name="maxValueText">
        /// The text to be displayed next to the upper end of the slider
        /// </param>
        /// <param name="toolTipText">
        /// The text to be shown in a tooltip. If left null, defaults to the description of the bound settings entry
        /// </param>
        public IntSliderViewModel(
            Lifetime lifetime,
            IContextBoundSettingsStoreLive context,
            SettingsScalarEntry settingsScalarEntry,
            string text,
            int minValue,
            int maxValue,
            string minValueText,
            string maxValueText,
            string toolTipText)
        {
            this.Text = text;
            this.MinValue = minValue;
            this.MaxValue = maxValue;
            this.MinValueText = minValueText;
            this.MaxValueText = maxValueText;
            this.ToolTipText = toolTipText ?? settingsScalarEntry.Description;
            this.IntProperty = new Property<int>(lifetime, "IntProperty");
            this.IsEnabledProperty = new Property<bool>(lifetime, "IntProperty") { Value = true };

            context.SetBinding(lifetime, settingsScalarEntry, this.IntProperty);
        }
コード例 #33
0
        public JetBoxOptionsPage(Lifetime lifetime, IUIApplication environment, ClientFactory clientFactory, JetBoxSettingsStorage jetBoxSettings, JetPopupMenus jetPopupMenus, OpensUri opensUri)
            : base(lifetime, environment, PID)
        {
            mySettingsStore = jetBoxSettings.SettingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
              myOpensUri = opensUri;

              myClient = clientFactory.CreateClient();
              myClient.UserLogin = mySettingsStore.GetValue(JetBoxSettingsAccessor.Login);

              // init UI
              myLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true };
              myLoggedPanel.Controls.Add(myLoginLabel = new RichTextLabel(environment));
              myLoggedPanel.Controls.Add(new LinkLabel("Logout", Logout, jetPopupMenus));

              myNonLoggedPanel = new FlowLayoutPanel { Visible = false, AutoSize = true, FlowDirection = FlowDirection.TopDown };
              myNonLoggedPanel.Controls.Add(new LinkLabel("Login", Login, jetPopupMenus));
              myNonLoggedPanel.Controls.Add(new LinkLabel("Get access (click after approving access on the web)", GetInfo, jetPopupMenus));

              Controls.Add(myLoggedPanel);
              Controls.Add(myNonLoggedPanel);

              InitLoginState();
        }
コード例 #34
0
        public UnityPluginInstaller(
            Lifetime lifetime,
            ILogger logger,
            ISolution solution,
            IShellLocks shellLocks,
            UnityPluginDetector detector,
            RdNotificationsModel notifications,
            ISettingsStore settingsStore,
            ProjectReferenceChangeTracker changeTracker)
        {
            myPluginInstallations = new JetHashSet <FileSystemPath>();

            myLifetime           = lifetime;
            myLogger             = logger;
            mySolution           = solution;
            myShellLocks         = shellLocks;
            myDetector           = detector;
            myNotifications      = notifications;
            myBoundSettingsStore = settingsStore.BindToContextLive(myLifetime, ContextRange.Smart(solution.ToDataContext()));

            BindToInstallationSettingChange();

            changeTracker.RegisterProjectChangeHandler(InstallPluginIfRequired);
        }
コード例 #35
0
        public UnrealPluginInstaller(Lifetime lifetime, ILogger logger, UnrealPluginDetector pluginDetector,
                                     PluginPathsProvider pathsProvider, ISolution solution, ISettingsStore settingsStore, UnrealHost unrealHost,
                                     NotificationsModel notificationsModel, RiderBackgroundTaskHost backgroundTaskHost)
        {
            Lifetime             = lifetime;
            myLogger             = logger;
            myPathsProvider      = pathsProvider;
            mySolution           = solution;
            myUnrealHost         = unrealHost;
            myNotificationsModel = notificationsModel;
            myBackgroundTaskHost = backgroundTaskHost;
            myBoundSettingsStore =
                settingsStore.BindToContextLive(Lifetime, ContextRange.Smart(solution.ToDataContext()));
            myPluginDetector = pluginDetector;

            myPluginDetector.InstallInfoProperty.Change.Advise_NewNotNull(Lifetime, installInfo =>
            {
                mySolution.Locks.ExecuteOrQueueReadLockEx(Lifetime,
                                                          "UnrealPluginInstaller.CheckAllProjectsIfAutoInstallEnabled",
                                                          () => { HandleAutoUpdatePlugin(installInfo.New); });
            });
            BindToInstallationSettingChange();
            BindToNotificationFixAction();
        }
コード例 #36
0
 public YouTrackService(ISettingsStore store, IVsWebBrowsingService wbs, Lifetime lifetime)
 {
     this.wbs = wbs;
       this.lifetime = lifetime;
       this.store = store.BindToContextLive(lifetime, ContextRange.ApplicationWide);
 }
コード例 #37
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>
        /// <param name="container">
        /// The component container
        /// </param>
        public StyleCopOptionsPage(
            Lifetime lifetime,
            OptionsSettingsSmartContext settingsSmartContext,
            IComponentContainer container)
            : base(lifetime, settingsSmartContext)
        {
            IContextBoundSettingsStoreLive settingsContext =
                this.OptionsSettingsSmartContext.StoreOptionsTransactionContext;

            this.originalEnablePlugins =
                settingsContext.GetValue((StyleCopOptionsSettingsKey options) => options.PluginsEnabled);
            this.originalPluginsPath =
                settingsContext.GetValue((StyleCopOptionsSettingsKey options) => options.PluginsPath);

            this.AddHeader("Version");

            Assembly assembly            = typeof(StyleCopEnvironment).Assembly;
            string   styleCopFileVersion = GetFileVersionInfo(assembly);

            this.AddText(string.Format("StyleCop.dll {0} ({1})", assembly.GetName().Version, styleCopFileVersion));

            assembly = this.GetType().Assembly;
            string ourFileVersion = GetFileVersionInfo(assembly);

            this.AddText(string.Format("StyleCop.ReSharper.dll {0} ({1})", assembly.GetName().Version, ourFileVersion));

            if (ourFileVersion != styleCopFileVersion)
            {
                TextStyle style = new TextStyle(FontStyle.Bold, Color.Empty, Color.Empty);
                this.AddRichText(
                    new RichText(
                        "Mismatched StyleCop.dll version! Are you running an older version of the Visual Studio plugin?",
                        style));
            }

            this.AddHeader("Options");

            // 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("Analysis Performance");
            if (DoesHostSupportRoslynAnalzyers(container))
            {
                this.AddText(
                    "Note: Analysis is automatically disabled if the project references the StyleCop.Analyzers NuGet package, which provides StyleCop analysis for Visual Studio 2015 and C# 6.");
            }

            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("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("StyleCop Plugins");
            this.AddBoolOption(
                (StyleCopOptionsSettingsKey options) => options.PluginsEnabled,
                "Enable StyleCop plugins");
            this.AddText("Location of StyleCop plugins:");
            Property <FileSystemPath> pluginsPath = this.SetupPluginsPathProperty(lifetime);
            FileChooserViewModel      fileChooser = this.AddFolderChooserOption(
                pluginsPath,
                "Location of StyleCop plugins",
                FileSystemPath.Empty);

            fileChooser.IsEnabledProperty.SetValue(true);
            this.AddBinding(
                fileChooser,
                BindingStyle.IsEnabledProperty,
                (StyleCopOptionsSettingsKey options) => options.PluginsEnabled,
                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();
        }