本文整理汇总了Java中com.intellij.codeInsight.lookup.LookupElementPresentation.appendTailText方法的典型用法代码示例。如果您正苦于以下问题:Java LookupElementPresentation.appendTailText方法的具体用法?Java LookupElementPresentation.appendTailText怎么用?Java LookupElementPresentation.appendTailText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.lookup.LookupElementPresentation
的用法示例。
在下文中一共展示了LookupElementPresentation.appendTailText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
public void renderElement(LookupElement element, LookupElementPresentation presentation) {
Suggestion suggestion = (Suggestion) element.getObject();
if (suggestion.icon != null) {
presentation.setIcon(suggestion.icon);
}
presentation.setStrikeout(suggestion.deprecationLevel != null);
if (suggestion.deprecationLevel != null) {
if (suggestion.deprecationLevel == SpringConfigurationMetadataDeprecationLevel.error) {
presentation.setItemTextForeground(RED);
} else {
presentation.setItemTextForeground(YELLOW);
}
}
String lookupString = element.getLookupString();
presentation.setItemText(lookupString);
if (!lookupString.equals(suggestion.suggestion)) {
presentation.setItemTextBold(true);
}
String shortDescription;
if (suggestion.defaultValue != null) {
shortDescription = shortenTextWithEllipsis(suggestion.defaultValue, 60, 0, true);
TextAttributes attrs =
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(SCALAR_TEXT);
presentation.setTailText("=" + shortDescription, attrs.getForegroundColor());
}
if (suggestion.description != null) {
presentation.appendTailText(
" (" + Util.getFirstSentenceWithoutDot(suggestion.description) + ")", true);
}
if (suggestion.shortType != null) {
presentation.setTypeText(suggestion.shortType);
}
}
示例2: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
@Override
public void renderElement(final LookupElementPresentation presentation) {
final Parameter[] methodParameters = method.getParameters();
final Parameter[] methodParametersWithoutBuilder = (methodParameters.length >= 1)
? Arrays.copyOfRange(methodParameters, 1, methodParameters.length)
: methodParameters;
presentation.setItemText(lookupString);
presentation.setIcon(PhpIcons.METHOD);
presentation.setTypeText(LaravelClasses.ELOQUENT_BUILDER.toString().substring(1));
presentation.setTypeGrayed(false);
presentation.appendTailText(PhpPresentationUtil.formatParameters(null, methodParametersWithoutBuilder).toString(), true);
}
示例3: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
public void renderElement(LookupElementPresentation presentation, boolean showClass, boolean showPackage, PsiSubstitutor substitutor) {
final String className = myContainingClass == null ? "???" : myContainingClass.getName();
final String memberName = myMember.getName();
if (showClass && StringUtil.isNotEmpty(className)) {
presentation.setItemText(className + "." + memberName);
} else {
presentation.setItemText(memberName);
}
final String qname = myContainingClass == null ? "" : myContainingClass.getQualifiedName();
String pkg = qname == null ? "" : StringUtil.getPackageName(qname);
String location = showPackage && StringUtil.isNotEmpty(pkg) ? " (" + pkg + ")" : "";
final String params = myMergedOverloads
? "(...)"
: myMember instanceof PsiMethod
? PsiFormatUtil.formatMethod((PsiMethod)myMember, substitutor,
PsiFormatUtilBase.SHOW_PARAMETERS,
PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE)
: "";
presentation.clearTail();
presentation.appendTailText(params, false);
if (myShouldImport && StringUtil.isNotEmpty(className)) {
presentation.appendTailText(" in " + className + location, true);
} else {
presentation.appendTailText(location, true);
}
final PsiType type = myMember instanceof PsiMethod ? ((PsiMethod)myMember).getReturnType() : ((PsiField) myMember).getType();
if (type != null) {
presentation.setTypeText(substitutor.substitute(type).getPresentableText());
}
}
示例4: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation)
{
if (!returnValue.equals(lookupValue)) {
presentation.appendTailText("(" + lookupValue + ")", true);
}
super.renderElement(presentation);
}
示例5: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
public void renderElement(LookupElementPresentation presentation, @Nullable Boolean qualify, PsiSubstitutor substitutor) {
final String className = myContainingClass == null ? "???" : myContainingClass.getName();
final String memberName = myMember.getName();
if (!Boolean.FALSE.equals(qualify) && (!myShouldImport && StringUtil.isNotEmpty(className) || Boolean.TRUE.equals(qualify))) {
presentation.setItemText(className + "." + memberName);
} else {
presentation.setItemText(memberName);
}
final String qname = myContainingClass == null ? "" : myContainingClass.getQualifiedName();
String pkg = qname == null ? "" : StringUtil.getPackageName(qname);
String location = Boolean.FALSE.equals(qualify) || StringUtil.isEmpty(pkg) ? "" : " (" + pkg + ")";
final String params = myMergedOverloads
? "(...)"
: myMember instanceof PsiMethod
? PsiFormatUtil.formatMethod((PsiMethod)myMember, substitutor,
PsiFormatUtilBase.SHOW_PARAMETERS,
PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE)
: "";
presentation.clearTail();
presentation.appendTailText(params, false);
if (myShouldImport && StringUtil.isNotEmpty(className)) {
presentation.appendTailText(" in " + className + location, true);
} else {
presentation.appendTailText(location, true);
}
final PsiType type = myMember instanceof PsiMethod ? ((PsiMethod)myMember).getReturnType() : ((PsiField) myMember).getType();
if (type != null) {
presentation.setTypeText(substitutor.substitute(type).getPresentableText());
}
}
示例6: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
public void renderElement(LookupElementPresentation presentation, boolean showClass, boolean showPackage, PsiSubstitutor substitutor)
{
final String className = myContainingClass == null ? "???" : myContainingClass.getName();
final String memberName = myMember.getName();
if(showClass && StringUtil.isNotEmpty(className))
{
presentation.setItemText(className + "." + memberName);
}
else
{
presentation.setItemText(memberName);
}
final String qname = myContainingClass == null ? "" : myContainingClass.getQualifiedName();
String pkg = qname == null ? "" : StringUtil.getPackageName(qname);
String location = showPackage && StringUtil.isNotEmpty(pkg) ? " (" + pkg + ")" : "";
final String params = myMergedOverloads ? "(...)" : myMember instanceof PsiMethod ? getMethodParameterString((PsiMethod) myMember, substitutor) : "";
presentation.clearTail();
presentation.appendTailText(params, false);
if(myShouldImport && StringUtil.isNotEmpty(className))
{
presentation.appendTailText(" in " + className + location, true);
}
else
{
presentation.appendTailText(location, true);
}
PsiType declaredType = myMember instanceof PsiMethod ? ((PsiMethod) myMember).getReturnType() : ((PsiField) myMember).getType();
PsiType type = patchGetClass(substitutor.substitute(declaredType));
if(type != null)
{
presentation.setTypeText(substitutor.substitute(type).getPresentableText());
}
}
示例7: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation)
{
super.renderElement(presentation);
String tailText = StringUtil.notNullize(presentation.getTailText());
int genericsEnd = tailText.lastIndexOf('>') + 1;
presentation.clearTail();
presentation.appendTailText(tailText.substring(0, genericsEnd), false);
presentation.appendTailText(MemberLookupHelper.getMethodParameterString(myConstructor, mySubstitutor), false);
presentation.appendTailText(tailText.substring(genericsEnd), true);
}
示例8: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
@Override
public void renderElement(LookupElementDecorator<LookupElement> element, LookupElementPresentation presentation) {
element.getDelegate().renderElement(presentation);
presentation.appendTailText(" [" + myModule.getName() + "]", true);
}
示例9: renderElement
import com.intellij.codeInsight.lookup.LookupElementPresentation; //导入方法依赖的package包/类
public void renderElement(LookupElementPresentation presentation) {
presentation.setItemText(getLookupString());
presentation.setTypeText(parameter.getType().toString());
if (!parameter.getValue().isEmpty())
presentation.appendTailText("(" + parameter.getValue() + ")", true);
presentation.setIcon(Icons.Parameter);
}