• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DocumentationManagerProtocol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.codeInsight.documentation.DocumentationManagerProtocol的典型用法代码示例。如果您正苦于以下问题:Java DocumentationManagerProtocol类的具体用法?Java DocumentationManagerProtocol怎么用?Java DocumentationManagerProtocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DocumentationManagerProtocol类属于com.intellij.codeInsight.documentation包,在下文中一共展示了DocumentationManagerProtocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: hyperlinkUpdate

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull HyperlinkEvent e) {
  if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
    return;
  }

  String description = e.getDescription();
  if (StringUtil.isEmpty(description) || !description.startsWith(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL)) {
    return;
  }

  String elementName = e.getDescription().substring(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL.length());

  final PsiElement targetElement = myProvider.getDocumentationElementForLink(PsiManager.getInstance(myProject), elementName, myContext);
  if (targetElement != null) {
    LightweightHint hint = myHint;
    if (hint != null) {
      hint.hide(true);
    }
    myDocumentationManager.showJavaDocInfo(targetElement, myContext, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CtrlMouseHandler.java


示例2: describeFile

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private static void describeFile(PsiFile file, StringBuilder builder, boolean linkToFile) {
  if (!(file instanceof BuildFile)) {
    return;
  }
  BuildFile buildFile = (BuildFile) file;
  Label label = buildFile.getBuildLabel();
  String name = label != null ? label.toString() : buildFile.getPresentableText();
  if (linkToFile) {
    builder
        .append("<a href=\"")
        .append(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL)
        .append(LINK_TYPE_FILE)
        .append("\">")
        .append(name)
        .append("</a>");
  } else {
    builder.append(String.format("<b>%s</b>", name));
  }
  builder.append("<br><br>");
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:21,代码来源:BuildDocumentationProvider.java


示例3: hyperlinkUpdate

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
@Override
public void hyperlinkUpdate(@Nonnull HyperlinkEvent e) {
  if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
    return;
  }

  String description = e.getDescription();
  if (StringUtil.isEmpty(description) || !description.startsWith(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL)) {
    return;
  }

  String elementName = e.getDescription().substring(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL.length());

  final PsiElement targetElement = myProvider.getDocumentationElementForLink(PsiManager.getInstance(myProject), elementName, myContext);
  if (targetElement != null) {
    LightweightHint hint = myHint;
    if (hint != null) {
      hint.hide(true);
    }
    myDocumentationManager.showJavaDocInfo(targetElement, myContext, null);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:CtrlMouseHandler.java


示例4: appendElementLink

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
@Nullable
  public static String appendElementLink(StringBuilder sb, AppleScriptPsiElement psiElement, String label) {
    String elementRef = "";
//    sample Class Link:      "psi_element://dictionary:Finder.xml/suite:Finder Basics/class#icon family";
//    sample Dictionary Link: "psi_element://dictionary#Finder.xml";
//    sample Suite Link:      "psi_element://dictionary:Finder.xml/suite#Finder Basics";
    if (psiElement instanceof AppleScriptClass) {
      AppleScriptClass dClass = (AppleScriptClass) psiElement;
      elementRef = "dictionary:" + dClass.getDictionary().getName() + TYPE_SEPARATOR + "suite" + ELEMENT_NAME_SEPARATOR +
          dClass.getSuite().getName() + TYPE_SEPARATOR + URL_PREFIX_CLASS + dClass.getName();
    } else if (psiElement instanceof ApplicationDictionary) {
      ApplicationDictionary dictionary = (ApplicationDictionary) psiElement;
      elementRef = URL_PREFIX_DICTIONARY + dictionary.getName();
    } else if (psiElement instanceof Suite) {
      Suite suite = (Suite) psiElement;
      elementRef = "dictionary:" + suite.getDictionary().getName() + TYPE_SEPARATOR + URL_PREFIX_SUITE + suite.getName();
    } else if (psiElement instanceof AppleScriptCommand) {
      AppleScriptCommand cmd = (AppleScriptCommand) psiElement;
      elementRef = "dictionary:" + cmd.getDictionary().getName() + TYPE_SEPARATOR + "suite" + ELEMENT_NAME_SEPARATOR + cmd.getSuite().getName
          () + TYPE_SEPARATOR + URL_PREFIX_COMMAND + cmd.getName();
    }
    if (StringUtil.isEmpty(elementRef)) return null;

    final String result = "<a href=\"" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + elementRef + "\">" + label + "</a>";
    sb.append(result);
    return result;
  }
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:28,代码来源:AppleScriptDocHelper.java


示例5: createElementLink

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private static void createElementLink(StringBuilder sb, PsiElement element, String str) {
  sb.append("&nbsp;&nbsp;<a href=\"" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL);
  sb.append(JavaDocUtil.getReferenceText(element.getProject(), element));
  sb.append("\">");
  sb.append(str);
  sb.append("</a>");
  sb.append("<br>");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaDocumentationProvider.java


示例6: convertReference

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
@Override
protected String convertReference(String root, String href)
{
	if(BrowserUtil.isAbsoluteURL(href))
	{
		return href;
	}

	if(StringUtil.startsWithChar(href, '#'))
	{
		return root + href;
	}

	String nakedRoot = ourHTMLFilesuffix.matcher(root).replaceAll("/");

	String stripped = ourHTMLsuffix.matcher(href).replaceAll("");
	int len = stripped.length();

	do
	{
		stripped = ourParentFolderprefix.matcher(stripped).replaceAll("");
	}
	while(len > (len = stripped.length()));

	final String elementRef = stripped.replaceAll("/", ".");
	final String classRef = ourAnchorsuffix.matcher(elementRef).replaceAll("");

	return (JavaPsiFacade.getInstance(myProject).findClass(classRef,
			GlobalSearchScope.allScope(myProject)) != null) ? DocumentationManagerProtocol
			.PSI_ELEMENT_PROTOCOL + elementRef : doAnnihilate(nakedRoot + href);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:32,代码来源:JavaDocExternalFilter.java


示例7: createElementLink

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private static void createElementLink(StringBuilder sb, PsiElement element, String str)
{
	sb.append("&nbsp;&nbsp;<a href=\"" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL);
	sb.append(JavaDocUtil.getReferenceText(element.getProject(), element));
	sb.append("\">");
	sb.append(str);
	sb.append("</a>");
	sb.append("<br>");
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:JavaDocumentationProvider.java


示例8: insertCommandLinks

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private static String insertCommandLinks(String docString) {
	String commandRegex = "@command ([a-zA-Z_0-9]+)";
	return docString.replaceAll(commandRegex, "<a href='" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + SQFDocumentationProvider.DOC_LINK_PREFIX_COMMAND + "$1'>$1</a>");
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:5,代码来源:DocumentationUtil.java


示例9: insertBisLinks

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private static String insertBisLinks(String docString) {
	String commandRegex = "@bis ([a-zA-Z_0-9]+)";
	return docString.replaceAll(commandRegex, "<a href='" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + SQFDocumentationProvider.DOC_LINK_PREFIX_BIS_FUNCTION + "$1'>$1</a>");
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:5,代码来源:DocumentationUtil.java


示例10: insertFunctionLinks

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private static String insertFunctionLinks(String docString) {
	String commandRegex = "@fnc ([a-zA-Z_0-9]+)";
	return docString.replaceAll(commandRegex, "<a href='" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + SQFDocumentationProvider.DOC_LINK_PREFIX_USER_FUNCTION + "$1'>$1</a>");
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:5,代码来源:DocumentationUtil.java


示例11: createReferenceForRelativeLink

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
/**
 * Converts a relative link into {@link DocumentationManagerProtocol#PSI_ELEMENT_PROTOCOL PSI_ELEMENT_PROTOCOL}-type link if possible
 */
@Nullable
static String createReferenceForRelativeLink(@NotNull @NonNls String relativeLink, @NotNull PsiElement contextElement) {
  String fragment = null;
  int hashPosition = relativeLink.indexOf('#');
  if (hashPosition >= 0) {
    fragment = relativeLink.substring(hashPosition + 1);
    relativeLink = relativeLink.substring(0, hashPosition);
  }
  PsiElement targetElement;
  if (relativeLink.isEmpty()) {
    targetElement = (contextElement instanceof PsiField || contextElement instanceof PsiMethod) ? 
                    ((PsiMember)contextElement).getContainingClass() : contextElement;
  } 
  else {
    if (!relativeLink.toLowerCase().endsWith(".htm") && !relativeLink.toLowerCase().endsWith(".html")) {
      return null;
    }
    relativeLink = relativeLink.substring(0, relativeLink.lastIndexOf('.'));
    
    String packageName = getPackageName(contextElement);
    if (packageName == null) return null;

    Couple<String> pathWithPackage = removeParentReferences(Couple.of(relativeLink, packageName));
    if (pathWithPackage == null) return null;
    relativeLink = pathWithPackage.first;
    packageName = pathWithPackage.second;

    relativeLink = relativeLink.replace('/', '.');

    String qualifiedTargetClassName = packageName.isEmpty() ? relativeLink : packageName + "." + relativeLink;
    targetElement = JavaPsiFacade.getInstance(contextElement.getProject()).findClass(qualifiedTargetClassName, 
                                                                                     contextElement.getResolveScope());
  }
  if (targetElement == null) return null;
  
  String rawFragment = null;
  if (fragment != null && targetElement instanceof PsiClass) {
    if (fragment.contains("-") || fragment.contains("(")) {
      rawFragment = fragment;
      fragment = null; // reference to a method
    }
    else  {
      for (PsiField field : ((PsiClass)targetElement).getFields()) {
        if (field.getName().equals(fragment)) {
          rawFragment = fragment;
          fragment = null; // reference to a field
          break;
        }
      }
    }
  }
  return DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + JavaDocUtil.getReferenceText(targetElement.getProject(), targetElement) +
         (rawFragment == null ? "" : ('#' + rawFragment)) +
         (fragment == null ? "" : DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL_REF_SEPARATOR + fragment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:JavaDocInfoGenerator.java


示例12: buildPreview

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
/**
 * Allows to build a documentation preview from the given arguments. Basically, takes given 'header' text and tries to modify
 * it by using hyperlink information encapsulated at the given 'full text'.
 *
 * @param header                     target documentation header. Is expected to be a result of the
 *                                   {@link DocumentationProvider#getQuickNavigateInfo(PsiElement, PsiElement)} call
 * @param qName                      there is a possible case that not all documentation text will be included to the preview
 *                                   (according to the given 'desired rows and columns per-row' arguments). A link that points to the
 *                                   element with the given qualified name is added to the preview's end if the qName is provided then
 * @param fullText                   full documentation text (if available)
 */
@NotNull
public static String buildPreview(@NotNull final String header, @Nullable final String qName, @Nullable final String fullText) {
  if (fullText == null) {
    return header;
  }

  // Build links info.
  Map<String/*qName*/, String/*address*/> links = ContainerUtilRt.newHashMap();
  process(fullText, new LinksCollector(links));
  
  // Add derived names.
  Map<String, String> toAdd = ContainerUtilRt.newHashMap();
  for (Map.Entry<String, String> entry : links.entrySet()) {
    String shortName = parseShortName(entry.getKey());
    if (shortName != null) {
      toAdd.put(shortName, entry.getValue());
    }
    String longName = parseLongName(entry.getKey(), entry.getValue());
    if (longName != null) {
      toAdd.put(longName, entry.getValue());
    }
  }
  links.putAll(toAdd);
  if (qName != null) {
    links.put(qName, DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + qName);
  }
  
  // Apply links info to the header template.
  List<TextRange> modifiedRanges = ContainerUtilRt.newArrayList();
  List<String> sortedReplacements = ContainerUtilRt.newArrayList(links.keySet());
  Collections.sort(sortedReplacements, REPLACEMENTS_COMPARATOR);
  StringBuilder buffer = new StringBuilder(header);
  replace(buffer, "\n", "<br/>", modifiedRanges);
  for (String replaceFrom : sortedReplacements) {
    String visibleName = replaceFrom;
    int i = visibleName.lastIndexOf('.');
    if (i > 0 && i < visibleName.length() - 1) {
      visibleName = visibleName.substring(i + 1);
    }
    replace(buffer, replaceFrom, String.format("<a href=\"%s\">%s</a>", links.get(replaceFrom), visibleName), modifiedRanges);
  }
  return buffer.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:DocPreviewUtil.java


示例13: apply

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
public Iterable<String> apply(Iterable<String> contents) {
  return new ChainIterable<String>()
    .addItem("<a href=\"").addItem(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL).addItem(myLink).addItem("\">")
    .add(contents).addItem("</a>")
  ;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DocumentationBuilderKit.java


示例14: getTypeLink

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
private String getTypeLink(String typeName) {
    return new StringBuilder(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL)
            .append(GRAPHQL_DOC_PREFIX).append("/")
            .append(GRAPHQL_DOC_TYPE).append("/")
            .append(typeName).toString();
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:7,代码来源:JSGraphQLDocumentationProvider.java


示例15: buildPreview

import com.intellij.codeInsight.documentation.DocumentationManagerProtocol; //导入依赖的package包/类
/**
 * Allows to build a documentation preview from the given arguments. Basically, takes given 'header' text and tries to modify
 * it by using hyperlink information encapsulated at the given 'full text'.
 *
 * @param header                     target documentation header. Is expected to be a result of the
 *                                   {@link DocumentationProvider#getQuickNavigateInfo(PsiElement, PsiElement)} call
 * @param qName                      there is a possible case that not all documentation text will be included to the preview
 *                                   (according to the given 'desired rows and columns per-row' arguments). A link that points to the
 *                                   element with the given qualified name is added to the preview's end if the qName is provided then
 * @param fullText                   full documentation text (if available)
 */
@Nonnull
public static String buildPreview(@Nonnull final String header, @Nullable final String qName, @Nullable final String fullText) {
  if (fullText == null) {
    return header;
  }

  // Build links info.
  Map<String/*qName*/, String/*address*/> links = ContainerUtilRt.newHashMap();
  process(fullText, new LinksCollector(links));
  
  // Add derived names.
  Map<String, String> toAdd = ContainerUtilRt.newHashMap();
  for (Map.Entry<String, String> entry : links.entrySet()) {
    String shortName = parseShortName(entry.getKey());
    if (shortName != null) {
      toAdd.put(shortName, entry.getValue());
    }
    String longName = parseLongName(entry.getKey(), entry.getValue());
    if (longName != null) {
      toAdd.put(longName, entry.getValue());
    }
  }
  links.putAll(toAdd);
  if (qName != null) {
    links.put(qName, DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + qName);
  }
  
  // Apply links info to the header template.
  List<TextRange> modifiedRanges = ContainerUtilRt.newArrayList();
  List<String> sortedReplacements = ContainerUtilRt.newArrayList(links.keySet());
  Collections.sort(sortedReplacements, REPLACEMENTS_COMPARATOR);
  StringBuilder buffer = new StringBuilder(header);
  replace(buffer, "\n", "<br/>", modifiedRanges);
  for (String replaceFrom : sortedReplacements) {
    String visibleName = replaceFrom;
    int i = visibleName.lastIndexOf('.');
    if (i > 0 && i < visibleName.length() - 1) {
      visibleName = visibleName.substring(i + 1);
    }
    replace(buffer, replaceFrom, String.format("<a href=\"%s\">%s</a>", links.get(replaceFrom), visibleName), modifiedRanges);
  }
  return buffer.toString();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:55,代码来源:DocPreviewUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockDoorSpruce类代码示例发布时间:2022-05-22
下一篇:
Java ColumnToCollectionType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap