当前位置: 首页>>代码示例>>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;未经允许,请勿转载。