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


Java JavadocManager类代码示例

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


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

示例1: checkForPeriodInDoc

import com.intellij.psi.javadoc.JavadocManager; //导入依赖的package包/类
private void checkForPeriodInDoc(PsiDocComment docComment,
                                 ArrayList<ProblemDescriptor> problems,
                                 InspectionManager manager, boolean onTheFly) {
  if (IGNORE_JAVADOC_PERIOD) return;
  PsiDocTag[] tags = docComment.getTags();
  int dotIndex = docComment.getText().indexOf('.');
  int tagOffset = 0;
  if (dotIndex >= 0) {      //need to find first valid tag
    final PsiDocCommentOwner owner = PsiTreeUtil.getParentOfType(docComment, PsiDocCommentOwner.class);
    for (PsiDocTag tag : tags) {
      final String tagName = tag.getName();
      final JavadocTagInfo tagInfo = JavadocManager.SERVICE.getInstance(tag.getProject()).getTagInfo(tagName);
      if (tagInfo != null && tagInfo.isValidInContext(owner) && !tagInfo.isInline()) {
        tagOffset = tag.getTextOffset();
        break;
      }
    }
  }

  if (dotIndex == -1 || tagOffset > 0 && dotIndex + docComment.getTextOffset() > tagOffset) {
    problems.add(manager.createProblemDescriptor(docComment.getFirstChild(),
                                                 InspectionsBundle.message("inspection.javadoc.problem.descriptor1"),
                                                 null,
                                                 ProblemHighlightType.GENERIC_ERROR_OR_WARNING, onTheFly, false));
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:JavaDocLocalInspection.java

示例2: getReference

import com.intellij.psi.javadoc.JavadocManager; //导入依赖的package包/类
@Override
public PsiReference getReference() {
  PsiDocTag docTag = PsiTreeUtil.getParentOfType(this, PsiDocTag.class);
  if (docTag == null) {
    return null;
  }
  final String name = docTag.getName();
  final JavadocManager manager = JavadocManager.SERVICE.getInstance(getProject());
  final JavadocTagInfo info = manager.getTagInfo(name);
  if (info == null) return null;

  return info.getReference(this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PsiDocTagValueImpl.java

示例3: checkField

import com.intellij.psi.javadoc.JavadocManager; //导入依赖的package包/类
@Override
@Nullable
public ProblemDescriptor[] checkField(@NotNull PsiField psiField, @NotNull InspectionManager manager, boolean isOnTheFly) {
  if (IGNORE_DEPRECATED && (psiField.isDeprecated() || psiField.getContainingClass().isDeprecated())) {
    return null;
  }

  PsiDocComment docComment = psiField.getDocComment();
  if (docComment == null) {
    return isJavaDocRequired(psiField)
           ? new ProblemDescriptor[]{createDescriptor(psiField.getNameIdentifier(), REQUIRED_JAVADOC_IS_ABSENT, manager, isOnTheFly)}
           : null;
  }

  final ArrayList<ProblemDescriptor> problems = new ArrayList<ProblemDescriptor>(2);
  ArrayList<ProblemDescriptor> tagProblems = getTagValuesProblems(psiField, docComment.getTags(), manager, isOnTheFly);
  if (tagProblems != null) {
    problems.addAll(tagProblems);
  }
  checkInlineTags(manager, problems, docComment.getDescriptionElements(),
                  JavadocManager.SERVICE.getInstance(docComment.getProject()), isOnTheFly);
  checkForPeriodInDoc(docComment, problems, manager, isOnTheFly);
  checkDuplicateTags(docComment.getTags(), problems, manager, isOnTheFly);
  checkForBadCharacters(docComment, problems, manager, isOnTheFly);
  return problems.isEmpty()
         ? null
         : problems.toArray(new ProblemDescriptor[problems.size()]);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:29,代码来源:JavaDocLocalInspection.java

示例4: checkInlineTags

import com.intellij.psi.javadoc.JavadocManager; //导入依赖的package包/类
private void checkInlineTags(final InspectionManager inspectionManager,
                             final ArrayList<ProblemDescriptor> problems,
                             final PsiElement[] dataElements,
                             final JavadocManager manager, boolean isOnTheFly) {
  for (PsiElement dataElement : dataElements) {
    if (dataElement instanceof PsiInlineDocTag) {
      final PsiInlineDocTag inlineDocTag = (PsiInlineDocTag)dataElement;
      final PsiElement nameElement = inlineDocTag.getNameElement();
      if (manager.getTagInfo(inlineDocTag.getName()) == null) {
        checkTagInfo(inspectionManager, null, inlineDocTag, isOnTheFly, problems);
      }
      if (!IGNORE_POINT_TO_ITSELF) {
        final PsiDocTagValue value = inlineDocTag.getValueElement();
        if (value != null) {
          final PsiReference reference = value.getReference();
          if (reference != null) {
            final PsiElement ref = reference.resolve();
            if (ref != null){
              if (PsiTreeUtil.getParentOfType(inlineDocTag, PsiDocCommentOwner.class) == PsiTreeUtil.getParentOfType(ref, PsiDocCommentOwner.class, false)) {
                if (nameElement != null) {
                  problems.add(createDescriptor(nameElement, InspectionsBundle.message("inspection.javadoc.problem.pointing.to.itself"), inspectionManager,
                                                isOnTheFly));
                }
              }
            }
          }
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:32,代码来源:JavaDocLocalInspection.java

示例5: visitRefInDocTag

import com.intellij.psi.javadoc.JavadocManager; //导入依赖的package包/类
public static void visitRefInDocTag(final PsiDocTag tag,
		final JavadocManager manager,
		final PsiElement context,
		final ArrayList<ProblemDescriptor> problems,
		final InspectionManager inspectionManager,
		final boolean onTheFly)
{
	final String tagName = tag.getName();
	final PsiDocTagValue value = tag.getValueElement();
	if(value == null)
	{
		return;
	}
	final JavadocTagInfo info = manager.getTagInfo(tagName);
	if(info != null && !info.isValidInContext(context))
	{
		return;
	}
	final String message = info == null || !info.isInline() ? null : info.checkTagValue(value);
	if(message != null)
	{
		problems.add(createDescriptor(value, message, inspectionManager, onTheFly));
	}

	final PsiReference reference = value.getReference();
	if(reference == null)
	{
		return;
	}
	final PsiElement element = reference.resolve();
	if(element != null)
	{
		return;
	}
	final int textOffset = value.getTextOffset();
	if(textOffset == value.getTextRange().getEndOffset())
	{
		return;
	}
	final PsiDocTagValue valueElement = tag.getValueElement();
	if(valueElement == null)
	{
		return;
	}

	final CharSequence paramName = value.getContainingFile().getViewProvider().getContents().subSequence(textOffset, value.getTextRange().getEndOffset());
	final String params = "<code>" + paramName + "</code>";
	final List<LocalQuickFix> fixes = new ArrayList<LocalQuickFix>();
	if(onTheFly && "param".equals(tagName))
	{
		final PsiDocCommentOwner commentOwner = PsiTreeUtil.getParentOfType(tag, PsiDocCommentOwner.class);
		if(commentOwner instanceof PsiMethod)
		{
			final PsiMethod method = (PsiMethod) commentOwner;
			final PsiParameter[] parameters = method.getParameterList().getParameters();
			final PsiDocTag[] tags = tag.getContainingComment().getTags();
			final Set<String> unboundParams = new HashSet<String>();
			for(PsiParameter parameter : parameters)
			{
				if(!JavaDocLocalInspection.isFound(tags, parameter))
				{
					unboundParams.add(parameter.getName());
				}
			}
			if(!unboundParams.isEmpty())
			{
				fixes.add(new RenameReferenceQuickFix(unboundParams));
			}
		}
	}
	fixes.add(new RemoveTagFix(tagName, paramName));

	problems.add(inspectionManager.createProblemDescriptor(valueElement, reference.getRangeInElement(), cannotResolveSymbolMessage(params), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, onTheFly,
			fixes.toArray(new LocalQuickFix[fixes.size()])));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:76,代码来源:JavaDocReferenceInspection.java

示例6: getTagValuesProblems

import com.intellij.psi.javadoc.JavadocManager; //导入依赖的package包/类
@Nullable
private ArrayList<ProblemDescriptor> getTagValuesProblems(PsiDocCommentOwner context, PsiDocTag[] tags, InspectionManager inspectionManager,
                                                          boolean isOnTheFly) {
  final ArrayList<ProblemDescriptor> problems = new ArrayList<ProblemDescriptor>(2);
  nextTag:
  for (PsiDocTag tag : tags) {
    final JavadocManager manager = JavadocManager.SERVICE.getInstance(tag.getProject());
    String tagName = tag.getName();
    JavadocTagInfo tagInfo = manager.getTagInfo(tagName);

    if (tagInfo == null || !tagInfo.isValidInContext(context)) {
      if (checkTagInfo(inspectionManager, tagInfo, tag, isOnTheFly, problems)) continue nextTag;
    }

    PsiDocTagValue value = tag.getValueElement();
    final JavadocTagInfo info = manager.getTagInfo(tagName);
    if (info != null && !info.isValidInContext(context)) continue;
    String message = info == null ? null : info.checkTagValue(value);

    final PsiReference reference = value != null ? value.getReference() : null;
    if (message == null && reference != null) {
      PsiElement element = reference.resolve();
      if (element == null) {
        final int textOffset = value.getTextOffset();

        if (textOffset == value.getTextRange().getEndOffset()) {
          problems.add(inspectionManager.createProblemDescriptor(tag, InspectionsBundle.message("inspection.javadoc.problem.name.expected"), null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                                 isOnTheFly, true));
        }
      }
    }

    if (message != null) {
      final PsiDocTagValue valueElement = tag.getValueElement();
      if (valueElement == null){
        problems.add(inspectionManager.createProblemDescriptor(tag, InspectionsBundle.message("inspection.javadoc.method.problem.missing.tag.description", "<code>" + tag.getName() + "</code>"), null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                               isOnTheFly, true));
      } else {
        problems.add(createDescriptor(valueElement, message, inspectionManager, isOnTheFly));
      }
    }
    checkInlineTags(inspectionManager, problems, tag.getDataElements(), manager, isOnTheFly);
  }

  return problems.isEmpty() ? null : problems;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:47,代码来源:JavaDocLocalInspection.java


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