Ejemplo n.º 1
0
        private static IssueTooltipContent TryCreateIssueContent([NotNull] IHighlighting highlighting, TextRange trackingRange,
                                                                 [CanBeNull] RichTextBlock textBlock, Severity severity, [NotNull] IContextBoundSettingsStore settings, [CanBeNull] ISolution solution)
        {
            if (textBlock == null || !severity.IsIssue())
            {
                return(null);
            }

            RichText text = textBlock.RichText;

            if (text.IsEmpty)
            {
                return(null);
            }

            if (settings.GetValue((IssueTooltipSettings s) => s.ColorizeElementsInErrors))
            {
                RichText enhancedText = TryEnhanceHighlighting(highlighting, settings, solution);
                if (!enhancedText.IsNullOrEmpty())
                {
                    text = enhancedText;
                }
            }

            var issueContent = new IssueTooltipContent(text, trackingRange);

            if (settings.GetValue((IssueTooltipSettings s) => s.ShowIcon))
            {
                issueContent.Icon = severity.TryGetIcon();
            }
            return(issueContent);
        }
Ejemplo n.º 2
0
        private static IssueTooltipContent TryCreateIssueContent([CanBeNull] RichTextBlock textBlock, Severity severity, [NotNull] IContextBoundSettingsStore settings)
        {
            if (textBlock == null || !severity.IsIssue())
            {
                return(null);
            }

            RichText text = textBlock.RichText;

            if (text.IsEmpty)
            {
                return(null);
            }

            var issueContent = new IssueTooltipContent {
                Text = text
            };

            if (settings.GetValue((IssueTooltipSettings s) => s.ShowIcon))
            {
                issueContent.Icon = severity.TryGetIcon();
            }
            return(issueContent);
        }
		private static IssueTooltipContent TryCreateIssueContent([NotNull] IHighlighting highlighting, TextRange trackingRange,
			[CanBeNull] RichTextBlock textBlock, Severity severity, [NotNull] IContextBoundSettingsStore settings, [CanBeNull] ISolution solution) {

			if (textBlock == null || !severity.IsIssue())
				return null;

			RichText text = textBlock.RichText;
			if (text.IsEmpty)
				return null;

			if (settings.GetValue((IssueTooltipSettings s) => s.ColorizeElementsInErrors)) {
				RichText enhancedText = TryEnhanceHighlighting(highlighting, settings, solution);
				if (!enhancedText.IsNullOrEmpty())
					text = enhancedText;
			}

			var issueContent = new IssueTooltipContent(text, trackingRange);
			if (settings.GetValue((IssueTooltipSettings s) => s.ShowIcon))
				issueContent.Icon = severity.TryGetIcon();
			return issueContent;
		}