本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}