Exemple #1
0
        private static ExceptionContent TryExtractException(
            [CanBeNull] XmlElement exceptionElement,
            [NotNull] PsiLanguageType languageType,
            [NotNull] IPsiModule psiModule)
        {
            string cref = exceptionElement?.GetAttribute("cref");

            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            cref = XmlDocPresenterUtil.ProcessCref(cref);
            if (String.IsNullOrEmpty(cref))
            {
                return(null);
            }

            var exceptionContent = new ExceptionContent(cref);

            if (exceptionElement.HasChildNodes)
            {
                RichText richText = XmlDocRichTextPresenter.Run(exceptionElement, false, languageType, psiModule).RichText;
                if (!richText.IsNullOrEmpty())
                {
                    exceptionContent.Description = richText;
                }
            }
            return(exceptionContent);
        }
Exemple #2
0
        public static JetBrains.UI.RichText.RichText ProcessCRef(string crefValue, PsiLanguageType languageType, IPsiModule psiModule, DeclaredElementPresenterStyle presenterStyle)
        {
            var element = psiModule == null ? null : XMLDocUtil.ResolveId(psiModule.GetPsiServices(), crefValue, psiModule, true);

            return(element == null || !element.IsValid() ? new JetBrains.UI.RichText.RichText(XmlDocPresenterUtil.ProcessCref(crefValue), XmlDocRichTextPresenterEx.ourCRefStyle) : DeclaredElementPresenter.Format(languageType, presenterStyle, element));
        }