当前位置: 首页>>代码示例>>Java>>正文


Java PsiReferenceList.Role方法代码示例

本文整理汇总了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");
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:JavaClassReferenceListElementType.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:JavaClassReferenceListElementType.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:ReferenceListWeigher.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaClassReferenceListElementType.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JavaClassReferenceListElementType.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaClassReferenceListElementType.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaClassReferenceListElementType.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaClassReferenceListElementType.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:StubBuildingVisitor.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:StubBuildingVisitor.java

示例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");
				}
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:35,代码来源:JavaClassReferenceListElementType.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:ReferenceListWeigher.java

示例13: getRole

import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReferenceList.Role getRole()
{
	return JavaClassReferenceListElementType.elementTypeToRole(getStubType());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:PsiClassReferenceListStubImpl.java

示例14: getRole

import com.intellij.psi.PsiReferenceList; //导入方法依赖的package包/类
PsiReferenceList.Role getRole(); 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:2,代码来源:PsiClassReferenceListStub.java


注:本文中的com.intellij.psi.PsiReferenceList.Role方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。