• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CodeDocumentationProvider类的典型用法和代码示例

java 1次浏览

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

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

示例1: createJavaDocStub

点赞 2

import com.intellij.lang.documentation.CodeDocumentationProvider; //导入依赖的package包/类
@Nullable
private PsiComment createJavaDocStub(final CodeInsightSettings settings,
                                        final PsiComment comment,
                                        final Project project) {
  if (settings.JAVADOC_STUB_ON_ENTER) {
    final DocumentationProvider langDocumentationProvider =
      LanguageDocumentation.INSTANCE.forLanguage(comment.getParent().getLanguage());

    @Nullable final CodeDocumentationProvider docProvider;
    if (langDocumentationProvider instanceof CompositeDocumentationProvider) {
      docProvider = ((CompositeDocumentationProvider)langDocumentationProvider).getFirstCodeDocumentationProvider();
    } else {
      docProvider = langDocumentationProvider instanceof CodeDocumentationProvider ?
                                                      (CodeDocumentationProvider)langDocumentationProvider : null;
    }

    if (docProvider != null) {
      if (docProvider.findExistingDocComment(comment) != comment) return comment;
      String docStub;
      
      DumbService.getInstance(project).setAlternativeResolveEnabled(true);
      try {
        docStub = docProvider.generateDocumentationContentStub(comment);
      }
      finally {
        DumbService.getInstance(project).setAlternativeResolveEnabled(false);
      }

      if (docStub != null && docStub.length() != 0) {
        myOffset = CharArrayUtil.shiftForwardUntil(myDocument.getCharsSequence(), myOffset, LINE_SEPARATOR);
        myOffset = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), myOffset, LINE_SEPARATOR);
        myDocument.insertString(myOffset, docStub);
      }
    }

    PsiDocumentManager.getInstance(project).commitAllDocuments();
    return PsiTreeUtil.getNonStrictParentOfType(myFile.findElementAt(myOffset), PsiComment.class);
  }
  return comment;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:41,
代码来源:EnterHandler.java

示例2: createJavaDocStub

点赞 2

import com.intellij.lang.documentation.CodeDocumentationProvider; //导入依赖的package包/类
@Nullable
private PsiComment createJavaDocStub(final CodeInsightSettings settings,
                                        final PsiComment comment,
                                        final Project project) {
  if (settings.JAVADOC_STUB_ON_ENTER) {
    final DocumentationProvider langDocumentationProvider =
      LanguageDocumentation.INSTANCE.forLanguage(comment.getParent().getLanguage());

    @Nullable final CodeDocumentationProvider docProvider;
    if (langDocumentationProvider instanceof CompositeDocumentationProvider) {
      docProvider = ((CompositeDocumentationProvider)langDocumentationProvider).getFirstCodeDocumentationProvider();
    } else {
      docProvider = langDocumentationProvider instanceof CodeDocumentationProvider ?
                                                      (CodeDocumentationProvider)langDocumentationProvider : null;
    }

    if (docProvider != null) {
      if (docProvider.findExistingDocComment(comment) != comment) return comment;
      String docStub = docProvider.generateDocumentationContentStub(comment);
      
      if (docStub != null && docStub.length() != 0) {
        myOffset = CharArrayUtil.shiftForwardUntil(myDocument.getCharsSequence(), myOffset, LINE_SEPARATOR);
        myOffset = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), myOffset, LINE_SEPARATOR);
        myDocument.insertString(myOffset, docStub);
      }
    }

    PsiDocumentManager.getInstance(project).commitAllDocuments();
    return PsiTreeUtil.getNonStrictParentOfType(myFile.findElementAt(myOffset), PsiComment.class);
  }
  return comment;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:33,
代码来源:EnterHandler.java

示例3: createJavaDocStub

点赞 2

import com.intellij.lang.documentation.CodeDocumentationProvider; //导入依赖的package包/类
@Nullable
private PsiComment createJavaDocStub(final CodeInsightSettings settings,
                                     final PsiComment comment,
                                     final Project project) {
  if (settings.JAVADOC_STUB_ON_ENTER) {
    final DocumentationProvider langDocumentationProvider =
            LanguageDocumentation.INSTANCE.forLanguage(comment.getParent().getLanguage());

    @Nullable final CodeDocumentationProvider docProvider;
    if (langDocumentationProvider instanceof CompositeDocumentationProvider) {
      docProvider = ((CompositeDocumentationProvider)langDocumentationProvider).getFirstCodeDocumentationProvider();
    } else {
      docProvider = langDocumentationProvider instanceof CodeDocumentationProvider ?
                    (CodeDocumentationProvider)langDocumentationProvider : null;
    }

    if (docProvider != null) {
      if (docProvider.findExistingDocComment(comment) != comment) return comment;
      String docStub;

      DumbService.getInstance(project).setAlternativeResolveEnabled(true);
      try {
        docStub = docProvider.generateDocumentationContentStub(comment);
      }
      finally {
        DumbService.getInstance(project).setAlternativeResolveEnabled(false);
      }

      if (docStub != null && docStub.length() != 0) {
        myOffset = CharArrayUtil.shiftForwardUntil(myDocument.getCharsSequence(), myOffset, LINE_SEPARATOR);
        myOffset = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), myOffset, LINE_SEPARATOR);
        myDocument.insertString(myOffset, docStub);
      }
    }

    PsiDocumentManager.getInstance(project).commitAllDocuments();
    return PsiTreeUtil.getNonStrictParentOfType(myFile.findElementAt(myOffset), PsiComment.class);
  }
  return comment;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:41,
代码来源:EnterHandler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)