本文整理汇总了Java中com.intellij.psi.PsiReferenceList.Role方法的典型用法代码示例。如果您正苦于以下问题:Java PsiReferenceList.Role方法的具体用法?Java PsiReferenceList.Role怎么用?Java PsiReferenceList.Role使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiReferenceList
的用法示例。
在下文中一共展示了PsiReferenceList.Role方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: indexStub
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@Override
public void indexStub(@NotNull PsiClassReferenceListStub stub, @NotNull IndexSink sink) {
PsiReferenceList.Role role = stub.getRole();
if (role == PsiReferenceList.Role.EXTENDS_LIST || role == PsiReferenceList.Role.IMPLEMENTS_LIST) {
String[] names = stub.getReferencedNames();
for (String name : names) {
String shortName = PsiNameHelper.getShortClassName(name);
if (!StringUtil.isEmptyOrSpaces(shortName)) {
sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, shortName);
}
}
if (role == PsiReferenceList.Role.EXTENDS_LIST) {
StubElement parentStub = stub.getParentStub();
if (parentStub instanceof PsiClassStub) {
PsiClassStub psiClassStub = (PsiClassStub)parentStub;
if (psiClassStub.isEnum()) {
sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Enum");
}
if (psiClassStub.isAnnotationType()) {
sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Annotation");
}
}
}
}
}
示例2: elementTypeToRole
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@NotNull
public static PsiReferenceList.Role elementTypeToRole(@NotNull IElementType type)
{
if(type == JavaStubElementTypes.EXTENDS_BOUND_LIST)
{
return PsiReferenceList.Role.EXTENDS_BOUNDS_LIST;
}
if(type == JavaStubElementTypes.EXTENDS_LIST)
{
return PsiReferenceList.Role.EXTENDS_LIST;
}
if(type == JavaStubElementTypes.IMPLEMENTS_LIST)
{
return PsiReferenceList.Role.IMPLEMENTS_LIST;
}
if(type == JavaStubElementTypes.THROWS_LIST)
{
return PsiReferenceList.Role.THROWS_LIST;
}
if(type == JavaStubElementTypes.PROVIDES_WITH_LIST)
{
return PsiReferenceList.Role.PROVIDES_WITH_LIST;
}
throw new RuntimeException("Unknown element type: " + type);
}
示例3: getPreferredCondition
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@Nullable
protected Preference getPreferredCondition(@NotNull final PsiElement position)
{
if(INSIDE_REFERENCE_LIST.accepts(position))
{
PsiReferenceList list = (PsiReferenceList) position.getParent().getParent();
PsiReferenceList.Role role = list.getRole();
if(shouldContainInterfaces(list, role))
{
return Preference.Interfaces;
}
if(role == PsiReferenceList.Role.EXTENDS_LIST)
{
return Preference.Classes;
}
if(role == PsiReferenceList.Role.THROWS_LIST)
{
return Preference.Exceptions;
}
}
return null;
}
示例4: deserialize
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@NotNull
@Override
public PsiClassReferenceListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
byte role = dataStream.readByte();
int len = dataStream.readVarInt();
StringRef[] names = StringRef.createArray(len);
for (int i = 0; i < names.length; i++) {
names[i] = dataStream.readName();
}
PsiReferenceList.Role decodedRole = decodeRole(role);
return new PsiClassReferenceListStubImpl(roleToElementType(decodedRole), parentStub, names, decodedRole);
}
示例5: elementTypeToRole
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
private static PsiReferenceList.Role elementTypeToRole(IElementType type) {
if (type == JavaStubElementTypes.EXTENDS_BOUND_LIST) return PsiReferenceList.Role.EXTENDS_BOUNDS_LIST;
else if (type == JavaStubElementTypes.EXTENDS_LIST) return PsiReferenceList.Role.EXTENDS_LIST;
else if (type == JavaStubElementTypes.IMPLEMENTS_LIST) return PsiReferenceList.Role.IMPLEMENTS_LIST;
else if (type == JavaStubElementTypes.THROWS_LIST) return PsiReferenceList.Role.THROWS_LIST;
throw new RuntimeException("Unknown element type: " + type);
}
示例6: roleToElementType
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
private static JavaClassReferenceListElementType roleToElementType(PsiReferenceList.Role role) {
switch (role) {
case EXTENDS_BOUNDS_LIST: return JavaStubElementTypes.EXTENDS_BOUND_LIST;
case EXTENDS_LIST: return JavaStubElementTypes.EXTENDS_LIST;
case IMPLEMENTS_LIST: return JavaStubElementTypes.IMPLEMENTS_LIST;
case THROWS_LIST: return JavaStubElementTypes.THROWS_LIST;
}
throw new RuntimeException("Unknown role: " + role);
}
示例7: encodeRole
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
private static byte encodeRole(PsiReferenceList.Role role) {
switch (role) {
case EXTENDS_LIST: return 0;
case IMPLEMENTS_LIST: return 1;
case THROWS_LIST: return 2;
case EXTENDS_BOUNDS_LIST: return 3;
}
throw new RuntimeException("Unknown role: " + role);
}
示例8: decodeRole
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
private static PsiReferenceList.Role decodeRole(byte code) {
switch (code) {
case 0: return PsiReferenceList.Role.EXTENDS_LIST;
case 1: return PsiReferenceList.Role.IMPLEMENTS_LIST;
case 2: return PsiReferenceList.Role.THROWS_LIST;
case 3: return PsiReferenceList.Role.EXTENDS_BOUNDS_LIST;
}
throw new RuntimeException("Unknown role code: " + code);
}
示例9: newReferenceList
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
public static void newReferenceList(JavaClassReferenceListElementType type, StubElement parent, String... types) {
PsiReferenceList.Role role;
if (type == JavaStubElementTypes.EXTENDS_LIST) role = PsiReferenceList.Role.EXTENDS_LIST;
else if (type == JavaStubElementTypes.IMPLEMENTS_LIST) role = PsiReferenceList.Role.IMPLEMENTS_LIST;
else if (type == JavaStubElementTypes.THROWS_LIST) role = PsiReferenceList.Role.THROWS_LIST;
else if (type == JavaStubElementTypes.EXTENDS_BOUND_LIST) role = PsiReferenceList.Role.EXTENDS_BOUNDS_LIST;
else throw new IllegalArgumentException("Unknown type: " + type);
new PsiClassReferenceListStubImpl(type, parent, types, role);
}
示例10: newReferenceList
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
public static void newReferenceList(JavaClassReferenceListElementType type, StubElement parent, String... types) {
PsiReferenceList.Role role;
if (type == JavaStubElementTypes.EXTENDS_LIST) role = PsiReferenceList.Role.EXTENDS_LIST;
else if (type == JavaStubElementTypes.IMPLEMENTS_LIST) role = PsiReferenceList.Role.IMPLEMENTS_LIST;
else if (type == JavaStubElementTypes.THROWS_LIST) role = PsiReferenceList.Role.THROWS_LIST;
else if (type == JavaStubElementTypes.EXTENDS_BOUND_LIST) role = PsiReferenceList.Role.EXTENDS_BOUNDS_LIST;
else throw new IllegalArgumentException("Unknown type: " + type);
new PsiClassReferenceListStubImpl(type, parent, types, role);
}
示例11: indexStub
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@Override
public void indexStub(@NotNull PsiClassReferenceListStub stub, @NotNull IndexSink sink)
{
PsiReferenceList.Role role = stub.getRole();
if(role == PsiReferenceList.Role.EXTENDS_LIST || role == PsiReferenceList.Role.IMPLEMENTS_LIST)
{
String[] names = stub.getReferencedNames();
for(String name : names)
{
String shortName = PsiNameHelper.getShortClassName(name);
if(!StringUtil.isEmptyOrSpaces(shortName))
{
sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, shortName);
}
}
if(role == PsiReferenceList.Role.EXTENDS_LIST)
{
StubElement parentStub = stub.getParentStub();
if(parentStub instanceof PsiClassStub)
{
PsiClassStub psiClassStub = (PsiClassStub) parentStub;
if(psiClassStub.isEnum())
{
sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Enum");
}
if(psiClassStub.isAnnotationType())
{
sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Annotation");
}
}
}
}
}
示例12: shouldContainInterfaces
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
private static boolean shouldContainInterfaces(PsiReferenceList list, PsiReferenceList.Role role)
{
if(role == PsiReferenceList.Role.EXTENDS_LIST)
{
PsiElement parent = list.getParent();
return parent instanceof PsiClass && ((PsiClass) parent).isInterface();
}
if(role == PsiReferenceList.Role.IMPLEMENTS_LIST)
{
return true;
}
return false;
}
示例13: getRole
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReferenceList.Role getRole()
{
return JavaClassReferenceListElementType.elementTypeToRole(getStubType());
}
示例14: getRole
import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
PsiReferenceList.Role getRole();