Inheritance: PlayerAttribute
        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();
        }
コード例 #2
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();
        }
コード例 #3
0
        public static Animation CreateCounterExample2(Lifetime life)
        {
            var animation = new Animation();

            var state = Ani.Anon(step => {
                var t = (step.TotalSeconds * 8).SmoothCycle(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);

                var t1 = TimeSpan.Zero;
                var t2 = t.Seconds();

                var ra = new EndPoint("Robot A", skew: 0.Seconds() + t1);
                var rb = new EndPoint("Robot B", skew: 0.Seconds() + t2);

                var graph = new EndPointGraph(
                    new[] { ra, rb },
                    new Dictionary<Tuple<EndPoint, EndPoint>, TimeSpan> {
                        {Tuple.Create(ra, rb), 2.Seconds() + t2 - t1},
                        {Tuple.Create(rb, ra), 2.Seconds() + t1 - t2},
                    });

                var m1 = new Message("I think it's t=0s.", graph, ra, rb, ra.Skew + 0.Seconds());
                var m2 = new Message("Received at t=2s", graph, rb, ra, m1.ArrivalTime);

                var s1 = new Measurement("Apparent Time Mistake = 2s+2s", ra, ra, m2.ArrivalTime, m2.ArrivalTime + 4.Seconds(), 60);
                var s2 = new Measurement("Time mistake = RTT - 4s", ra, ra, m2.ArrivalTime + 4.Seconds(), m2.ArrivalTime + 4.Seconds(), 140);

                return new GraphMessages(graph, new[] { m1, m2}, new[] { s1, s2});
            });

            return CreateNetworkAnimation(animation, state, life);
        }
コード例 #4
0
        /// <summary>
        /// The initializer for this ShellComponent.
        /// </summary>
        /// <param name="lifetime">
        /// The lifetime for this object.
        /// </param>
        private void Init(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 (!CodeStyleOptions.CodeStyleOptionsValid(settings, Core.Utils.GetSolution()))
                    {
                        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)
                        {
                            CodeStyleOptions.CodeStyleOptionsReset(settings, Core.Utils.GetSolution());
                        }
                    }
                }
            }

            registryUtils.CUSetValue("LastInitializationDate", todayAsString);
        }
コード例 #5
0
        public UpdatesNotifier(Lifetime lifetime, UpdatesManager updatesManager)
        {
            var uri = new Uri("https://raw.github.com/hmemcpy/Nancy-ReSharper-Plugin/master/updates.xslt");

            var category = updatesManager.Categories.AddOrActivate("NancyFxSupport", uri);
            category.CustomizeLocalEnvironmentInfo.Advise(lifetime, args =>
            {
                // We can customize the local environment info that the xslt will be applied to
                // It should be an instance of UpdateLocalEnvironmentInfo, bail out early if it's
                // not. The only reason it wouldn't be is if someone has got hold of the "NancyFxSupport"
                // category and subscribed to the CustomizeLocalEnvironmentInfo signal. Unlikely.
                if (!(args.Out is UpdateLocalEnvironmentInfoVs))
                    return;

                // Set the data the xslt will be applied against. Pass in the current environment,
                // in case we ever need it, but really, we only care about the current version
                args.Out = new PluginLocalEnvironmentInfo
                {
                    LocalEnvironment = args.Out as UpdateLocalEnvironmentInfoVs,
                    PluginVersion = new UpdateLocalEnvironmentInfo.VersionSubInfo(GetThisVersion())
                };
            });

            RemoveStaleUpdateNotification(category);
        }
コード例 #6
0
        private static ToolStripMenuItem BindCommand(this ToolStripDropDown dropDown, Lifetime<ICommand> command, object argument)
        {
            ToolStripMenuItem item = dropDown.Add(string.Empty);
            item.Tag = new ToolStripItemCommandBinding(dropDown, item, command, argument);

            return item;
        }
コード例 #7
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();
 }
コード例 #8
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))));
              }
            });
            }));
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExternalBuildPlan"/> class.
 /// </summary>
 /// <param name="services">Services that the build plan is for</param>
 /// <param name="lifetime">The lifetime.</param>
 /// <param name="instanceStrategy">The instance strategy.</param>
 public ExternalBuildPlan(IEnumerable<Type> services, Lifetime lifetime, IInstanceStrategy instanceStrategy)
 {
     if (instanceStrategy == null) throw new ArgumentNullException("instanceStrategy");
     _lifetime = lifetime;
     _instanceStrategy = instanceStrategy;
     Services = services.ToArray();
 }
