Java 类com.intellij.lang.documentation.CompositeDocumentationProvider 实例源码

项目:intellij-ce-playground    文件:LanguageDocumentation.java   
@Override
public DocumentationProvider forLanguage(@NotNull final Language l) {
  final List<DocumentationProvider> providers = allForLanguage(l);
  if (providers.size() < 2) {
    return super.forLanguage(l);
  }
  return CompositeDocumentationProvider.wrapProviders(providers);
}
项目:intellij-ce-playground    文件:EnterHandler.java   
@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;
}
项目:tools-idea    文件:LanguageDocumentation.java   
@Override
public DocumentationProvider forLanguage(@NotNull final Language l) {
  final List<DocumentationProvider> providers = allForLanguage(l);
  if (providers.size() < 2) {
    return super.forLanguage(l);
  }
  return CompositeDocumentationProvider.wrapProviders(providers);
}
项目:tools-idea    文件:EnterHandler.java   
@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;
}
项目:consulo    文件:LanguageDocumentation.java   
@Override
public DocumentationProvider forLanguage(@Nonnull final Language l) {
  final List<DocumentationProvider> providers = allForLanguage(l);
  if (providers.size() < 2) {
    return super.forLanguage(l);
  }
  return CompositeDocumentationProvider.wrapProviders(providers);
}
项目:consulo    文件:EnterHandler.java   
@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;
}
项目:intellij-ce-playground    文件:JavaDocumentationProvider.java   
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement) {
  return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
}
项目:intellij-ce-playground    文件:GroovyDocumentationProvider.java   
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement) {
  return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
}
项目:tools-idea    文件:JavaDocumentationProvider.java   
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement) {
  return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
}
项目:tools-idea    文件:GroovyDocumentationProvider.java   
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement) {
  return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
}
项目:consulo-java    文件:JavaDocumentationProvider.java   
@Override
public boolean hasDocumentationFor(PsiElement element, PsiElement originalElement)
{
    return CompositeDocumentationProvider.hasUrlsFor(this, element, originalElement);
}