Package com.intellij.psi

Examples of com.intellij.psi.PsiDocCommentOwner



  @Override
  @Nullable
  protected 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;
View Full Code Here



  @Override
  @SuppressWarnings({"SimplifiableIfStatement"})
  public boolean isAvailable(@NotNull final Project project, final Editor editor, @Nullable final PsiElement context) {
    final PsiDocCommentOwner container = getContainer(context);
    _key = container instanceof PsiClass ? "suppress.inspection.class" : container instanceof PsiMethod ? "suppress.inspection.method" : "suppress.inspection.field";
    final boolean isValid = container != null && !(container instanceof JspHolderMethod);
    if (!isValid) {
      return false;
    }
View Full Code Here

  @Override
  public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) throws IncorrectOperationException {
    /*final IntentionsInfo intentionsInfo = new IntentionsInfo();
    intentionsInfo.filterActions();
    IntentionHintComponent.showIntentionHint(project, element.getContainingFile(), editor, intentionsInfo, true);*/
    final PsiDocCommentOwner container = getContainer(element);
    assert container != null;
    if (!FileModificationServiceUtil.preparePsiElementForWrite(container)) {
      return;
    }
    @SuppressWarnings({"ConstantConditions"})
    final ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(container.getContainingFile().getVirtualFile());
    if (status.hasReadonlyFiles()) {
      return;
    }
    if (use15Suppressions(container)) {
      final PsiModifierList modifierList = container.getModifierList();
      if (modifierList != null) {
        addSuppressAnnotation(project, editor, container, modifierList, getID(container));
      }
    } else {
      final PsiDocComment docComment = container.getDocComment();
      final PsiManager manager = PsiManager.getInstance(project);
      //noinspection IfStatementWithIdenticalBranches
      if (docComment == null) {
        /*final String commentText = "*//** @" + SUPPRESS_INSPECTIONS_TAG_NAME + ' ' + getID(container) + "*//*";
        docComment = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createDocCommentFromText(commentText, null);
View Full Code Here


  @Override
  @Nullable
  protected 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 instanceof PsiClass) {
        return container;
      }
      container = parentClass;
    }
    return container;
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiDocCommentOwner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.