#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.RecipeFramework;
using EnvDTE; 
#endregion

namespace Microsoft.Practices.RecipeFramework.Extensions.Actions.VisualStudio
{
    /// <summary>
    /// Action that saves an entry into the project globals section
    /// </summary>
    public class AddProjectGlobalsEntryAction : BaseGlobalsEntryAction
    {
        #region Input Properties
        
        /// <summary>
        /// Gets or sets the project.
        /// </summary>
        /// <value>The project.</value>
        [Input(Required = true)]
        public Project Project
        {
            get { return project; }
            set { project = value; }
        } private Project project;

        #endregion

        /// <summary>
        /// Called when [execute].
        /// </summary>
        /// <param name="value">The value.</param>
        public override void OnExecute(object value)
        {
            this.project.Globals[this.PropertyName] = value;
            this.project.Globals.set_VariablePersists(this.PropertyName, true);
        }
    }
}
