當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiJavaParserFacadeImpl類代碼示例

本文整理匯總了Java中com.intellij.psi.impl.PsiJavaParserFacadeImpl的典型用法代碼示例。如果您正苦於以下問題:Java PsiJavaParserFacadeImpl類的具體用法?Java PsiJavaParserFacadeImpl怎麽用?Java PsiJavaParserFacadeImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PsiJavaParserFacadeImpl類屬於com.intellij.psi.impl包,在下文中一共展示了PsiJavaParserFacadeImpl類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateChild

import com.intellij.psi.impl.PsiJavaParserFacadeImpl; //導入依賴的package包/類
private ClsElementImpl calculateChild()
{
	if(PsiJavaParserFacadeImpl.getPrimitiveType(myTypeText) != null)
	{
		return null;
	}
	if(isArray())
	{
		return myVariance == VARIANCE_NONE ? new ClsTypeElementImpl(this, myTypeText.substring(0, myTypeText.length() - 2),
				myVariance) : new ClsTypeElementImpl(this, myTypeText, VARIANCE_NONE);
	}
	if(isVarArgs())
	{
		return new ClsTypeElementImpl(this, myTypeText.substring(0, myTypeText.length() - 3), myVariance);
	}
	return myVariance == VARIANCE_INVARIANT ? null : new ClsJavaCodeReferenceElementImpl(this, myTypeText);
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:18,代碼來源:ClsTypeElementImpl.java

示例2: getInnerPrimitiveValue

import com.intellij.psi.impl.PsiJavaParserFacadeImpl; //導入依賴的package包/類
@Nullable
public static PrimitiveValue getInnerPrimitiveValue(ObjectReference value)
{
	ReferenceType type = value.referenceType();
	Field valueField = type.fieldByName("value");
	if(valueField != null)
	{
		Value primitiveValue = value.getValue(valueField);
		if(primitiveValue instanceof PrimitiveValue)
		{
			LOG.assertTrue(type.name().equals(PsiJavaParserFacadeImpl.getPrimitiveType(primitiveValue.type().name()).getBoxedTypeName()));
			return (PrimitiveValue) primitiveValue;
		}
	}
	return null;
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:17,代碼來源:UnBoxingEvaluator.java

示例3: createExpressionFromText

import com.intellij.psi.impl.PsiJavaParserFacadeImpl; //導入依賴的package包/類
public static PsiExpression createExpressionFromText(final String exprText, final PsiManager manager, final ClsElementImpl parent) {
  final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(manager.getProject()).getParserFacade();
  final PsiJavaFile dummyJavaFile = ((PsiJavaParserFacadeImpl)parserFacade).getDummyJavaFile(); // to resolve classes from java.lang
  final PsiExpression expr;
  try {
    expr = parserFacade.createExpressionFromText(exprText, dummyJavaFile);
  }
  catch (IncorrectOperationException e) {
    LOG.error(e);
    return null;
  }

  return psiToClsExpression(expr, parent);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:15,代碼來源:ClsParsingUtil.java

示例4: calculateChild

import com.intellij.psi.impl.PsiJavaParserFacadeImpl; //導入依賴的package包/類
private ClsElementImpl calculateChild() {
  if (PsiJavaParserFacadeImpl.getPrimitiveType(myTypeText) != null) {
    return null;
  }
  if (isArray()) {
    return myVariance == VARIANCE_NONE
           ? new ClsTypeElementImpl(this, myTypeText.substring(0, myTypeText.length() - 2), myVariance)
           : new ClsTypeElementImpl(this, myTypeText, VARIANCE_NONE);
  }
  if (isVarArgs()) {
    return new ClsTypeElementImpl(this, myTypeText.substring(0, myTypeText.length() - 3), myVariance);
  }
  return myVariance == VARIANCE_INVARIANT ? null : new ClsJavaCodeReferenceElementImpl(this, myTypeText);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ClsTypeElementImpl.java

示例5: createMemberValueFromText

import com.intellij.psi.impl.PsiJavaParserFacadeImpl; //導入依賴的package包/類
@NotNull
public static PsiAnnotationMemberValue createMemberValueFromText(final String text, final PsiManager manager, final ClsElementImpl parent) {
  final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
  final PsiJavaFile context = ((PsiJavaParserFacadeImpl)factory).getDummyJavaFile(); // to resolve classes from java.lang
  final LanguageLevel level = PsiUtil.getLanguageLevel(parent);
  final DummyHolder holder = DummyHolderFactory.createHolder(manager, new JavaDummyElement(text, ANNOTATION_VALUE, level), context);
  final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
  if (!(element instanceof PsiAnnotationMemberValue)) {
    LOG.error("Could not parse initializer:'" + text + "'");
    return null;
  }

  return getMemberValue(element, parent);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:15,代碼來源:ClsParsingUtil.java

示例6: getPsiClassAndType

import com.intellij.psi.impl.PsiJavaParserFacadeImpl; //導入依賴的package包/類
@NotNull
public static Pair<PsiElement, PsiType> getPsiClassAndType(@Nullable String className, Project project)
{
	PsiElement contextClass = null;
	PsiType contextType = null;
	if(!StringUtil.isEmpty(className))
	{
		PsiPrimitiveType primitiveType = PsiJavaParserFacadeImpl.getPrimitiveType(className);
		if(primitiveType != null)
		{
			contextClass = JavaPsiFacade.getInstance(project).findClass(primitiveType.getBoxedTypeName(), GlobalSearchScope.allScope(project));
			contextType = primitiveType;
		}
		else
		{
			contextClass = findClass(className, project, GlobalSearchScope.allScope(project));
			if(contextClass != null)
			{
				contextClass = contextClass.getNavigationElement();
			}
			if(contextClass instanceof PsiCompiledElement)
			{
				contextClass = ((PsiCompiledElement) contextClass).getMirror();
			}
			contextType = getType(className, project);
		}
		if(contextClass != null)
		{
			contextClass.putUserData(PSI_TYPE_KEY, contextType);
		}
	}
	return Pair.create(contextClass, contextType);
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:34,代碼來源:DebuggerUtilsImpl.java


注:本文中的com.intellij.psi.impl.PsiJavaParserFacadeImpl類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。