/// <summary> /// Gets the highlight for the specified StyleCop Violation. /// </summary> /// <param name="violation"> /// The <see cref="StyleCop.ViolationEventArgs"/> instance containing the event data. /// </param> /// <param name="documentRange"> /// <see cref="DocumentRange"/>where the Violation happened. /// </param> /// <param name="fileName"> /// <see cref="CsElement"/>of the violation. /// </param> /// <param name="lineNumber"> /// Line number where the violation happened. /// </param> /// <returns> /// An <see cref="IHighlighting"/> for the specified Violation. /// </returns> public static IHighlighting GetHighlight(ViolationEventArgs violation, DocumentRange documentRange, string fileName, int lineNumber) { string ruleID = violation.Violation.Rule.CheckId; string highlightID = HighlightingRegistering.GetHighlightID(ruleID); VSSolutionManager solutionManager = Shell.Instance.GetComponent <VSSolutionManager>(); IContextBoundSettingsStore settingsStore = PsiSourceFileExtensions.GetSettingsStore(null, solutionManager.CurrentSolution); Severity severity = HighlightingSettingsManager.Instance.GetConfigurableSeverity(highlightID, settingsStore); switch (severity) { case Severity.ERROR: return(new StyleCopHighlightingError(violation, documentRange, fileName, lineNumber)); case Severity.HINT: return(new StyleCopHighlightingHint(violation, documentRange, fileName, lineNumber)); case Severity.INFO: return(new StyleCopHighlightingError(violation, documentRange, fileName, lineNumber)); case Severity.SUGGESTION: return(new StyleCopHighlightingSuggestion(violation, documentRange, fileName, lineNumber)); case Severity.WARNING: return(new StyleCopHighlightingWarning(violation, documentRange, fileName, lineNumber)); default: return(new StyleCopHighlightingDoNotShow(violation, documentRange, fileName, lineNumber)); } }
public string GetDisplayName(NuGetProject nuGetProject, VSSolutionManager solutionManager) { string safeName = solutionManager.GetNuGetProjectSafeName(nuGetProject); Project project = solutionManager.GetDTEProject(safeName); return(EnvDTEProjectUtility.GetDisplayName(project)); }
private static string GetDisplayName(NuGetProject nuGetProject, VSSolutionManager solutionManager) { Debug.Assert(ThreadHelper.CheckAccess()); var safeName = solutionManager.GetNuGetProjectSafeName(nuGetProject); var project = solutionManager.GetDTEProject(safeName); return(EnvDTEProjectUtility.GetDisplayName(project)); }
private IEnumerable <string> GetDisplayNames(IEnumerable <NuGetProject> allProjects) { List <string> projectNames = new List <string>(); VSSolutionManager solutionManager = (VSSolutionManager)_solutionManager; foreach (NuGetProject nuGetProject in allProjects) { string displayName = GetDisplayName(nuGetProject, solutionManager); projectNames.Add(displayName); } return(projectNames); }
private void SolutionManager_NuGetProjectRenamed(object sender, NuGetProjectEventArgs e) { VSSolutionManager manager = SolutionManager as VSSolutionManager; if (manager != null) { Project project = manager.GetDTEProject(manager.GetNuGetProjectSafeName(e.NuGetProject)); var windowFrame = FindExistingWindowFrame(project); if (windowFrame != null) { windowFrame.SetProperty((int) __VSFPROPID.VSFPROPID_OwnerCaption, String.Format( CultureInfo.CurrentCulture, Resx.Label_NuGetWindowCaption, project.Name)); } } }
public string GetDisplayName(NuGetProject nuGetProject, VSSolutionManager solutionManager) { string safeName = solutionManager.GetNuGetProjectSafeName(nuGetProject); Project project = solutionManager.GetDTEProject(safeName); return EnvDTEProjectUtility.GetDisplayName(project); }
public string GetDisplayName(NuGetProject nuGetProject) { VSSolutionManager solutionManager = (VSSolutionManager)_solutionManager; return(GetDisplayName(nuGetProject, solutionManager)); }