當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。