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


Java PsiNameHelper.getShortClassName方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiNameHelper.getShortClassName方法的典型用法代码示例。如果您正苦于以下问题:Java PsiNameHelper.getShortClassName方法的具体用法?Java PsiNameHelper.getShortClassName怎么用?Java PsiNameHelper.getShortClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiNameHelper的用法示例。


在下文中一共展示了PsiNameHelper.getShortClassName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: indexStub

import com.intellij.psi.PsiNameHelper; //导入方法依赖的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: fromString

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
public String fromString(final String s, final ConvertContext context) {
  if (s == null) {
    final DomElement domElement = context.getInvocationElement();
    final EjbBase ejb = ((EjbBase)domElement.getParent());
    final PsiClass aClass = ejb.getEjbClass().getValue();
    if (aClass != null) {
      return aClass.getName();
    }
    else {
      final String aClassString = ejb.getEjbClass().getStringValue();
      if (aClassString != null) {
        return PsiNameHelper.getShortClassName(aClassString);
      }
    }
    return "unknown";
  }
  return s;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:19,代码来源:EjbNameConverter.java

示例3: getShortTypeText

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@NotNull
public String getShortTypeText() {
  if (text == null) return "";
  String name = PsiNameHelper.getShortClassName(text);
  if (arrayCount > 0) {
    name += StringUtil.repeat("[]", arrayCount);
  }
  return name;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TypeInfo.java

示例4: customize

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
public void customize(final String value){
  final String className = PsiNameHelper.getShortClassName(value);
  if(value.length() == className.length()){ // class in default package
    setText(className);
  }
  else{
    final String packageName = value.substring(0, value.length() - className.length() - 1);
    setText(UIDesignerBundle.message("class.in.package", className, packageName));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ClassToBindRenderer.java

示例5: getShortTypeText

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@NotNull
public static String getShortTypeText(@Nullable String text) {
  if (text == null) {
    return "";
  }
  int i = text.length();
  while (i - 2 >= 0 && text.charAt(i - 2) == '[' && text.charAt(i - 1) == ']') {
    i -= 2;
  }
  return PsiNameHelper.getShortClassName(text.substring(0, i)) + text.substring(i);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GrStubUtils.java

示例6: getShortTypeText

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@NotNull
public String getShortTypeText() {
  if (text == null) return "";
  String name = PsiNameHelper.getShortClassName(text.getString());
  if (arrayCount > 0) {
    name += StringUtil.repeat("[]", arrayCount);
  }
  return name;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:TypeInfo.java

示例7: indexStub

import com.intellij.psi.PsiNameHelper; //导入方法依赖的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

示例8: getShortTypeText

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@NotNull
public String getShortTypeText()
{
	if(text == null)
	{
		return "";
	}
	String name = PsiNameHelper.getShortClassName(text);
	if(arrayCount > 0)
	{
		name += StringUtil.repeat("[]", arrayCount);
	}
	return name;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:TypeInfo.java

示例9: getReferenceShortName

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
private static String getReferenceShortName(String annotationText) {
  int index = annotationText.indexOf('(');
  if (index >= 0) annotationText = annotationText.substring(0, index);
  return PsiNameHelper.getShortClassName(annotationText);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JavaAnnotationElementType.java

示例10: visit

import com.intellij.psi.PsiNameHelper; //导入方法依赖的package包/类
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{
	myInternalName = name;
	String parentName = myParent instanceof PsiClassStub ? ((PsiClassStub) myParent).getQualifiedName() : myParent instanceof PsiJavaFileStub ? ((PsiJavaFileStub) myParent).getPackageName() :
			null;
	String fqn = getFqn(name, myShortName, parentName);
	String shortName = myShortName != null && name.endsWith(myShortName) ? myShortName : PsiNameHelper.getShortClassName(fqn);

	int flags = myAccess | access;
	boolean isDeprecated = isSet(flags, Opcodes.ACC_DEPRECATED);
	boolean isInterface = isSet(flags, Opcodes.ACC_INTERFACE);
	boolean isEnum = isSet(flags, Opcodes.ACC_ENUM);
	boolean isAnnotationType = isSet(flags, Opcodes.ACC_ANNOTATION);
	byte stubFlags = PsiClassStubImpl.packFlags(isDeprecated, isInterface, isEnum, false, false, isAnnotationType, false, false);
	myResult = new PsiClassStubImpl(JavaStubElementTypes.CLASS, myParent, fqn, shortName, null, stubFlags);

	myModList = new PsiModifierListStubImpl(myResult, packClassFlags(flags));

	ClassInfo info = null;
	if(signature != null)
	{
		try
		{
			info = parseClassSignature(signature);
		}
		catch(ClsFormatException e)
		{
			if(LOG.isDebugEnabled())
			{
				LOG.debug("source=" + mySource + " signature=" + signature, e);
			}
		}
	}
	if(info == null)
	{
		info = parseClassDescription(superName, interfaces);
	}

	PsiTypeParameterListStub typeParameterList = new PsiTypeParameterListStubImpl(myResult);
	for(Pair<String, String[]> parameter : info.typeParameters)
	{
		PsiTypeParameterStub parameterStub = new PsiTypeParameterStubImpl(typeParameterList, StringRef.fromString(parameter.first));
		newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, parameter.second);
	}

	if(myResult.isInterface())
	{
		if(info.interfaceNames != null && myResult.isAnnotationType())
		{
			info.interfaceNames.remove(CommonClassNames.JAVA_LANG_ANNOTATION_ANNOTATION);
		}
		newReferenceList(JavaStubElementTypes.EXTENDS_LIST, myResult, ArrayUtil.toStringArray(info.interfaceNames));
		newReferenceList(JavaStubElementTypes.IMPLEMENTS_LIST, myResult, ArrayUtil.EMPTY_STRING_ARRAY);
	}
	else
	{
		if(info.superName == null || "java/lang/Object".equals(superName) || myResult.isEnum() && "java/lang/Enum".equals(superName))
		{
			newReferenceList(JavaStubElementTypes.EXTENDS_LIST, myResult, ArrayUtil.EMPTY_STRING_ARRAY);
		}
		else
		{
			newReferenceList(JavaStubElementTypes.EXTENDS_LIST, myResult, new String[]{info.superName});
		}
		newReferenceList(JavaStubElementTypes.IMPLEMENTS_LIST, myResult, ArrayUtil.toStringArray(info.interfaceNames));
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:69,代码来源:StubBuildingVisitor.java


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