This class handles the given StyleCop settings file.
    /// <summary>
    /// Releases all resource used by the <see cref="MonoDevelop.StyleCop.ProjectOptionsPanelBase"/> object.
    /// </summary>
    /// <remarks>Call <see cref="Dispose()"/> when you are finished using the <see cref="MonoDevelop.StyleCop.ProjectOptionsPanelBase"/>.
    /// The <see cref="Dispose()"/> method leaves the <see cref="MonoDevelop.StyleCop.ProjectOptionsPanelBase"/> in an unusable
    /// state. After calling <see cref="Dispose()"/>, you must release all references to the
    /// <see cref="MonoDevelop.StyleCop.ProjectOptionsPanelBase"/> so the garbage collector can reclaim the memory that the
    /// <see cref="MonoDevelop.StyleCop.ProjectOptionsPanelBase"/> was occupying.</remarks>
    public override void Dispose()
    {
      if (settingsHandler != null)
      {
        if (settingsHandlerAccessCount > 0)
        {
          settingsHandlerAccessCount--;
        }

        if (settingsHandlerAccessCount == 0)
        {
          settingsHandler = null;
        }
      }

      base.Dispose();
    }
    /// <summary>
    /// Initializes the OptionsPanel.
    /// </summary>
    /// <param name="dialog">Parent dialog.</param>
    /// <param name="dataObject">Data object (should be the project in our case).</param>
    public void Initialize(OptionsDialog dialog, object dataObject)
    {
      this.optionsPanelVisible = false;
      this.parentProject = dataObject as Project;

      // If for some reason the dataObject isn't our project get it over the selection in case that isn't null.
      if (this.parentProject == null && IdeApp.ProjectOperations.CurrentSelectedProject != null)
      {
        this.parentProject = IdeApp.ProjectOperations.CurrentSelectedProject;
      }

      this.optionsPanelVisible = ProjectUtilities.Instance.IsKnownProjectType(this.parentProject);

      if (this.optionsPanelVisible)
      {
        string localSettingsFileFolder = this.parentProject.BaseDirectory;
        string settingsFilePath = System.IO.Path.Combine(localSettingsFileFolder, global::StyleCop.Settings.DefaultFileName);

        if (!System.IO.File.Exists(settingsFilePath))
        {
          string deprecatedSettingsFile = System.IO.Path.Combine(localSettingsFileFolder, global::StyleCop.Settings.AlternateFileName);
          if (System.IO.File.Exists(deprecatedSettingsFile))
          {
            settingsFilePath = deprecatedSettingsFile;
          }
          else
          {
            deprecatedSettingsFile = System.IO.Path.Combine(localSettingsFileFolder, V101Settings.DefaultFileName);
            if (System.IO.File.Exists(deprecatedSettingsFile))
            {
              settingsFilePath = deprecatedSettingsFile;
            }
          }
        }

        if (settingsHandler == null)
        {
          try
          {
            settingsHandler = new StyleCopSettingsHandler(settingsFilePath, ProjectUtilities.Instance.Core);
          }
          catch
          {
            this.optionsPanelVisible = false;
          }
        }
      }
    }