/// <summary>
        /// Performs the QuickFix, inserts the configured modifier into the location specified by the violation.
        /// </summary>
        /// <param name="solution">
        /// Current Solution.
        /// </param>
        /// <param name="textControl">
        /// Current Text Control to modify.
        /// </param>
        public void Execute(ISolution solution, ITextControl textControl)
        {
            JetBrains.DataFlow.LifetimeDefinition definition = JetBrains.DataFlow.Lifetimes.Define(solution.GetLifetime());
            JetBrains.DataFlow.Lifetime           lifetime   = definition.Lifetime;
            try
            {
                unsafe
                {
                    ChangeInspectionSeverityDialog dialog = new ChangeInspectionSeverityDialog(lifetime, this.commonIconsComponent);
                    IContextBoundSettingsStore     contextBoundSettingsStore =
                        this.settingsStore.BindToContextTransient(ContextRange.Smart(textControl.Document.ToDataContext()));
                    ConfigurableSeverityItem item = this.highlightingSettingsManager.GetSeverityItem(this.HighlightID);

                    dialog.Severity             = this.highlightingSettingsManager.GetConfigurableSeverity(this.HighlightID, solution);
                    dialog.SeverityOptionsTitle = string.Format(item.FullTitle + ":");
                    dialog.CanBeError           = !item.SolutionAnalysisRequired;

                    if (dialog.ShowDialog(User32Dll.GetForegroundWindow()) == true)
                    {
                        IContextBoundSettingsStore store = contextBoundSettingsStore;
                        if (dialog.SelectedSettingsLayer != null)
                        {
                            store = dialog.SelectedSettingsLayer.Model.SettingsStoreContext;
                        }

                        store.SetIndexedValue(HighlightingSettingsAccessor.InspectionSeverities, this.HighlightID, dialog.Severity);
                    }
                }
            }
            finally
            {
                definition.Terminate();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The initializer for this ShellComponent.
        /// </summary>
        /// <param name="lifetime">
        /// The lifetime for this object.
        /// </param>
        public void Init(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);
        }
 public UnityModel(Lifetime lifetime, IProtocol protocol) : this()
 {
     Identify(protocol.Identities, RdId.Root.Mix(GetType().Name));
     Bind(lifetime, protocol, GetType().Name);
     if (Protocol.InitializationLogger.IsTraceEnabled())
     {
         Protocol.InitializationLogger.Trace("CREATED toplevel object {0}", this.PrintToString());
     }
 }
Ejemplo n.º 4
0
 //custom body
 //init method
 protected override void Init(Lifetime lifetime)
 {
     _Play.BindEx(lifetime, this, "play");
     _Pause.BindEx(lifetime, this, "pause");
     _Step.BindEx(lifetime, this, "step");
     _UnityPluginVersion.BindEx(lifetime, this, "unityPluginVersion");
     _RiderProcessId.BindEx(lifetime, this, "riderProcessId");
     _ApplicationPath.BindEx(lifetime, this, "applicationPath");
     _ApplicationVersion.BindEx(lifetime, this, "applicationVersion");
     _LogModelInitialized.BindEx(lifetime, this, "logModelInitialized");
     _IsClientConnected.BindEx(lifetime, this, "isClientConnected");
     _OpenFileLineCol.BindEx(lifetime, this, "openFileLineCol");
     _UpdateUnityPlugin.BindEx(lifetime, this, "updateUnityPlugin");
     _Refresh.BindEx(lifetime, this, "refresh");
 }
Ejemplo n.º 5
0
 public UnityModel(Lifetime lifetime, IProtocol protocol) : this(
         new RdProperty <bool>(Serializers.ReadBool, Serializers.WriteBool).WithIdFromName("UnityModel.play"),
         new RdProperty <bool>(Serializers.ReadBool, Serializers.WriteBool).WithIdFromName("UnityModel.pause"),
         new RdCall <RdVoid, RdVoid>(Serializers.ReadVoid, Serializers.WriteVoid, Serializers.ReadVoid, Serializers.WriteVoid).WithIdFromName("UnityModel.step"),
         new RdProperty <string>(Serializers.ReadString, Serializers.WriteString).WithIdFromName("UnityModel.unityPluginVersion"),
         new RdProperty <int>(Serializers.ReadInt, Serializers.WriteInt).WithIdFromName("UnityModel.riderProcessId"),
         new RdProperty <string>(Serializers.ReadString, Serializers.WriteString).WithIdFromName("UnityModel.applicationPath"),
         new RdProperty <string>(Serializers.ReadString, Serializers.WriteString).WithIdFromName("UnityModel.applicationVersion"),
         new RdProperty <UnityLogModelInitialized>(UnityLogModelInitialized.Read, UnityLogModelInitialized.Write).WithIdFromName("UnityModel.logModelInitialized"),
         new RdEndpoint <RdVoid, bool>(Serializers.ReadVoid, Serializers.WriteVoid, Serializers.ReadBool, Serializers.WriteBool).WithIdFromName("UnityModel.isClientConnected"),
         new RdEndpoint <RdOpenFileArgs, bool>(RdOpenFileArgs.Read, RdOpenFileArgs.Write, Serializers.ReadBool, Serializers.WriteBool).WithIdFromName("UnityModel.openFileLineCol"),
         new RdCall <string, bool>(Serializers.ReadString, Serializers.WriteString, Serializers.ReadBool, Serializers.WriteBool).WithIdFromName("UnityModel.updateUnityPlugin"),
         new RdCall <RdVoid, RdVoid>(Serializers.ReadVoid, Serializers.WriteVoid, Serializers.ReadVoid, Serializers.WriteVoid).WithIdFromName("UnityModel.refresh")
         )
 {
     UnityModel.Register(protocol.Serializers);
     Register(protocol.Serializers);
     Bind(lifetime, protocol, GetType().Name);
     if (Protocol.InitializationLogger.IsTraceEnabled())
     {
         Protocol.InitializationLogger.Trace("CREATED toplevel object {0}", this.PrintToString());
     }
 }
Ejemplo n.º 6
0
 //custom body
 //init method
 protected override void Init(Lifetime lifetime)
 {
     _Log.BindEx(lifetime, this, "log");
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the StyleCopCodeStyleChecker class.
 /// </summary>
 /// <param name="lifetime">
 /// The lifetime for this instance.
 /// </param>
 public StyleCopCodeStyleChecker(JetBrains.DataFlow.Lifetime lifetime)
 {
     StyleCopReferenceHelper.EnsureStyleCopIsLoaded();
     this.Init(lifetime);
 }