コード例 #10
0
 public GlobalProductSyncSource(Lifetime lifetime, GlobalPerProductStorage globalPerProductStorage)
 {
     FilesToSync = new CollectionEvents<IProperty<FileSystemPath>>(lifetime, "GlobalProductSyncSource")
       {
     globalPerProductStorage.XmlFileStorage.Path
       };
 }
コード例 #11
0
 public GraphCodeWindowRegistrar(Lifetime lifetime, ToolWindowManager toolWindowManager,
                                     GraphCodeToolWindow descriptor, UIApplication environment)
 {
     _environment = environment;
     _lifetime = lifetime;
     
     _toolWindowClass = toolWindowManager.Classes[descriptor];
     //_toolWindowClass.RegisterEmptyContent(
     //  lifetime,
     //  lt =>
     //  {
     //      var graphs = (new GraphLoader()).Load();
     //      var tabControl = new System.Windows.Controls.TabControl();
     //      var zcontrols = new List<ZoomControl>();
     //      foreach (var graph in graphs)
     //      {
     //          var gArea = InitializeGraphArea.Initialize(graph);
     //          var zcontrol = new ZoomControl();
     //          zcontrol.Content = gArea;
     //          zcontrols.Add(zcontrol);
     //      }
     //      tabControl.ItemsSource = zcontrols;
     //      return (new EitherControl(tabControl)).BindToLifetime(lt);
     //  });
 }
コード例 #12
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);
    }
 public Stream GetDefaultSettingsStream(Lifetime lifetime)
 {
     var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("JetBrains.ReSharper.Plugins.CyclomaticComplexity.Resources.DefaultSettings.xml");
       Assertion.Assert(stream != null, "stream != null");
       lifetime.AddDispose(stream);
       return stream;
 }
コード例 #14
0
 public NancyReferenceProviderFactory(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore, MvcReferenceProviderValidator providerValidator)
 {
     this.solution = solution;
     
     lifetime.AddBracket(() => providerValidator.OnChanged += FireOnChanged,
                         () => providerValidator.OnChanged -= FireOnChanged);
 }
コード例 #15
0
        public void Add(Severity severity, 
                        Lifetime lifeTime, 
                        Scope scope, 
                        IPrincipal principal, 
                        string title, 
                        string message, 
                        params NotificationAction[] actions)
        {
            if (scope == Scope.User && principal == null)
                throw new ArgumentNullException("principal", "Argument cannot be null when Scope is 'User'.");

            var note = new Notification(Guid.NewGuid(), 
                                        DateTime.UtcNow, 
                                        severity, 
                                        lifeTime, 
                                        scope, 
                                        title, 
                                        message, 
                                        actions);
            if (scope == Scope.User)
            {
                var userNotifications = this._userNotifications.GetOrAdd(principal.Identity.Name, 
                                                                         s => new ConcurrentDictionary<Guid, Notification>());

                if (!userNotifications.TryAdd(note.Id, note))
                    throw new ReadOnlyException("Failed to add notifications.");
            }
            else
            {
                if (!this._notifications.TryAdd(note.Id, note))
                    throw new ReadOnlyException("Failed to add notifications.");
            }
        }
コード例 #16
0
        public void Add(Severity severity, Lifetime lifeTime, Scope scope, string title, string message, params NotificationAction[] actions)
        {
            if (scope == Scope.User)
                throw new ArgumentException("Scope 'User' is not allowed for this overload as no IPrincipal is provided.", "scope");

            this.Add(severity, lifeTime, scope, null, title, message, actions);
        }
コード例 #17
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);
        }
コード例 #18
0
 public Stream GetDefaultSettingsStream(Lifetime lifetime)
 {
   var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("JetBrains.ReSharper.PowerToys.ZenCoding.resources.PredefinedZenCodingSettings.xml");
   Assertion.AssertNotNull(stream, "stream == null");
   lifetime.AddDispose(stream);
   return stream;
 }
コード例 #19
0
        public static ILifetimeStrategy Get(Lifetime lifetime, INCopDependencyResolver container)
        {
            switch (lifetime) {
                case Lifetime.None:
                    return defaultLifetimeStrategy;

                case Lifetime.PerThread :
                    return PerThreadLifetimeStrategy.Instance;

                case Lifetime.HttpRequest:
                    return HttpRequestLifetimeStrategy.Instance;

                case Lifetime.Hierarchy:
                    return new HierarchySingletonLifetimeStrategy();

                case Lifetime.Container:
                    return new ContainerSingletonLifetimeStrategy(container);

                case Lifetime.HybridRequest:
                    return hybridRequestLifetimeStrategy;

                default:
                    throw new ResolutionException(Resources.UnknownLifetime);
            }
        }
