本文整理汇总了Java中com.intellij.psi.PsiClassType.EMPTY_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java PsiClassType.EMPTY_ARRAY属性的具体用法?Java PsiClassType.EMPTY_ARRAY怎么用?Java PsiClassType.EMPTY_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.psi.PsiClassType
的用法示例。
在下文中一共展示了PsiClassType.EMPTY_ARRAY属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReferencedTypes
@NotNull
@Override
public PsiClassType[] getReferencedTypes() {
if (myCachedTypes == null) {
if (myRefs.isEmpty()) {
myCachedTypes = PsiClassType.EMPTY_ARRAY;
}
else {
final int size = myRefs.size();
myCachedTypes = new PsiClassType[size];
for (int i = 0; i < size; i++) {
myCachedTypes[i] = myFactory.createType(myRefs.get(i));
}
}
}
return myCachedTypes;
}
示例2: getReferencedTypes
@NotNull
public PsiClassType[] getReferencedTypes() {
List<GrCodeReferenceElement> refs = new ArrayList<GrCodeReferenceElement>();
for (PsiElement cur = getFirstChild(); cur != null; cur = cur.getNextSibling()) {
if (cur instanceof GrCodeReferenceElement) refs.add((GrCodeReferenceElement)cur);
}
if (refs.size() == 0) return PsiClassType.EMPTY_ARRAY;
PsiClassType[] result = new PsiClassType[refs.size()];
for (int i = 0; i < result.length; i++) {
result[i] = new GrClassReferenceType(refs.get(i));
}
return result;
}
示例3: getReferencedTypes
@NotNull
@Override
public PsiClassType[] getReferencedTypes()
{
if(myTypes != null)
{
return myTypes;
}
if(myNames.length == 0)
{
myTypes = PsiClassType.EMPTY_ARRAY;
return myTypes;
}
PsiClassType[] types = new PsiClassType[myNames.length];
final boolean compiled = ((JavaClassReferenceListElementType) getStubType()).isCompiled(this);
if(compiled)
{
for(int i = 0; i < types.length; i++)
{
types[i] = new PsiClassReferenceType(new ClsJavaCodeReferenceElementImpl(getPsi(), myNames[i]), null);
}
}
else
{
final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
int nullCount = 0;
final PsiReferenceList psi = getPsi();
for(int i = 0; i < types.length; i++)
{
try
{
final PsiJavaCodeReferenceElement ref = factory.createReferenceFromText(myNames[i], psi);
((PsiJavaCodeReferenceElementImpl) ref).setKindWhenDummy(PsiJavaCodeReferenceElementImpl.CLASS_NAME_KIND);
types[i] = factory.createType(ref);
}
catch(IncorrectOperationException e)
{
types[i] = null;
nullCount++;
}
}
if(nullCount > 0)
{
PsiClassType[] newTypes = new PsiClassType[types.length - nullCount];
int cnt = 0;
for(PsiClassType type : types)
{
if(type != null)
{
newTypes[cnt++] = type;
}
}
types = newTypes;
}
}
myTypes = types;
return types.clone();
}