當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。