コード例 #20
0
ファイル: Solution.cs プロジェクト: derigel23/Nitra
    public void Open(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus)
    {
      Debug.Assert(!IsOpened);

      _solution = solution;
      DocumentManager = documentManager;
      _jetPopupMenus = jetPopupMenus;
      changeManager.Changed2.Advise(lifetime, Handler);
      lifetime.AddAction(Close);
      var expandAction = actionManager.Defs.TryGetActionDefById(GotoDeclarationAction.ACTION_ID);
      if (expandAction != null)
      {
        var postfixHandler = new GotoDeclarationHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

        lifetime.AddBracket(
          FOpening: () => actionManager.Handlers.AddHandler(expandAction, postfixHandler),
          FClosing: () => actionManager.Handlers.RemoveHandler(expandAction, postfixHandler));
      }
      
      var findUsagesAction = actionManager.Defs.GetActionDef<FindUsagesAction>();
      var findUsagesHandler = new FindUsagesHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

      lifetime.AddBracket(
        FOpening: () => actionManager.Handlers.AddHandler(findUsagesAction, findUsagesHandler),
        FClosing: () => actionManager.Handlers.RemoveHandler(findUsagesAction, findUsagesHandler));
    }
コード例 #21
0
        private ILookup<string, FileSystemPath> installedPackages; // there can be several versions of one package (different versions)

        #endregion Fields

        #region Constructors

        public NuGetApi(ISolution solution, Lifetime lifetime, IComponentModel componentModel, IThreading threading, ProjectModelSynchronizer projectModelSynchronizer)
        {
            this.solution = solution;
            this.threading = threading;
            this.projectModelSynchronizer = projectModelSynchronizer;
            try
            {
                vsPackageInstallerServices = componentModel.GetExtensions<IVsPackageInstallerServices>().SingleOrDefault();
                vsPackageInstaller = componentModel.GetExtensions<IVsPackageInstaller>().SingleOrDefault();
                vsPackageInstallerEvents = componentModel.GetExtensions<IVsPackageInstallerEvents>().SingleOrDefault();
            }
            catch (Exception e)
            {
                Logger.LogException("Unable to get NuGet interfaces.", e);
            }

            if (!IsNuGetAvailable)
            {
                Logger.LogMessage(LoggingLevel.VERBOSE, "[NUGET PLUGIN] Unable to get NuGet interfaces. No exception thrown");
                return;
            }

            lifetime.AddBracket(
              () => vsPackageInstallerEvents.PackageInstalled += RecalcInstalledPackages,
              () => vsPackageInstallerEvents.PackageInstalled -= RecalcInstalledPackages);

              lifetime.AddBracket(
              () => vsPackageInstallerEvents.PackageUninstalled += RecalcInstalledPackages,
              () => vsPackageInstallerEvents.PackageUninstalled -= RecalcInstalledPackages);

              RecalcInstalledPackages(null);
        }
コード例 #22
0
 public MockMetricsOptionPage(Lifetime lifetime, UIApplication environment, OptionsSettingsSmartContext settings)
     : base(lifetime, environment, PID)
 {
     myLifetime = lifetime;
     mySettings = settings;
     InitControls();
 }
コード例 #23
0
 public PsiCodeFormatter(Lifetime lifetime, PsiLanguage language, ISettingsStore settingsStore, IViewable<IPsiCodeFormatterExtension> extensions, ISettingsOptimization settingsOptimization)
   : base(settingsStore)
 {
   myLanguage = language;
   myExtensions = extensions.ToLiveEnumerable(lifetime);
   mySettingsOptimization = settingsOptimization;
 }
コード例 #24
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))));
              }
            });
        }
コード例 #25
0
 public T4PsiModuleProvider([NotNull] Lifetime lifetime, [NotNull] IShellLocks shellLocks, [NotNull] ChangeManager changeManager, [NotNull] T4Environment t4Environment)
 {
     _lifetime = lifetime;
     _shellLocks = shellLocks;
     _changeManager = changeManager;
     _t4Environment = t4Environment;
 }
