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


Java PsiDocComment.getOwner方法代码示例

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


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

示例1: getElementsCommentInfo

import com.intellij.psi.javadoc.PsiDocComment; //导入方法依赖的package包/类
private CommentInfo getElementsCommentInfo(@Nullable PsiElement psiElement) {
  CommentInfo info = null;
  if (psiElement instanceof PsiDocComment) {
    final PsiDocComment docComment = (PsiDocComment)psiElement;
    if (docComment.getOwner() == null && docComment.getParent() instanceof PsiJavaFile) {
      info = CommentFormatter.getCommentInfo(docComment);
      if (info != null) {
        info.setCommentOwner(docComment);
        info.setComment(docComment);
      }
    }
    else {
      return getElementsCommentInfo(psiElement.getParent());
    }
  }
  else if (psiElement instanceof PsiDocCommentOwner) {
    PsiDocCommentOwner owner = (PsiDocCommentOwner)psiElement;
    info = CommentFormatter.getOrigCommentInfo(owner);
    if (info != null) {
      info.setCommentOwner(owner);
      info.setComment(owner.getDocComment());
    }
  }
  return info;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JDParser.java

示例2: visitDocComment

import com.intellij.psi.javadoc.PsiDocComment; //导入方法依赖的package包/类
@Override
public void visitDocComment(PsiDocComment comment) {
  super.visitDocComment(comment);
  if (comment.getOwner() != null) {
    return;
  }
  if (JavaDocUtil.isInsidePackageInfo(comment) &&
      PsiTreeUtil.skipSiblingsForward(comment, PsiWhiteSpace.class) instanceof PsiPackageStatement &&
      "package-info.java".equals(comment.getContainingFile().getName())) {
    return;
  }
  registerError(comment.getFirstChild());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DanglingJavadocInspection.java

示例3: isInsidePackageInfo

import com.intellij.psi.javadoc.PsiDocComment; //导入方法依赖的package包/类
public static boolean isInsidePackageInfo(@Nullable PsiDocComment containingComment) {
  return containingComment != null && containingComment.getOwner() == null && containingComment.getParent() instanceof PsiJavaFile;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:JavaDocUtil.java

示例4: fixComment

import com.intellij.psi.javadoc.PsiDocComment; //导入方法依赖的package包/类
@Override
public void fixComment(@NotNull Project project, @NotNull Editor editor, @NotNull PsiComment comment) {
  if (!(comment instanceof PsiDocComment)) {
    return;
  }

  PsiDocComment docComment = (PsiDocComment)comment;
  PsiDocCommentOwner owner = docComment.getOwner();
  if (owner == null) {
    return;
  }
  
  PsiFile file = comment.getContainingFile();
  if (file == null) {
    return;
  }
  
  JavaDocReferenceInspection referenceInspection = new JavaDocReferenceInspection();
  JavaDocLocalInspection localInspection = getDocLocalInspection();

  InspectionManager inspectionManager = InspectionManager.getInstance(project);
  ProblemDescriptor[] referenceProblems = null;
  ProblemDescriptor[] otherProblems = null;
  if (owner instanceof PsiClass) {
    referenceProblems = referenceInspection.checkClass(((PsiClass)owner), inspectionManager, false);
    otherProblems = localInspection.checkClass(((PsiClass)owner), inspectionManager, false);
  }
  else if (owner instanceof PsiField) {
    referenceProblems = referenceInspection.checkField(((PsiField)owner), inspectionManager, false);
    otherProblems = localInspection.checkField(((PsiField)owner), inspectionManager, false);
  }
  else if (owner instanceof PsiMethod) {
    referenceProblems = referenceInspection.checkMethod((PsiMethod)owner, inspectionManager, false);
    otherProblems = localInspection.checkMethod((PsiMethod)owner, inspectionManager, false);
  }

  if (referenceProblems != null) {
    fixReferenceProblems(referenceProblems, project);
  }
  if (otherProblems != null) {
    fixCommonProblems(otherProblems, comment, editor.getDocument(), project);
  }
  
  PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
  ensureContentOrdered(docComment, editor.getDocument());
  locateCaret(docComment, editor, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:JavaDocCommentFixer.java


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