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