コード例 #26
0
        public PatternManagerCache(Lifetime lifetime, CacheManagerEx cacheManager, PsiProjectFileTypeCoordinator projectFileTypeCoordinator, SolutionAnalyzer solutionAnalyzer)
        {
            this.projectFileTypeCoordinator = projectFileTypeCoordinator;
            this.solutionAnalyzer = solutionAnalyzer;

            lifetime.AddBracket(() => cacheManager.RegisterCache(this), () => cacheManager.UnregisterCache(this));
        }
コード例 #27
0
    public TypeInterfaceToolWindowRegistrar(Lifetime lifetime,
                                    ToolWindowManager toolWindowManager,
                                    IShellLocks locks,
                                    ISettingsStore settingsStore,
                                    IActionManager actionManager,
                                    IActionBarManager actionBarManager,
                                    IShortcutManager shortcutManager,
                                    TypeInterfaceToolWindowDescriptor toolWindowDescriptor,
                                    ITheming theming,
                                    IThemedIconManager themedIconManager, IColorThemeManager colorThemeManager)
    {
      myLifetime = lifetime;
      myLocks = locks;
      mySettingsStore = settingsStore;
      myActionBarManager = actionBarManager;
      myTheming = theming;
      myThemedIconManager = themedIconManager;
      myColorThemeManager = colorThemeManager;

      myToolWindowClass = toolWindowManager.Classes[toolWindowDescriptor];
      myToolWindowClass.RegisterEmptyContent(
        lifetime,
        lt =>
          {
            var emptyLabel = new RichTextLabel { BackColor = SystemColors.Control, Dock = DockStyle.Fill };
            emptyLabel.RichTextBlock.Add(new RichText("No hierarchies open", new TextStyle(FontStyle.Bold)));
            emptyLabel.RichTextBlock.Add(
              new RichText("Use " + actionManager.GetHowToExecuteAction(shortcutManager, typeof(BrowseTypeHierarchyAction)), TextStyle.Default));
            emptyLabel.RichTextBlock.Add(new RichText("on a type to see hierarchy", TextStyle.Default));
            emptyLabel.RichTextBlock.Parameters = new RichTextBlockParameters(8, ContentAlignment.MiddleCenter);
            return emptyLabel.BindToLifetime(lt);
          });
    }
    /// <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));
    }
コード例 #29
0
 public DisposePluginOptionsPage(Lifetime lifetime, UIApplication environment,
     OptionsSettingsSmartContext settings)
     : base(lifetime, environment, PID)
 {
     _lifetime = lifetime;
     _settings = settings;
     InitControls();
 }
コード例 #30
0
        public void InitModel(Lifetime lifetime, GotoByNameModel model)
        {
            model.IsCheckBoxCheckerVisible.FlowInto(
            lifetime, model.CheckBoxText, flag => flag ? "Middle match" : string.Empty);

              model.CaptionText.Value = "Enter words:";
              model.NotReadyMessage.Value = "Some textual occurances may be missing at the moment";
        }
コード例 #31
0
 public static SequentialScheduler FromIScheduler(string id, Lifetime lifetime, IScheduler scheduler)
 {
     return(new SequentialScheduler(id, lifetime, scheduler as TaskScheduler ?? new SchedulerWrapper(scheduler)));
 }
コード例 #32
0
 public NavigateFromHereAction(Lifetime lifetime, Agent agent, IActionManager actionManager)
 {
     actionHelper = new ExtensibleActionHelper(lifetime, this, agent, actionManager);
 }
コード例 #33
0
 public ModelWithLifetime(EditorPluginModel model, Lifetime lifetime)
 {
     Model    = model;
     Lifetime = lifetime;
 }
 public static void Add <T>(this IServiceCollection serviceCollection, Lifetime lifetime)
 {
     serviceCollection.Add(typeof(T), lifetime);
 }
コード例 #35
0
 public static RegistrationBuilder Register <TInterface, TImplement>(
     this IContainerBuilder builder,
     Lifetime lifetime)
     where TImplement : TInterface
 => builder.Register <TImplement>(lifetime).As <TInterface>();
コード例 #36
0
 public static RegistrationBuilder Register <TInterface>(
     this IContainerBuilder builder,
     Func <IObjectResolver, TInterface> implementationConfiguration,
     Lifetime lifetime)
     where TInterface : class
 => builder.Register(new FuncRegistrationBuilder(implementationConfiguration, typeof(TInterface), lifetime));
コード例 #37
0
 public ComponentRegistrationBuilder AddInNewPrefab <T>(T prefab, Lifetime lifetime)
     where T : MonoBehaviour
 => containerBuilder.RegisterComponentInNewPrefab(prefab, lifetime);
