当前位置: 首页>>代码示例>>Java>>正文


Java JavaSourceUtil类代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaImportStatementElementType.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:JavaImportStatementElementType.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:JavaPackageAccessibilityStatementElementType.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:JavaLightStubBuilder.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:JavaProvidesStatementElementType.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:JavaUsesStatementElementType.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:JavaRequiresStatementElementType.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:PsiJavaCodeReferenceElementImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:PsiJavaCodeReferenceElementImpl.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:PsiReferenceExpressionImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:ExpressionPsiElement.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:11,代码来源:AnnotationParamListElement.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:PsiArrayInitializerMemberValueImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:11,代码来源:PsiArrayInitializerMemberValueImpl.java

示例15: getQualifiedName

import com.intellij.psi.impl.source.tree.JavaSourceUtil; //导入依赖的package包/类
@Override
public String getQualifiedName() {
  return JavaSourceUtil.getReferenceText(this);
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:5,代码来源:HaxeReferenceImpl.java


注:本文中的com.intellij.psi.impl.source.tree.JavaSourceUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。