private void removeIceBuilder_BeforeQueryStatus(object sender, EventArgs e)
 {
     try
     {
         OleMenuCommand command = sender as OleMenuCommand;
         if (command != null)
         {
             EnvDTE.Project p = DTEUtil.GetSelectedProject();
             if (p != null)
             {
                 if (DTEUtil.IsCppProject(p) || DTEUtil.IsCSharpProject(p))
                 {
                     command.Enabled = MSBuildUtils.IsIceBuilderEnabeld(MSBuildUtils.LoadedProject(p.FullName));
                 }
                 else
                 {
                     command.Enabled = false;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Package.UnexpectedExceptionWarning(ex);
         throw;
     }
 }
 private void addIceBuilder_BeforeQueryStatus(object sender, EventArgs e)
 {
     try
     {
         OleMenuCommand command = sender as OleMenuCommand;
         if (command != null)
         {
             IVsProject p = DTEUtil.GetSelectedProject();
             if (p != null)
             {
                 if (DTEUtil.IsCppProject(p) || DTEUtil.IsCSharpProject(p))
                 {
                     command.Enabled = !MSBuildUtils.IsIceBuilderEnabled(MSBuildUtils.LoadedProject(
                                                                             ProjectUtil.GetProjectFullPath(p), DTEUtil.IsCppProject(p), true));
                 }
                 else
                 {
                     command.Enabled = false;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Package.UnexpectedExceptionWarning(ex);
         throw;
     }
 }
        private void BuildEvents_OnBuildBegin(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
        {
            try
            {
                if (action == EnvDTE.vsBuildAction.vsBuildActionBuild ||
                    action == EnvDTE.vsBuildAction.vsBuildActionRebuildAll)
                {
                    //
                    // Ensure this runs once for parallel builds.
                    //
                    if (Building)
                    {
                        return;
                    }
                    Building = true;
                }

                List <IVsProject> projects = new List <IVsProject>();
                if (scope.Equals(EnvDTE.vsBuildScope.vsBuildScopeSolution))
                {
                    projects = DTEUtil.GetProjects();
                }
                else
                {
                    IVsProject selected = DTEUtil.GetSelectedProject();
                    if (selected != null)
                    {
                        projects.Add(selected);
                        DTEUtil.GetSubProjects(selected, ref projects);
                    }
                }

                foreach (IVsProject project in projects)
                {
                    IceBuilderProjectType type = DTEUtil.IsIceBuilderEnabled(project);
                    if (type != IceBuilderProjectType.None)
                    {
                        ProjectUtil.SetupGenerated(project, type);
                    }
                }
            }
            catch (Exception ex)
            {
                Package.UnexpectedExceptionWarning(ex);
                throw;
            }
        }
        private void BuildEvents_OnBuildBegin(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
        {
            try
            {
                if (action == EnvDTE.vsBuildAction.vsBuildActionBuild ||
                    action == EnvDTE.vsBuildAction.vsBuildActionRebuildAll)
                {
                    //
                    // Ensure this runs once for parallel builds.
                    //
                    if (Building)
                    {
                        return;
                    }
                    Building = true;
                }

                List <EnvDTE.Project> projects = new List <EnvDTE.Project>();
                if (scope.Equals(EnvDTE.vsBuildScope.vsBuildScopeSolution))
                {
                    projects = DTEUtil.GetProjects(DTE2.Solution);
                }
                else
                {
                    EnvDTE.Project selected = DTEUtil.GetSelectedProject();
                    if (selected != null)
                    {
                        DTEUtil.GetProjects(selected, ref projects);
                    }
                }

                foreach (EnvDTE.Project project in projects)
                {
                    if (DTEUtil.IsIceBuilderEnabled(project))
                    {
                        FileTracker.Reap(project);
                        ProjectUtil.SetupGenerated(project);
                    }
                }
            }
            catch (Exception ex)
            {
                Package.UnexpectedExceptionWarning(ex);
                throw;
            }
        }
        private void BuildEvents_OnBuildBegin(EnvDTE.vsBuildScope scope, EnvDTE.vsBuildAction action)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            try
            {
                if (action == EnvDTE.vsBuildAction.vsBuildActionBuild ||
                    action == EnvDTE.vsBuildAction.vsBuildActionRebuildAll)
                {
                    //
                    // Ensure this runs once for parallel builds.
                    //
                    if (Building)
                    {
                        return;
                    }
                    Building = true;

                    List <IVsProject> projects = new List <IVsProject>();
                    if (scope.Equals(EnvDTE.vsBuildScope.vsBuildScopeSolution))
                    {
                        projects = DTEUtil.GetProjects();
                    }
                    else
                    {
                        IVsProject selected = DTEUtil.GetSelectedProject();
                        if (selected != null)
                        {
                            projects.Add(selected);
                            DTEUtil.GetSubProjects(selected, ref projects);
                        }
                    }

                    foreach (IVsProject project in projects)
                    {
                        if (project.IsMSBuildIceBuilderInstalled())
                        {
                            ProjectUtil.SetupGenerated(project);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UnexpectedExceptionWarning(ex);
            }
        }
 private void RemoveIceBuilderFromProject(object sender, EventArgs e)
 {
     try
     {
         OleMenuCommand command = sender as OleMenuCommand;
         if (command != null)
         {
             EnvDTE.Project p = DTEUtil.GetSelectedProject();
             if (p != null)
             {
                 RemoveIceBuilderFromProject(p);
             }
         }
     }
     catch (Exception ex)
     {
         Package.UnexpectedExceptionWarning(ex);
         throw;
     }
 }