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


Java LookupElementPresentation.appendTailText方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:39,代码来源:Suggestion.java

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

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

示例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);
}
 
开发者ID:whitefire,项目名称:eZ-completion,代码行数:9,代码来源:Completion.java

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

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

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

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

示例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);
    }
 
开发者ID:Sorien,项目名称:silex-idea-plugin,代码行数:11,代码来源:ParameterLookupElement.java


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