コード例 #38
0
 public ComponentRegistrationBuilder AddOnNewGameObject <T>(Lifetime lifetime, string newGameObjectName = null)
     where T : MonoBehaviour
 => containerBuilder.RegisterComponentOnNewGameObject <T>(lifetime, newGameObjectName);
        public static void Add(this IServiceCollection serviceCollection, Type serviceType, Type implementationType, Lifetime lifetime)
        {
            switch (lifetime)
            {
            case Lifetime.Singleton:
                serviceCollection.AddSingleton(serviceType, implementationType);
                break;

            case Lifetime.Transient:
                serviceCollection.AddTransient(serviceType, implementationType);
                break;

            case Lifetime.Scoped:
                serviceCollection.AddScoped(serviceType, implementationType);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(lifetime), lifetime, null);
            }
        }
 public static void AddTypesImplementing <T>(this IServiceCollection servicecollection, Lifetime lifetime, params string[] assemblies)
 {
     servicecollection.AddTypesImplementing <T>(lifetime, GetAssemblies(assemblies));
 }
コード例 #41
0
 public GenericFindUsagesContextSearch(Lifetime lifetime, ISettingsStore settingsStore) : base(lifetime, settingsStore)
 {
 }
コード例 #42
0
 public AltEnterHandler(Lifetime lifetime, Agent agent)
 {
     this.lifetime   = lifetime;
     this.agent      = agent;
     bulbKeysBuilder = new BulbKeysBuilder();
 }
コード例 #43
0
 public void Advise(Lifetime lifetime, IRdReactive entity)
 {
     RealWire.Advise(lifetime, entity);
 }
コード例 #44
0
 public static RegistrationBuilder RegisterFactory <TParam1, TParam2, T>(
     this IContainerBuilder builder,
     Func <IObjectResolver, Func <TParam1, TParam2, T> > factoryFactory,
     Lifetime lifetime)
 => builder.Register(new FactoryRegistration <TParam1, TParam2, T>(factoryFactory, lifetime));
コード例 #45
0
 public static RegistrationBuilder Register(
     this IContainerBuilder builder,
     Type type,
     Lifetime lifetime)
 => builder.Register(new RegistrationBuilder(type, lifetime));
コード例 #46
0
        private async Task RefreshInternal(Lifetime lifetime, RefreshType refreshType)
        {
            myLocks.ReentrancyGuard.AssertGuarded();

            if (myBackendUnityHost.BackendUnityModel.Value == null)
            {
                return;
            }

            if (!myBackendUnityHost.IsConnectionEstablished())
            {
                return;
            }

            var lifetimeDef = Lifetime.Define(lifetime);

            try
            {
                myLogger.Verbose($"myPluginProtocolController.UnityModel.Value.Refresh.StartAsTask, force = {refreshType} Started");
                mySolution.GetComponent <RiderBackgroundTaskHost>().AddNewTask(lifetimeDef.Lifetime,
                                                                               RiderBackgroundTaskBuilder.Create().WithHeader("Refreshing solution in Unity Editor...")
                                                                               .AsIndeterminate().AsNonCancelable());

                var version = myUnityVersion.ActualVersionForSolution.Value;
                try
                {
                    if (version != null && version.Major < 2018)
                    {
                        using (mySolution.GetComponent <VfsListener>().PauseChanges())
                        {
                            try
                            {
                                await myBackendUnityHost.BackendUnityModel.Value.Refresh.Start(lifetimeDef.Lifetime, refreshType).AsTask();
                            }
                            finally
                            {
                                await myLocks.Tasks.YieldTo(myLifetime, Scheduling.MainGuard);
                            }
                        }
                    }
                    else // it is a risk to pause vfs https://github.com/JetBrains/resharper-unity/issues/1601
                    {
                        await myBackendUnityHost.BackendUnityModel.Value.Refresh.Start(lifetimeDef.Lifetime, refreshType).AsTask();
                    }
                }
                catch (Exception e)
                {
                    myLogger.Warn(e, comment: "connection usually brakes during refresh.");
                }
                finally
                {
                    await myLocks.Tasks.YieldTo(myLifetime, Scheduling.MainGuard);

                    myLogger.Verbose(
                        $"myPluginProtocolController.UnityModel.Value.Refresh.StartAsTask, force = {refreshType} Finished");
                    var solution  = mySolution.GetProtocolSolution();
                    var solFolder = mySolution.SolutionDirectory;
                    var list      = new List <string> {
                        solFolder.FullPath
                    };
                    myLogger.Verbose("RefreshPaths.StartAsTask Finished.");
                    await solution.GetFileSystemModel().RefreshPaths
                    .Start(lifetimeDef.Lifetime, new RdRefreshRequest(list, true)).AsTask();

                    await myLocks.Tasks.YieldTo(myLifetime, Scheduling.MainGuard);
                }
            }
            catch (Exception e)
            {
                myLogger.LogException(e);
            }
            finally
            {
                lifetimeDef.Terminate();
            }
        }
