当前位置: 首页>>代码示例>>Java>>正文


Java DocumentationManager.createHyperlink方法代码示例

本文整理汇总了Java中com.intellij.codeInsight.documentation.DocumentationManager.createHyperlink方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentationManager.createHyperlink方法的具体用法?Java DocumentationManager.createHyperlink怎么用?Java DocumentationManager.createHyperlink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.codeInsight.documentation.DocumentationManager的用法示例。


在下文中一共展示了DocumentationManager.createHyperlink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExternalDocInfoForElement

import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
@Nullable
 public String getExternalDocInfoForElement(final String docURL, final PsiElement element) throws Exception {
   String externalDoc = super.getExternalDocInfoForElement(docURL, element);
   if (externalDoc != null) {
     if (element instanceof PsiMethod) {
       final String className = ApplicationManager.getApplication().runReadAction(
           new NullableComputable<String>() {
             @Override
             @Nullable
             public String compute() {
               PsiClass aClass = ((PsiMethod)element).getContainingClass();
               return aClass == null ? null : aClass.getQualifiedName();
             }
           }
       );
       Matcher matcher = ourMethodHeading.matcher(externalDoc);
       final StringBuilder buffer = new StringBuilder();
       DocumentationManager.createHyperlink(buffer, className, className, false);
       //noinspection HardCodedStringLiteral
       return matcher.replaceFirst("<H3>" + buffer.toString() + "</H3>");
    }
  }
  return externalDoc;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:JavaDocExternalFilter.java

示例2: getDocumentationForValue

import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
public String getDocumentationForValue(MetadataNode propertyNode, String value) {
  StringBuilder builder =
      new StringBuilder().append("<b>").append(propertyNode.getFullPath()).append("</b>");

  if (type != null) {
    StringBuilder buffer = new StringBuilder();
    DocumentationManager
        .createHyperlink(buffer, typeForDocumentationNavigation(type), type, false);
    String typeInJavadocFormat = buffer.toString();

    builder.append(" (").append(typeInJavadocFormat).append(")");
  }

  String trimmedValue = unescapeValue(value);
  builder.append("<p>").append(trimmedValue).append("</p>");

  Set<Suggestion> choices = getValueSuggestions(propertyNode, classLoader);
  if (choices != null) {
    choices.stream().filter(choice -> choice.getSuggestion().equals(trimmedValue)).findFirst()
        .ifPresent(suggestion -> {
          if (suggestion.getDescription() != null) {
            builder.append("<p>").append(suggestion.getDescription()).append("</p>");
          }
        });
  }

  return builder.toString();
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:29,代码来源:SpringConfigurationMetadataProperty.java

示例3: convertLink

import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
private static String convertLink(String javadoc, String tag) {
  StringBuilder buffer = new StringBuilder();
  int length = javadoc.length();
  int start = 0;

  while (true) {
    int index = javadoc.indexOf(tag, start);

    if (index == -1) {
      buffer.append(javadoc.substring(start, length));
      break;
    }
    else {
      buffer.append(javadoc.substring(start, index));

      int linkStart = index + tag.length();
      int end = javadoc.indexOf('}', linkStart);
      String linkValue = javadoc.substring(linkStart, end).trim();
      String href;
      String text;

      int spaceIndex = linkValue.indexOf(' ');
      if (spaceIndex != -1) {
        href = linkValue.substring(0, spaceIndex);
        text = linkValue.substring(spaceIndex + 1);
      }
      else {
        href = text = linkValue;
      }

      text = text.replace('#', '.');

      DocumentationManager.createHyperlink(buffer, href, text, true);

      start = end + 1;
    }
  }

  return buffer.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:JavadocParser.java

示例4: appendHyperLinkToElement

import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
public static void appendHyperLinkToElement(@Nullable PsiElement element, String elementName, final StringBuilder buffer,
		final String presentableName, final @Nullable String presentableFileName)
{
	final PsiFile containingFile = element != null ? element.getContainingFile() : null;
	String fileName = containingFile == null ? null : !JSResolveUtil.isPredefinedFile(containingFile) ? containingFile.getVirtualFile()
			.getPresentableUrl() : containingFile.getViewProvider().getVirtualFile().getName();

	DocumentationManager.createHyperlink(buffer, (fileName != null ? fileName + ":" : "") + elementName + (element != null ? ":" + element
			.getTextOffset() : ""), presentableName + (presentableFileName != null ? " in " + presentableFileName : ""), true);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:11,代码来源:JSDocumentationUtils.java

示例5: getExternalDocInfoForElement

import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
@Nullable
public String getExternalDocInfoForElement(final String docURL, final PsiElement element) throws Exception
{
	String externalDoc = super.getExternalDocInfoForElement(docURL, element);
	if(externalDoc != null)
	{
		if(element instanceof PsiMethod)
		{
			final String className = ApplicationManager.getApplication().runReadAction(new
																							   NullableComputable<String>()
			{
				@Override
				@Nullable
				public String compute()
				{
					PsiClass aClass = ((PsiMethod) element).getContainingClass();
					return aClass == null ? null : aClass.getQualifiedName();
				}
			});
			Matcher matcher = ourMethodHeading.matcher(externalDoc);
			final StringBuilder buffer = new StringBuilder();
			DocumentationManager.createHyperlink(buffer, className, className, false);
			//noinspection HardCodedStringLiteral
			return matcher.replaceFirst("<H3>" + buffer.toString() + "</H3>");
		}
	}
	return externalDoc;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:30,代码来源:JavaDocExternalFilter.java

示例6: getExternalDocInfoForElement

import com.intellij.codeInsight.documentation.DocumentationManager; //导入方法依赖的package包/类
@Override
@Nullable
 public String getExternalDocInfoForElement(@NotNull String docURL, final PsiElement element) throws Exception {
  String externalDoc = null;
  myElement = element;
  String builtInServer = "http://localhost:" + BuiltInServerOptions.getInstance().getEffectiveBuiltInServerPort() + "/" + myProject.getName() + "/";
  if (docURL.startsWith(builtInServer)) {
    int refPosition = docURL.lastIndexOf('#');
    VirtualFile file = WebServerPathToFileManager.getInstance(myProject).findVirtualFile(
      docURL.substring(builtInServer.length(), refPosition < builtInServer.length() ? docURL.length() : refPosition)
    );
    if (file != null) {
      InputStreamReader reader = new InputStreamReader(file.getInputStream(), CharsetToolkit.UTF8_CHARSET);
      StringBuilder result = new StringBuilder();
      try {
        doBuildFromStream(docURL, reader, result);
      }
      finally {
        reader.close();
      }

      externalDoc = correctDocText(docURL, result);
    }
  }

  if (externalDoc == null) {
    externalDoc = super.getExternalDocInfoForElement(docURL, element);
  }

  if (externalDoc == null) {
    return null;
  }

  if (element instanceof PsiMethod) {
    final String className = ApplicationManager.getApplication().runReadAction(
      new NullableComputable<String>() {
        @Override
        @Nullable
        public String compute() {
          PsiClass aClass = ((PsiMethod)element).getContainingClass();
          return aClass == null ? null : aClass.getQualifiedName();
        }
      }
    );
    Matcher matcher = ourMethodHeading.matcher(externalDoc);
    StringBuilder buffer = new StringBuilder("<h3>");
    DocumentationManager.createHyperlink(buffer, className, className, false);
    return matcher.replaceFirst(buffer.append("</h3>").toString());
  }
  return externalDoc;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:JavaDocExternalFilter.java


注:本文中的com.intellij.codeInsight.documentation.DocumentationManager.createHyperlink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。