private void BuildProfileCallback(object sender, EventArgs e)
{
IVsMonitorSelection SelectionService;
SelectionService = (IVsMonitorSelection)GetGlobalService(typeof(SVsShellMonitorSelection));
IntPtr ppHier;
uint pitemid;
IVsMultiItemSelect ppMIS;
IntPtr ppSC;
if (SelectionService.GetCurrentSelection(out ppHier, out pitemid, out ppMIS, out ppSC) == VSConstants.S_OK)
{
//! Handle single selections only for now.
if (pitemid != VSConstants.VSITEMID_SELECTION && ppHier != null)
{
IVsHierarchy hierarchy = Marshal.GetTypedObjectForIUnknown(ppHier, typeof(IVsHierarchy)) as IVsHierarchy;
if (isProfilingBuildTime==0)
{
EnvDTE.Project project = ProjectHelper.GetProject(hierarchy);
if( ProjectHelper.IsCPPProject(pitemid, hierarchy) )
CleanProject(hierarchy);
ClaimBuildState();
Options opts = GetOptions();
if (ProjectHelper.IsCPPNode(pitemid, hierarchy))
{
object value;
hierarchy.GetProperty(pitemid, (int)__VSHPROPID.VSHPROPID_Name, out value);
Debug.Assert(value != null);
if( value != null )
buildProfiler = new BuildProfiler(project, opts.StackMaxSize, GetBuildOutputPane(), GetProfileOutputPane(), this.FreeBuildState, value.ToString());
}
else
buildProfiler = new BuildProfiler(project, opts.StackMaxSize, GetBuildOutputPane(), GetProfileOutputPane(), this.FreeBuildState);
}
else
{
buildProfiler.Cancel();
}
}
}
}