コード例 #47
0
 public static RegistrationBuilder Register <TInterface1, TInterface2, TInterface3, TImplement>(
     this IContainerBuilder builder,
     Lifetime lifetime)
     where TImplement : TInterface1, TInterface2, TInterface3
 => builder.Register <TImplement>(lifetime).As(typeof(TInterface1), typeof(TInterface2), typeof(TInterface3));
コード例 #48
0
 public PerformanceLineMarkerAnalyzer(Lifetime lifetime, ISolution solution,
                                      IApplicationWideContextBoundSettingStore settingsStore)
 {
     LineMarkerStatus = settingsStore.BoundSettingsStore
                        .GetValueProperty(lifetime, (UnitySettings key) => key.PerformanceHighlightingMode);
 }
コード例 #49
0
 public static RegistrationBuilder Register <T>(
     this IContainerBuilder builder,
     Lifetime lifetime)
 => builder.Register(typeof(T), lifetime);
コード例 #50
0
ファイル: Modifier.cs プロジェクト: longde123/grove
 public void AddLifetime(Lifetime lifetime)
 {
     _lifetimes.Add(lifetime);
 }
        public static void AddTypesImplementing <T>(this IServiceCollection serviceCollection, Lifetime lifetime, params Assembly[] assemblies)
        {
            var types = GetTypesImplementing(typeof(T), assemblies);

            serviceCollection.Add(lifetime, types.ToArray());
        }
コード例 #52
0
 public BurstContextProvider(Lifetime lifetime, IElementIdProvider elementIdProvider, IApplicationWideContextBoundSettingStore store,
                             CallGraphSwaExtensionProvider callGraphSwaExtensionProvider, BurstMarksProvider marksProviderBase)
     : base(elementIdProvider, callGraphSwaExtensionProvider, marksProviderBase)
 {
     myIsBurstEnabledProperty = store.BoundSettingsStore.GetValueProperty(lifetime, (UnitySettings key) => key.EnableBurstCodeHighlighting);
 }
コード例 #53
0
 public UnityObjectTypeReferenceProviderFactory(Lifetime lifetime)
 {
     Changed = new Signal <IReferenceProviderFactory>(lifetime, GetType().FullName);
 }
コード例 #54
0
 public MetaFileGuidCache(Lifetime lifetime, IPersistentIndexManager persistentIndexManager)
     : base(lifetime, persistentIndexManager, MetaFileCacheItem.Marshaller)
 {
 }
コード例 #55
0
 public RefactorThisAction(Lifetime lifetime, Agent agent, IActionManager actionManager)
 {
     actionHelper = new ExtensibleActionHelper(lifetime, this, agent, actionManager);
 }
        public static void AddTypesImplementingInCurrentAssembly <T>(this IServiceCollection serviceCollection, Lifetime lifetime)
        {
            var types = GetTypesImplementing(typeof(T), new[] { Assembly.GetCallingAssembly() });

            serviceCollection.Add(lifetime, types.ToArray());
        }
コード例 #57
0
 public EntryPointsBuilder(IContainerBuilder containerBuilder, Lifetime lifetime)
 {
     this.containerBuilder = containerBuilder;
     this.lifetime         = lifetime;
 }
コード例 #58
0
            public NewWorldBuilder(IContainerBuilder containerBuilder, string worldName, Lifetime worldLifetime)
            {
                this.containerBuilder = containerBuilder;
                this.worldName        = worldName;
                this.worldLifetime    = worldLifetime;

                containerBuilder.RegisterNewWorld(worldName, worldLifetime);
            }
コード例 #59
0
 public LimboLife()
 {
     this._lifetime = _source.Lifetime;
 }
コード例 #60
0
 public RefRoot(Lifetime lifetime, IProtocol protocol) : this()
 {
     Identify(protocol.Identities, RdId.Root.Mix("RefRoot"));
     Bind(lifetime, protocol, "RefRoot");
 }