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


Java SuppressionUtil.isSuppressionComment方法代码示例

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


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

示例1: getTokenizer

import com.intellij.codeInspection.SuppressionUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Tokenizer getTokenizer(PsiElement element) {
    if (element instanceof PsiWhiteSpace) {
        return EMPTY_TOKENIZER;
    }
    if (element instanceof PsiNameIdentifierOwner) {
        return new PsiIdentifierOwnerTokenizer();
    }
    if (element.getParent() instanceof PsiNameIdentifierOwner) {
        return EMPTY_TOKENIZER;
    }
    if (element.getNode().getElementType() == JSGraphQLEndpointTokenTypes.IDENTIFIER) {
        return IDENTIFIER_TOKENIZER;
    }
    if (element instanceof PsiComment) {
        if (SuppressionUtil.isSuppressionComment(element)) {
            return EMPTY_TOKENIZER;
        }
        return myCommentTokenizer;
    }
    return EMPTY_TOKENIZER;
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:24,代码来源:JSGraphQLEndpointSpellcheckingStrategy.java

示例2: getTokenizer

import com.intellij.codeInspection.SuppressionUtil; //导入方法依赖的package包/类
@NotNull
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element)) {
    return EMPTY_TOKENIZER;
  }
  if (element instanceof PsiNameIdentifierOwner) return new PsiIdentifierOwnerTokenizer();
  if (element instanceof PsiComment) {
    if (SuppressionUtil.isSuppressionComment(element)) {
      return EMPTY_TOKENIZER;
    }
    return myCommentTokenizer;
  }
  if (element instanceof XmlAttributeValue) return myXmlAttributeTokenizer;
  if (element instanceof XmlText) return myXmlTextTokenizer;
  if (element instanceof PsiPlainText) {
    PsiFile file = element.getContainingFile();
    FileType fileType = file == null ? null : file.getFileType();
    if (fileType instanceof CustomSyntaxTableFileType) {
      return new CustomFileTypeTokenizer(((CustomSyntaxTableFileType)fileType).getSyntaxTable());
    }
    return TEXT_TOKENIZER;
  }
  if (element instanceof XmlToken) {
    if (((XmlToken)element).getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) {
      PsiElement injection = InjectedLanguageManager.getInstance(element.getProject()).findInjectedElementAt(element.getContainingFile(), element.getTextOffset());
      if (injection == null) {
        return TEXT_TOKENIZER;
      }
    }

  }
  return EMPTY_TOKENIZER;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:SpellcheckingStrategy.java

示例3: invoke

import com.intellij.codeInspection.SuppressionUtil; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull final Project project, @Nullable Editor editor, @NotNull final PsiElement element) throws IncorrectOperationException {
  PsiElement container = getContainer(element);
  if (container == null) return;

  if (!FileModificationService.getInstance().preparePsiElementForWrite(container)) return;

  final List<? extends PsiElement> comments = getCommentsFor(container);
  if (comments != null) {
    for (PsiElement comment : comments) {
      if (comment instanceof PsiComment && SuppressionUtil.isSuppressionComment(comment)) {
        replaceSuppressionComment(comment);
        return;
      }
    }
  }

  boolean caretWasBeforeStatement = editor != null && editor.getCaretModel().getOffset() == container.getTextRange().getStartOffset();
  try {
    createSuppression(project, element, container);
  }
  catch (IncorrectOperationException e) {
    if (!ApplicationManager.getApplication().isUnitTestMode() && editor != null) {
      Messages.showErrorDialog(editor.getComponent(),
                               InspectionsBundle.message("suppress.inspection.annotation.syntax.error", e.getMessage()));
    }
  }

  if (caretWasBeforeStatement) {
    editor.getCaretModel().moveToOffset(container.getTextRange().getStartOffset());
  }
  UndoUtil.markPsiFileForUndo(element.getContainingFile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:AbstractSuppressByNoInspectionCommentFix.java

示例4: getTokenizer

import com.intellij.codeInspection.SuppressionUtil; //导入方法依赖的package包/类
@NotNull
public Tokenizer getTokenizer(PsiElement element) {
  if (element instanceof PsiNameIdentifierOwner) return new PsiIdentifierOwnerTokenizer();
  if (element instanceof PsiComment) {
    if (SuppressionUtil.isSuppressionComment(element)) {
      return EMPTY_TOKENIZER;
    }
    return myCommentTokenizer;
  }
  if (element instanceof XmlAttributeValue) return myXmlAttributeTokenizer;
  if (element instanceof XmlText) return myXmlTextTokenizer;
  if (element instanceof PsiPlainText) return TEXT_TOKENIZER;
  return EMPTY_TOKENIZER;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:SpellcheckingStrategy.java

示例5: replaceSuppressionComments

import com.intellij.codeInspection.SuppressionUtil; //导入方法依赖的package包/类
protected boolean replaceSuppressionComments(PsiElement container) {
  final List<? extends PsiElement> comments = getCommentsFor(container);
  if (comments != null) {
    for (PsiElement comment : comments) {
      if (comment instanceof PsiComment && SuppressionUtil.isSuppressionComment(comment)) {
        replaceSuppressionComment(comment);
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:AbstractBatchSuppressByNoInspectionCommentFix.java

示例6: invoke

import com.intellij.codeInspection.SuppressionUtil; //导入方法依赖的package包/类
@Override
public void invoke(@Nonnull final Project project, @Nullable Editor editor, @Nonnull final PsiElement element) throws IncorrectOperationException {
  PsiElement container = getContainer(element);
  if (container == null) return;

  if (!FileModificationService.getInstance().preparePsiElementForWrite(container)) return;

  final List<? extends PsiElement> comments = getCommentsFor(container);
  if (comments != null) {
    for (PsiElement comment : comments) {
      if (comment instanceof PsiComment && SuppressionUtil.isSuppressionComment(comment)) {
        replaceSuppressionComment(comment);
        return;
      }
    }
  }

  boolean caretWasBeforeStatement = editor != null && editor.getCaretModel().getOffset() == container.getTextRange().getStartOffset();
  try {
    createSuppression(project, element, container);
  }
  catch (IncorrectOperationException e) {
    if (!ApplicationManager.getApplication().isUnitTestMode() && editor != null) {
      Messages.showErrorDialog(editor.getComponent(),
                               InspectionsBundle.message("suppress.inspection.annotation.syntax.error", e.getMessage()));
    }
  }

  if (caretWasBeforeStatement) {
    editor.getCaretModel().moveToOffset(container.getTextRange().getStartOffset());
  }
  UndoUtil.markPsiFileForUndo(element.getContainingFile());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:34,代码来源:AbstractSuppressByNoInspectionCommentFix.java


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