本文整理汇总了Java中com.intellij.psi.PsiMember.getName方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMember.getName方法的具体用法?Java PsiMember.getName怎么用?Java PsiMember.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiMember
的用法示例。
在下文中一共展示了PsiMember.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateLookupItems
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
final Query<PsiMember> query = findAnnotated(context, params);
if (query != null) {
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
final String secondParamValue = params.length > 1 ? params[1].calculateResult(context).toString() : null;
final boolean isShortName = secondParamValue != null && !Boolean.valueOf(secondParamValue);
final Project project = context.getProject();
final PsiClass findInClass = secondParamValue != null
? JavaPsiFacade.getInstance(project).findClass(secondParamValue, GlobalSearchScope.allScope(project))
: null;
for (PsiMember object : query.findAll()) {
if (findInClass != null && !object.getContainingClass().equals(findInClass)) continue;
boolean isClazz = object instanceof PsiClass;
final String name = isShortName || !isClazz ? object.getName() : ((PsiClass) object).getQualifiedName();
set.add(LookupElementBuilder.create(name));
}
return set.toArray(new LookupElement[set.size()]);
}
return LookupElement.EMPTY_ARRAY;
}
示例2: initText
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
public static String initText(final PsiMember member, final boolean showContainingClass, final String modifier, final boolean doSet) {
String name;
if (showContainingClass) {
final PsiClass containingClass = member.getContainingClass();
String containingClassName;
if (containingClass != null) {
containingClassName = containingClass.getName() + ".";
}
else {
containingClassName = "";
}
name = containingClassName + member.getName();
}
else {
name = member.getName();
}
String modifierText = toPresentableText(modifier);
if (doSet) {
return GroovyBundle.message("change.modifier", name, modifierText);
}
else {
return GroovyBundle.message("change.modifier.not", name, modifierText);
}
}
示例3: getLambdaPrefix
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
public static String getLambdaPrefix(@NotNull PsiLambdaExpression lambdaExpression)
{
PsiMember member = PsiTreeUtil.getParentOfType(lambdaExpression, PsiMethod.class, PsiClass.class, PsiField.class);
final String methodPrefix;
if(member instanceof PsiMethod)
{
methodPrefix = member.getContainingClass() instanceof PsiAnonymousClass ? "" : "$" + member.getName();
}
else if(member instanceof PsiField && member.getContainingClass() instanceof PsiAnonymousClass)
{
methodPrefix = "";
}
else
{
//inside class initializer everywhere or field in a named class
methodPrefix = "$new";
}
return methodPrefix;
}
示例4: calculateResult
import com.intellij.psi.PsiMember; //导入方法依赖的package包/类
@Override
public Result calculateResult(@NotNull Expression[] expressions, ExpressionContext expressionContext) {
final Query<PsiMember> psiMembers = findAnnotated(expressionContext, expressions);
if (psiMembers != null) {
final PsiMember member = psiMembers.findFirst();
if (member != null) {
return new TextResult(member instanceof PsiClass ? ((PsiClass)member).getQualifiedName():member.getName());
}
}
return null;
}