本文整理汇总了Java中com.intellij.psi.impl.source.tree.LightTreeUtil.toFilteredString方法的典型用法代码示例。如果您正苦于以下问题:Java LightTreeUtil.toFilteredString方法的具体用法?Java LightTreeUtil.toFilteredString怎么用?Java LightTreeUtil.toFilteredString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.impl.source.tree.LightTreeUtil
的用法示例。
在下文中一共展示了LightTreeUtil.toFilteredString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isDeprecatedByDocComment
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
public static boolean isDeprecatedByDocComment(@NotNull LighterAST tree, @NotNull LighterASTNode comment)
{
String text = LightTreeUtil.toFilteredString(tree, comment, null);
if(text.contains(DEPRECATED_TAG))
{
JavaDocLexer lexer = new JavaDocLexer(LanguageLevel.HIGHEST);
lexer.start(text);
IElementType token;
while((token = lexer.getTokenType()) != null)
{
if(token == JavaDocTokenType.DOC_TAG_NAME && DEPRECATED_TAG.equals(lexer.getTokenText()))
{
return true;
}
lexer.advance();
}
}
return false;
}
示例2: encodeInitializer
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
private static String encodeInitializer(final LighterAST tree, final LighterASTNode initializer) {
final IElementType type = initializer.getTokenType();
if (type == JavaElementType.NEW_EXPRESSION || type == JavaElementType.METHOD_CALL_EXPRESSION) {
return PsiFieldStub.INITIALIZER_NOT_STORED;
}
if (initializer.getEndOffset() - initializer.getStartOffset() > INITIALIZER_LENGTH_LIMIT) {
return PsiFieldStub.INITIALIZER_TOO_LONG;
}
return LightTreeUtil.toFilteredString(tree, initializer, null);
}
示例3: getTexts
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
private static String[] getTexts(LighterAST tree, LighterASTNode node) {
List<LighterASTNode> refs = LightTreeUtil.getChildrenOfType(tree, node, JavaElementType.JAVA_CODE_REFERENCE);
String[] texts = ArrayUtil.newStringArray(refs.size());
for (int i = 0; i < refs.size(); i++) {
texts[i] = LightTreeUtil.toFilteredString(tree, refs.get(i), null);
}
return texts;
}
示例4: encodeInitializer
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
private static String encodeInitializer(final LighterAST tree, final LighterASTNode initializer)
{
final IElementType type = initializer.getTokenType();
if(type == JavaElementType.NEW_EXPRESSION || type == JavaElementType.METHOD_CALL_EXPRESSION)
{
return PsiFieldStub.INITIALIZER_NOT_STORED;
}
if(initializer.getEndOffset() - initializer.getStartOffset() > INITIALIZER_LENGTH_LIMIT)
{
return PsiFieldStub.INITIALIZER_TOO_LONG;
}
return LightTreeUtil.toFilteredString(tree, initializer, null);
}
示例5: getTexts
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@NotNull
private static String[] getTexts(@NotNull LighterAST tree, @NotNull LighterASTNode node)
{
List<LighterASTNode> refs = LightTreeUtil.getChildrenOfType(tree, node, JavaElementType.JAVA_CODE_REFERENCE);
String[] texts = ArrayUtil.newStringArray(refs.size());
for(int i = 0; i < refs.size(); i++)
{
texts[i] = LightTreeUtil.toFilteredString(tree, refs.get(i), null);
}
return texts;
}
示例6: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
String name = null;
boolean isConstructor = true;
boolean isVarArgs = false;
boolean isDeprecatedByComment = false;
boolean hasDeprecatedAnnotation = false;
boolean hasDocComment = false;
String defValueText = null;
boolean expectingDef = false;
for (final LighterASTNode child : tree.getChildren(node)) {
final IElementType type = child.getTokenType();
if (type == JavaDocElementType.DOC_COMMENT) {
hasDocComment = true;
isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
}
else if (type == JavaElementType.MODIFIER_LIST) {
hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
}
else if (type == JavaElementType.TYPE) {
isConstructor = false;
}
else if (type == JavaTokenType.IDENTIFIER) {
name = RecordUtil.intern(tree.getCharTable(), child);
}
else if (type == JavaElementType.PARAMETER_LIST) {
final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
if (!params.isEmpty()) {
final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
if (pType != null) {
isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
}
}
}
else if (type == JavaTokenType.DEFAULT_KEYWORD) {
expectingDef = true;
}
else if (expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK) {
defValueText = LightTreeUtil.toFilteredString(tree, child, null);
break;
}
}
TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);
return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
示例7: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiAnnotationStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
String text = LightTreeUtil.toFilteredString(tree, node, null);
return new PsiAnnotationStubImpl(parentStub, text);
}
示例8: isDeprecatedByDocComment
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
public static boolean isDeprecatedByDocComment(@NotNull LighterAST tree, @NotNull LighterASTNode comment) {
// todo[r.sh] parse doc comments, implement tree lookup
String text = LightTreeUtil.toFilteredString(tree, comment, null);
return text.contains(DEPRECATED_TAG);
}
示例9: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
String name = null;
boolean isConstructor = true;
boolean isVarArgs = false;
boolean isDeprecatedByComment = false;
boolean hasDeprecatedAnnotation = false;
String defValueText = null;
boolean expectingDef = false;
for (final LighterASTNode child : tree.getChildren(node)) {
final IElementType type = child.getTokenType();
if (type == JavaDocElementType.DOC_COMMENT) {
isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
}
else if (type == JavaElementType.MODIFIER_LIST) {
hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
}
else if (type == JavaElementType.TYPE) {
isConstructor = false;
}
else if (type == JavaTokenType.IDENTIFIER) {
name = RecordUtil.intern(tree.getCharTable(), child);
}
else if (type == JavaElementType.PARAMETER_LIST) {
final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
if (params.size() > 0) {
final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
if (pType != null) {
isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
}
}
}
else if (type == JavaTokenType.DEFAULT_KEYWORD) {
expectingDef = true;
}
else if (expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK) {
defValueText = LightTreeUtil.toFilteredString(tree, child, null);
break;
}
}
TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation);
return new PsiMethodStubImpl(parentStub, StringRef.fromString(name), typeInfo, flags, StringRef.fromString(defValueText));
}
示例10: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
String name = null;
boolean isConstructor = true;
boolean isVarArgs = false;
boolean isDeprecatedByComment = false;
boolean hasDeprecatedAnnotation = false;
boolean hasDocComment = false;
String defValueText = null;
boolean expectingDef = false;
for(final LighterASTNode child : tree.getChildren(node))
{
final IElementType type = child.getTokenType();
if(type == JavaDocElementType.DOC_COMMENT)
{
hasDocComment = true;
isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
}
else if(type == JavaElementType.MODIFIER_LIST)
{
hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
}
else if(type == JavaElementType.TYPE)
{
isConstructor = false;
}
else if(type == JavaTokenType.IDENTIFIER)
{
name = RecordUtil.intern(tree.getCharTable(), child);
}
else if(type == JavaElementType.PARAMETER_LIST)
{
final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
if(!params.isEmpty())
{
final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
if(pType != null)
{
isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
}
}
}
else if(type == JavaTokenType.DEFAULT_KEYWORD)
{
expectingDef = true;
}
else if(expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK)
{
defValueText = LightTreeUtil.toFilteredString(tree, child, null);
break;
}
}
TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);
return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
示例11: getPresentableText
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@NotNull
@Override
protected String getPresentableText(@NotNull LighterAST tree, @NotNull LighterASTNode funExpr)
{
return LightTreeUtil.toFilteredString(tree, funExpr, EXCLUDE_FROM_PRESENTABLE_TEXT.getValue());
}