private void HandleAddLicenseHeaderToAllFilesReturn(object obj, AddLicenseHeaderToAllFilesReturn addLicenseHeaderToAllFilesReturn) { var project = obj as Project; var projectItem = obj as ProjectItem; if (project == null && projectItem == null) return; Project currentProject = project; if (projectItem != null) { currentProject = projectItem.ContainingProject; } if (addLicenseHeaderToAllFilesReturn.NoHeaderFound) { //No license header found... var page = (DefaultLicenseHeaderPage) GetDialogPage(typeof (DefaultLicenseHeaderPage)); var solutionSearcher = new AllSolutionProjectsSearcher(); var projects = solutionSearcher.GetAllProjects(_dte.Solution); //If there is a licenseheader in the Solution if(projects.Any(projectInSolution => LicenseHeaderFinder.GetHeader(projectInSolution) != null)) { if (MessageBoxHelper.DoYouWant(Resources.Question_AddExistingDefinitionFileToProject)) { new AddExistingLicenseHeaderDefinitionFileCommand().AddDefinitionFileToOneProject(currentProject.FileName, currentProject.ProjectItems); AddLicenseHeadersToAllFilesCallback((object) project ?? projectItem, null); } } else { if (MessageBoxHelper.DoYouWant(Resources.Question_AddNewLicenseHeaderDefinitionFileSingleProject)) { var licenseHeader = LicenseHeader.AddLicenseHeaderDefinitionFile(currentProject, DefaultLicenseHeaderPage); if (!MessageBoxHelper.DoYouWant(Resources.Question_StopForConfiguringDefinitionFilesSingleFile)) AddLicenseHeadersToAllFilesCallback((object) project ?? projectItem, null); else if (licenseHeader != null) licenseHeader.Open(Constants.vsViewKindCode).Activate(); } } } }
private void HandleAddLicenseHeaderToAllFilesReturn(object obj, AddLicenseHeaderToAllFilesReturn addLicenseHeaderToAllFilesReturn) { var project = obj as Project; var projectItem = obj as ProjectItem; if (project == null && projectItem == null) return; if (addLicenseHeaderToAllFilesReturn.NoHeaderFound) { //No license header found... var page = (DefaultLicenseHeaderPage) GetDialogPage(typeof (DefaultLicenseHeaderPage)); if (LicenseHeader.ShowQuestionForAddingLicenseHeaderFile(project ?? projectItem.ContainingProject, page)) AddLicenseHeadersToAllFilesCallback(obj, null); } }