本文整理汇总了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);
}