本文整理汇总了Java中com.intellij.psi.impl.source.tree.JavaSourceUtil类的典型用法代码示例。如果您正苦于以下问题:Java JavaSourceUtil类的具体用法?Java JavaSourceUtil怎么用?Java JavaSourceUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaSourceUtil类属于com.intellij.psi.impl.source.tree包,在下文中一共展示了JavaSourceUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStub
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public PsiImportStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
boolean isOnDemand = false;
String refText = null;
for (LighterASTNode child : tree.getChildren(node)) {
IElementType type = child.getTokenType();
if (type == JavaElementType.JAVA_CODE_REFERENCE || type == JavaElementType.IMPORT_STATIC_REFERENCE) {
refText = JavaSourceUtil.getReferenceText(tree, child);
}
else if (type == JavaTokenType.ASTERISK) {
isOnDemand = true;
}
}
byte flags = PsiImportStatementStubImpl.packFlags(isOnDemand, node.getTokenType() == JavaElementType.IMPORT_STATIC_STATEMENT);
return new PsiImportStatementStubImpl(parentStub, refText, flags);
}
示例2: createStub
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public PsiImportStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
boolean isOnDemand = false;
String refText = null;
for(LighterASTNode child : tree.getChildren(node))
{
IElementType type = child.getTokenType();
if(type == JavaElementType.JAVA_CODE_REFERENCE || type == JavaElementType.IMPORT_STATIC_REFERENCE)
{
refText = JavaSourceUtil.getReferenceText(tree, child);
}
else if(type == JavaTokenType.ASTERISK)
{
isOnDemand = true;
}
}
byte flags = PsiImportStatementStubImpl.packFlags(isOnDemand, node.getTokenType() == JavaElementType.IMPORT_STATIC_STATEMENT);
return new PsiImportStatementStubImpl(parentStub, refText, flags);
}
示例3: createStub
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public PsiPackageAccessibilityStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
String refText = null;
List<String> to = ContainerUtil.newSmartList();
for(LighterASTNode child : tree.getChildren(node))
{
IElementType type = child.getTokenType();
if(type == JavaElementType.JAVA_CODE_REFERENCE)
{
refText = JavaSourceUtil.getReferenceText(tree, child);
}
else if(type == JavaElementType.MODULE_REFERENCE)
{
to.add(JavaSourceUtil.getReferenceText(tree, child));
}
}
return new PsiPackageAccessibilityStatementStubImpl(parentStub, this, refText, to);
}
示例4: createStubForFile
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@NotNull
@Override
protected StubElement createStubForFile(@NotNull PsiFile file, @NotNull LighterAST tree)
{
if(!(file instanceof PsiJavaFile))
{
return super.createStubForFile(file, tree);
}
String refText = "";
LighterASTNode pkg = LightTreeUtil.firstChildOfType(tree, tree.getRoot(), JavaElementType.PACKAGE_STATEMENT);
if(pkg != null)
{
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, pkg, JavaElementType.JAVA_CODE_REFERENCE);
if(ref != null)
{
refText = JavaSourceUtil.getReferenceText(tree, ref);
}
}
return new PsiJavaFileStubImpl((PsiJavaFile) file, refText, null, false);
}
示例5: createStub
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public PsiProvidesStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, node, JavaElementType.JAVA_CODE_REFERENCE);
String refText = ref != null ? JavaSourceUtil.getReferenceText(tree, ref) : null;
return new PsiProvidesStatementStubImpl(parentStub, refText);
}
示例6: createStub
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public PsiUsesStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, node, JavaElementType.JAVA_CODE_REFERENCE);
String refText = ref != null ? JavaSourceUtil.getReferenceText(tree, ref) : null;
return new PsiUsesStatementStubImpl(parentStub, refText);
}
示例7: createStub
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public PsiRequiresStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, node, JavaElementType.MODULE_REFERENCE);
String refText = ref != null ? JavaSourceUtil.getReferenceText(tree, ref) : null;
return new PsiRequiresStatementStubImpl(parentStub, refText);
}
示例8: getNormalizedText
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
private String getNormalizedText()
{
String whiteSpaceAndComments = myCachedNormalizedText;
if(whiteSpaceAndComments == null)
{
myCachedNormalizedText = whiteSpaceAndComments = JavaSourceUtil.getReferenceText(this);
}
return whiteSpaceAndComments;
}
示例9: fullyQualify
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public void fullyQualify(@NotNull final PsiClass targetClass)
{
final int kind = getKind(getContainingFile());
if(kind != CLASS_NAME_KIND && kind != CLASS_OR_PACKAGE_NAME_KIND && kind != CLASS_IN_QUALIFIED_NEW_KIND)
{
LOG.error("Wrong kind " + kind);
return;
}
JavaSourceUtil.fullyQualifyReference(this, targetClass);
}
示例10: getCachedNormalizedText
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
private String getCachedNormalizedText()
{
String whiteSpaceAndComments = myCachedNormalizedText;
if(whiteSpaceAndComments == null)
{
myCachedNormalizedText = whiteSpaceAndComments = JavaSourceUtil.getReferenceText(this);
}
return whiteSpaceAndComments;
}
示例11: replaceChildInternal
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public void replaceChildInternal(@NotNull ASTNode child, @NotNull TreeElement newElement)
{
if(ElementType.EXPRESSION_BIT_SET.contains(child.getElementType()) && ElementType.EXPRESSION_BIT_SET.contains(newElement.getElementType()))
{
boolean needParenth = ReplaceExpressionUtil.isNeedParenthesis(child, newElement);
if(needParenth)
{
newElement = JavaSourceUtil.addParenthToReplacedChild(JavaElementType.PARENTH_EXPRESSION, newElement, getManager());
}
}
super.replaceChildInternal(child, newElement);
}
示例12: deleteChildInternal
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public void deleteChildInternal(@NotNull ASTNode child)
{
if(child.getElementType() == JavaElementType.NAME_VALUE_PAIR)
{
JavaSourceUtil.deleteSeparatingComma(this, child);
}
super.deleteChildInternal(child);
}
示例13: addInternal
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before)
{
if(MEMBER_SET.contains(first.getElementType()) && MEMBER_SET.contains(last.getElementType()))
{
TreeElement firstAdded = super.addInternal(first, last, anchor, before);
JavaSourceUtil.addSeparatingComma(this, first, MEMBER_SET);
return firstAdded;
}
return super.addInternal(first, last, anchor, before);
}
示例14: deleteChildInternal
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public void deleteChildInternal(@NotNull ASTNode child)
{
if(MEMBER_SET.contains(child.getElementType()))
{
JavaSourceUtil.deleteSeparatingComma(this, child);
}
super.deleteChildInternal(child);
}
示例15: getQualifiedName
import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public String getQualifiedName() {
return JavaSourceUtil.getReferenceText(this);
}