本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}