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


Java PsiComment.getTokenType方法代码示例

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


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

示例1: satisfiedBy

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  if (element instanceof LuaDocComment) {
    return false;
  }
  final PsiComment comment = (PsiComment) element;
  final IElementType type = comment.getTokenType();
  if (!LuaTokenTypes.LONGCOMMENT.equals(type)) {
    return false;
  }
  final PsiElement sibling = TreeUtil.getNextLeaf(comment);
  if(sibling == null)
  {
    return true;
  }
  if (!(isWhitespace(sibling))) {
    return false;
  }
  final String whitespaceText = sibling.getText();
  return whitespaceText.indexOf((int) '\n') >= 0 ||
      whitespaceText.indexOf((int) '\r') >= 0;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:25,代码来源:CStyleCommentPredicate.java

示例2: satisfiedBy

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
@Override
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  if (element instanceof PsiDocComment) {
    return false;
  }
  final PsiComment comment = (PsiComment) element;
  final IElementType type = comment.getTokenType();
  if (!GroovyTokenTypes.mML_COMMENT.equals(type)) {
    return false;
  }
  final PsiElement sibling = PsiTreeUtil.nextLeaf(comment);
  if(sibling == null)
  {
    return true;
  }
  if (!(isWhitespace(sibling))) {
    return false;
  }
  final String whitespaceText = sibling.getText();
  return whitespaceText.indexOf((int) '\n') >= 0 ||
      whitespaceText.indexOf((int) '\r') >= 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CStyleCommentPredicate.java

示例3: satisfiedBy

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  if (element instanceof PsiDocComment) {
    return false;
  }
  final PsiComment comment = (PsiComment)element;
  final IElementType type = comment.getTokenType();
  if (!JavaTokenType.C_STYLE_COMMENT.equals(type)) {
    return false;
  }
  final PsiElement sibling = PsiTreeUtil.nextLeaf(comment);
  if (!(sibling instanceof PsiWhiteSpace)) {
    return false;
  }
  final String whitespaceText = sibling.getText();
  return whitespaceText.indexOf((int)'\n') >= 0 ||
         whitespaceText.indexOf((int)'\r') >= 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CStyleCommentPredicate.java

示例4: satisfiedBy

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  if (element instanceof PsiDocComment) {
    return false;
  }
  final PsiComment comment = (PsiComment)element;
  final IElementType type = comment.getTokenType();
  if (!JavaTokenType.END_OF_LINE_COMMENT.equals(type)) {
    return false;
  }
  final String text = comment.getText();
  final Matcher matcher = NO_INSPECTION_PATTERN.matcher(text);
  return !matcher.matches();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:EndOfLineCommentPredicate.java

示例5: isEndOfLineComment

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
private boolean isEndOfLineComment(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  final PsiComment comment = (PsiComment) element;
  final IElementType tokenType = comment.getTokenType();
  return LuaTokenTypes.SHORTCOMMENT.equals(tokenType);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:9,代码来源:ChangeToCStyleCommentIntention.java

示例6: satisfiedBy

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  if (element instanceof LuaDocComment) {
    return false;
  }
  final PsiComment comment = (PsiComment) element;
  final IElementType type = comment.getTokenType();
  return LuaTokenTypes.SHORTCOMMENT.equals(type);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:12,代码来源:EndOfLineCommentPredicate.java

示例7: doEnter

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
@Override
public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) {
  if (isModified) return false;
  final PsiElement atCaret = psiElement.getContainingFile().findElementAt(editor.getCaretModel().getOffset());
  final PsiComment comment = PsiTreeUtil.getParentOfType(atCaret, PsiComment.class, false);
  if (comment != null) {
    plainEnter(editor);
    if (comment.getTokenType() == JavaTokenType.END_OF_LINE_COMMENT) {
      EditorModificationUtil.insertStringAtCaret(editor, "// ");
    }
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CommentBreakerEnterProcessor.java

示例8: isEndOfLineComment

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
private boolean isEndOfLineComment(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  final PsiComment comment = (PsiComment) element;
  final IElementType tokenType = comment.getTokenType();
  return GroovyTokenTypes.mSL_COMMENT.equals(tokenType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ChangeToCStyleCommentIntention.java

示例9: satisfiedBy

import com.intellij.psi.PsiComment; //导入方法依赖的package包/类
@Override
public boolean satisfiedBy(PsiElement element) {
  if (!(element instanceof PsiComment)) {
    return false;
  }
  if (element instanceof PsiDocComment) {
    return false;
  }
  final PsiComment comment = (PsiComment) element;
  final IElementType type = comment.getTokenType();
  return GroovyTokenTypes.mSL_COMMENT.equals(type);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:EndOfLineCommentPredicate.java


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