本文整理汇总了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;
}
示例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());
}
示例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;
}
示例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);
}