Java 类com.intellij.psi.PsiDocCommentOwner 实例源码

项目:intellij-ce-playground    文件:SuppressForClassFix.java   
@Override
@Nullable
public PsiDocCommentOwner getContainer(final PsiElement element) {
  PsiDocCommentOwner container = super.getContainer(element);
  if (container == null || container instanceof PsiClass){
    return null;
  }
  while (container != null ) {
    final PsiClass parentClass = PsiTreeUtil.getParentOfType(container, PsiClass.class);
    if ((parentClass == null || container.getParent() instanceof PsiDeclarationStatement || container.getParent() instanceof PsiClass) && container instanceof PsiClass){
      return container;
    }
    container = parentClass;
  }
  return container;
}
项目:intellij-ce-playground    文件:JavaImplementationTextSelectioner.java   
@Override
public int getTextStartOffset(@NotNull final PsiElement parent) {
    PsiElement element = parent;
    if (element instanceof PsiDocCommentOwner) {
      PsiDocComment comment = ((PsiDocCommentOwner)element).getDocComment();
      if (comment != null) {
        element = comment.getNextSibling();
        while (element instanceof PsiWhiteSpace) {
          element = element.getNextSibling();
        }
      }
    }

    if (element != null) {
      TextRange range = element.getTextRange();
      if (range != null) {
        return range.getStartOffset();
      }
      LOG.error("Range should not be null: " + element + "; " + element.getClass());
    }

  LOG.error("Element should not be null: " + parent.getText());
  return parent.getTextRange().getStartOffset();
}
项目:tools-idea    文件:SuppressForClassFix.java   
@Override
@Nullable
public PsiDocCommentOwner getContainer(final PsiElement element) {
  PsiDocCommentOwner container = super.getContainer(element);
  if (container == null || container instanceof PsiClass){
    return null;
  }
  while (container != null ) {
    final PsiClass parentClass = PsiTreeUtil.getParentOfType(container, PsiClass.class);
    if ((parentClass == null || container.getParent() instanceof PsiDeclarationStatement || container.getParent() instanceof PsiClass) && container instanceof PsiClass){
      return container;
    }
    container = parentClass;
  }
  return container;
}
项目:tools-idea    文件:JavaImplementationTextSelectioner.java   
@Override
public int getTextStartOffset(@NotNull final PsiElement parent) {
    PsiElement element = parent;
    if (element instanceof PsiDocCommentOwner) {
      PsiDocComment comment = ((PsiDocCommentOwner)element).getDocComment();
      if (comment != null) {
        element = comment.getNextSibling();
        while (element instanceof PsiWhiteSpace) {
          element = element.getNextSibling();
        }
      }
    }

    if (element != null) {
      TextRange range = element.getTextRange();
      if (range != null) {
        return range.getStartOffset();
      }
      LOG.error("Range should not be null: " + element + "; " + element.getClass());
    }

  LOG.error("Element should not be null: " + parent.getText());
  return parent.getTextRange().getStartOffset();
}
项目:consulo-java    文件:SuppressForClassFix.java   
@Override
@Nullable
public PsiDocCommentOwner getContainer(final PsiElement element) {
  PsiDocCommentOwner container = super.getContainer(element);
  if (container == null || container instanceof PsiClass){
    return null;
  }
  while (container != null ) {
    final PsiClass parentClass = PsiTreeUtil.getParentOfType(container, PsiClass.class);
    if ((parentClass == null || container.getParent() instanceof PsiDeclarationStatement || container.getParent() instanceof PsiClass) && container instanceof PsiClass){
      return container;
    }
    container = parentClass;
  }
  return container;
}
项目:consulo-java    文件:JavaImplementationTextSelectioner.java   
@Override
public int getTextStartOffset(@NotNull final PsiElement parent) {
    PsiElement element = parent;
    if (element instanceof PsiDocCommentOwner) {
      PsiDocComment comment = ((PsiDocCommentOwner)element).getDocComment();
      if (comment != null) {
        element = comment.getNextSibling();
        while (element instanceof PsiWhiteSpace) {
          element = element.getNextSibling();
        }
      }
    }

    if (element != null) {
      TextRange range = element.getTextRange();
      if (range != null) {
        return range.getStartOffset();
      }
      LOG.error("Range should not be null: " + element + "; " + element.getClass());
    }

  LOG.error("Element should not be null: " + parent.getText());
  return parent.getTextRange().getStartOffset();
}
项目:consulo-java    文件:CommentFormatter.java   
private void replaceDocComment(@Nullable String newCommentText, @NotNull final PsiDocCommentOwner psiDocCommentOwner)
{
    final PsiDocComment oldComment = psiDocCommentOwner.getDocComment();
    if(newCommentText != null)
    {
        newCommentText = stripSpaces(newCommentText);
    }
    if(newCommentText == null || oldComment == null || newCommentText.equals(oldComment.getText()))
    {
        return;
    }
    try
    {
        PsiComment newComment = JavaPsiFacade.getInstance(myProject).getElementFactory().createCommentFromText(newCommentText, null);
        final ASTNode oldNode = oldComment.getNode();
        final ASTNode newNode = newComment.getNode();
        assert oldNode != null && newNode != null;
        final ASTNode parent = oldNode.getTreeParent();
        parent.replaceChild(oldNode, newNode); //important to replace with tree operation to avoid resolve and repository update
    }
    catch(IncorrectOperationException e)
    {
        LOG.error(e);
    }
}
项目:consulo-java    文件:PullUpDialog.java   
@Override
protected void addCustomElementsToCentralPanel(JPanel panel)
{
    myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("javadoc.for.abstracts"));
    myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
    boolean hasJavadoc = false;
    for(MemberInfo info : myMemberInfos)
    {
        final PsiMember member = info.getMember();
        if(myMemberInfoModel.isAbstractEnabled(info))
        {
            info.setToAbstract(myMemberInfoModel.isAbstractWhenDisabled(info));
            if(!hasJavadoc &&
                    member instanceof PsiDocCommentOwner &&
                    ((PsiDocCommentOwner) member).getDocComment() != null)
            {
                hasJavadoc = true;
            }
        }
    }
    UIUtil.setEnabled(myJavaDocPanel, hasJavadoc, true);
    panel.add(myJavaDocPanel, BorderLayout.EAST);
}
项目:intellij-ce-playground    文件:EntryPointsManagerBase.java   
@Override
public boolean isEntryPoint(@NotNull PsiElement element) {
  if (!(element instanceof PsiModifierListOwner)) return false;
  PsiModifierListOwner owner = (PsiModifierListOwner)element;
  if (!ADDITIONAL_ANNOTATIONS.isEmpty() && ADDITIONAL_ANNOTATIONS.contains(Deprecated.class.getName()) &&
      element instanceof PsiDocCommentOwner && ((PsiDocCommentOwner)element).isDeprecated()) {
    return true;
  }

  return AnnotationUtil.checkAnnotatedUsingPatterns(owner, ADDITIONAL_ANNOTATIONS) ||
         AnnotationUtil.checkAnnotatedUsingPatterns(owner, getAdditionalAnnotations());
}
项目:intellij-ce-playground    文件:BasePsiMemberNode.java   
@Override
protected boolean isDeprecated() {
  final PsiModifierListOwner element = getValue();
  return element != null && element.isValid() &&
         element instanceof PsiDocCommentOwner &&
         ((PsiDocCommentOwner)element).isDeprecated();
}
项目:tools-idea    文件:EntryPointsManagerBase.java   
@Override
public boolean isEntryPoint(@NotNull PsiElement element) {
  if (!(element instanceof PsiModifierListOwner)) return false;
  PsiModifierListOwner owner = (PsiModifierListOwner)element;
  if (!ADDITIONAL_ANNOTATIONS.isEmpty() && ADDITIONAL_ANNOTATIONS.contains(Deprecated.class.getName()) &&
      element instanceof PsiDocCommentOwner && ((PsiDocCommentOwner)element).isDeprecated()) {
    return true;
  }
  return AnnotationUtil.isAnnotated(owner, ADDITIONAL_ANNOTATIONS) ||
         AnnotationUtil.isAnnotated(owner, getAdditionalAnnotations());
}
项目:tools-idea    文件:BasePsiMemberNode.java   
@Override
protected boolean isDeprecated() {
  final PsiModifierListOwner element = getValue();
  return element != null && element.isValid() &&
         element instanceof PsiDocCommentOwner &&
         ((PsiDocCommentOwner)element).isDeprecated();
}
项目:intellij-haxe    文件:HaxePsiDocComment.java   
@Override
public PsiDocCommentOwner getOwner() {
  final PsiElement parent = mOwnerComponent;
  if (parent instanceof PsiDocCommentOwner) {
    final PsiDocCommentOwner owner = (PsiDocCommentOwner) parent;
    if (owner.getDocComment() == this) {
      return owner;
    }
  }
  // HaxeXXX component owners that are not yet adapted to PsiXXX
  return null;
}
项目:consulo-java    文件:EntryPointsManagerBase.java   
@Override
public boolean isEntryPoint(@NotNull PsiElement element)
{
    if(!(element instanceof PsiModifierListOwner))
    {
        return false;
    }
    PsiModifierListOwner owner = (PsiModifierListOwner) element;
    if(!ADDITIONAL_ANNOTATIONS.isEmpty() && ADDITIONAL_ANNOTATIONS.contains(Deprecated.class.getName()) &&
            element instanceof PsiDocCommentOwner && ((PsiDocCommentOwner) element).isDeprecated())
    {
        return true;
    }
    return AnnotationUtil.isAnnotated(owner, ADDITIONAL_ANNOTATIONS) || AnnotationUtil.isAnnotated(owner, getAdditionalAnnotations());
}
项目:consulo-java    文件:GenerateMembersHandlerBase.java   
@Nullable
protected ClassMember[] chooseMembers(ClassMember[] members, boolean allowEmptySelection, boolean copyJavadocCheckbox, Project project, @Nullable Editor editor)
{
    MemberChooser<ClassMember> chooser = createMembersChooser(members, allowEmptySelection, copyJavadocCheckbox, project);
    if(editor != null)
    {
        final int offset = editor.getCaretModel().getOffset();

        ClassMember preselection = null;
        for(ClassMember member : members)
        {
            if(member instanceof PsiElementClassMember)
            {
                final PsiDocCommentOwner owner = ((PsiElementClassMember) member).getElement();
                if(owner != null)
                {
                    final TextRange textRange = owner.getTextRange();
                    if(textRange != null && textRange.contains(offset))
                    {
                        preselection = member;
                        break;
                    }
                }
            }
        }
        if(preselection != null)
        {
            chooser.selectElements(new ClassMember[]{preselection});
        }
    }

    chooser.show();
    myToCopyJavaDoc = chooser.isCopyJavadoc();
    final List<ClassMember> list = chooser.getSelectedElements();
    return list == null ? null : list.toArray(new ClassMember[list.size()]);
}
项目:consulo-java    文件:DocumentationDelegateProvider.java   
@Nullable
public static PsiDocCommentOwner findDocumentationDelegate(@NotNull PsiMember method)
{
    for(DocumentationDelegateProvider delegator : EP_NAME.getExtensions())
    {
        PsiDocCommentOwner type = delegator.computeDocumentationDelegate(method);
        if(type != null)
        {
            return type;
        }
    }
    return null;
}
项目:consulo-java    文件:DeprecatedClassUsageInspection.java   
private static void checkReferences(PsiElement psiElement, ProblemsHolder holder) {
  PsiReference[] references = psiElement.getReferences();
  PsiReference last = ArrayUtil.getLastElement(references);
  if (last != null && (!(last instanceof ResolvingHint) || ((ResolvingHint)last).canResolveTo(PsiDocCommentOwner.class))) {
    PsiElement resolve = last.resolve();
    DeprecationInspection.checkDeprecated(resolve, psiElement, last.getRangeInElement(), holder);
  }
}
项目:consulo-java    文件:BasePsiMemberNode.java   
@Override
protected boolean isDeprecated() {
  final PsiModifierListOwner element = getValue();
  return element != null && element.isValid() &&
         element instanceof PsiDocCommentOwner &&
         ((PsiDocCommentOwner)element).isDeprecated();
}
项目:markdown-doclet    文件:PsiProxy.java   
@Override
protected Object intercept(PsiDocCommentOwner proxy, PsiDocCommentOwner target, Method method, Object[] parameters) throws Throwable {
    if ( processor == null ) {
        processor = new DocCommentProcessor(target.getContainingFile());
        docComment = processor.processDocComment(target.getDocComment());
    }
    return docComment;
}
项目:intellij-ce-playground    文件:PsiDocComment.java   
/**
 * Returns the class, method or field described by the comment.
 */
@Override
@Nullable
PsiDocCommentOwner getOwner();
项目:intellij-ce-playground    文件:BatchSuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getElementMemberSuppressedIn(@NotNull final PsiDocCommentOwner owner, @NotNull final String inspectionToolID) {
  return JavaSuppressionUtil.getElementMemberSuppressedIn(owner, inspectionToolID);
}
项目:intellij-ce-playground    文件:BatchSuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getDocCommentToolSuppressedIn(@NotNull final PsiDocCommentOwner owner, @NotNull final String inspectionToolID) {
  return JavaSuppressionUtil.getDocCommentToolSuppressedIn(owner, inspectionToolID);
}
项目:intellij-ce-playground    文件:BatchSuppressManagerImpl.java   
@Override
public boolean alreadyHas14Suppressions(@NotNull final PsiDocCommentOwner commentOwner) {
  return JavaSuppressionUtil.alreadyHas14Suppressions(commentOwner);
}
项目:intellij-ce-playground    文件:SuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getElementMemberSuppressedIn(@NotNull final PsiDocCommentOwner owner, @NotNull final String inspectionToolID) {
  return JavaSuppressionUtil.getElementMemberSuppressedIn(owner, inspectionToolID);
}
项目:intellij-ce-playground    文件:SuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getDocCommentToolSuppressedIn(@NotNull final PsiDocCommentOwner owner, @NotNull final String inspectionToolID) {
  return JavaSuppressionUtil.getDocCommentToolSuppressedIn(owner, inspectionToolID);
}
项目:intellij-ce-playground    文件:SuppressManagerImpl.java   
@Override
public boolean alreadyHas14Suppressions(@NotNull final PsiDocCommentOwner commentOwner) {
  return JavaSuppressionUtil.alreadyHas14Suppressions(commentOwner);
}
项目:intellij-ce-playground    文件:JavaDocFilter.java   
public boolean accepts(PsiElement element) {
  return element instanceof PsiDocCommentOwner || element instanceof PsiDocComment;
}
项目:intellij-ce-playground    文件:PsiDocCommentOwnerMemberChooserObject.java   
public PsiDocCommentOwnerMemberChooserObject(@NotNull PsiDocCommentOwner owner, final String text, Icon icon) {
  super(owner, text, icon);
}
项目:intellij-ce-playground    文件:PsiDocCommentOwnerMemberChooserObject.java   
public PsiDocCommentOwner getPsiDocCommentOwner() {
  return (PsiDocCommentOwner)getPsiElement();
}
项目:intellij-ce-playground    文件:JavaElementLookupRenderer.java   
private static boolean isDeprecated(@Nullable PsiElement element) {
  return element instanceof PsiDocCommentOwner && ((PsiDocCommentOwner)element).isDeprecated();
}
项目:intellij-ce-playground    文件:StructureNodeRenderer.java   
private static boolean isDeprecated(Object psiElement) {
  return psiElement instanceof PsiDocCommentOwner && ((PsiDocCommentOwner)psiElement).isDeprecated();
}
项目:intellij-ce-playground    文件:BatchSuppressManager.java   
@Nullable
PsiElement getDocCommentToolSuppressedIn(@NotNull PsiDocCommentOwner owner, @NotNull String inspectionToolID);
项目:tools-idea    文件:PsiDocComment.java   
@Override
@Nullable
PsiDocCommentOwner getOwner();
项目:tools-idea    文件:BatchSuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getElementMemberSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
  return JavaSuppressionUtil.getElementMemberSuppressedIn(owner, inspectionToolID);
}
项目:tools-idea    文件:BatchSuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getDocCommentToolSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
  return JavaSuppressionUtil.getDocCommentToolSuppressedIn(owner, inspectionToolID);
}
项目:tools-idea    文件:BatchSuppressManagerImpl.java   
@Override
public boolean alreadyHas14Suppressions(@NotNull final PsiDocCommentOwner commentOwner) {
  return JavaSuppressionUtil.alreadyHas14Suppressions(commentOwner);
}
项目:tools-idea    文件:SuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getElementMemberSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
  return JavaSuppressionUtil.getElementMemberSuppressedIn(owner, inspectionToolID);
}
项目:tools-idea    文件:SuppressManagerImpl.java   
@Override
@Nullable
public PsiElement getDocCommentToolSuppressedIn(@NotNull final PsiDocCommentOwner owner, final String inspectionToolID) {
  return JavaSuppressionUtil.getDocCommentToolSuppressedIn(owner, inspectionToolID);
}
项目:tools-idea    文件:SuppressManagerImpl.java   
@Override
public boolean alreadyHas14Suppressions(@NotNull final PsiDocCommentOwner commentOwner) {
  return JavaSuppressionUtil.alreadyHas14Suppressions(commentOwner);
}
项目:tools-idea    文件:PsiDocCommentOwnerMemberChooserObject.java   
public PsiDocCommentOwnerMemberChooserObject(final PsiDocCommentOwner owner, final String text, Icon icon) {
  super(owner, text, icon);
}