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


Java DefaultLookupItemRenderer类代码示例

本文整理汇总了Java中com.intellij.codeInsight.lookup.DefaultLookupItemRenderer的典型用法代码示例。如果您正苦于以下问题:Java DefaultLookupItemRenderer类的具体用法?Java DefaultLookupItemRenderer怎么用?Java DefaultLookupItemRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: renderElement

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
@Override
public void renderElement(final LookupItem item, final Object element, final LookupElementPresentation presentation) {
  presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal()));

  presentation.setItemText(PsiUtilCore.getName((PsiElement)element));
  presentation.setStrikeout(isToStrikeout(item));

  presentation.setTailText((String)item.getAttribute(LookupItem.TAIL_TEXT_ATTR), item.getAttribute(LookupItem.TAIL_TEXT_SMALL_ATTR) != null);

  PsiType type = ((BeanPropertyElement)element).getPropertyType();
  presentation.setTypeText(type == null ? null : type.getPresentableText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaElementLookupRenderer.java

示例2: renderClassItem

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
public static void renderClassItem(LookupElementPresentation presentation, LookupItem item, PsiClass psiClass, boolean diamond) {
  if (!(psiClass instanceof PsiTypeParameter)) {
    presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal()));
  }

  final boolean bold = item.getAttribute(LookupItem.HIGHLIGHTED_ATTR) != null;
  boolean strikeout = JavaElementLookupRenderer.isToStrikeout(item);
  presentation.setItemText(getName(psiClass, item, diamond));
  presentation.setStrikeout(strikeout);
  presentation.setItemTextBold(bold);

  String tailText = getLocationString(item);
  PsiSubstitutor substitutor = (PsiSubstitutor)item.getAttribute(LookupItem.SUBSTITUTOR);

  if (item instanceof PsiTypeLookupItem) {
    if (((PsiTypeLookupItem)item).isIndicateAnonymous() &&
        (psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT)) ||
        ((PsiTypeLookupItem)item).isAddArrayInitializer()) {
      tailText = "{...}" + tailText;
    }
  }
  if (substitutor == null && !diamond && psiClass.getTypeParameters().length > 0) {
    tailText = "<" + StringUtil.join(psiClass.getTypeParameters(), new Function<PsiTypeParameter, String>() {
      @Override
      public String fun(PsiTypeParameter psiTypeParameter) {
        return psiTypeParameter.getName();
      }
    }, "," + (showSpaceAfterComma(psiClass) ? " " : "")) + ">" + tailText;
  }
  presentation.setTailText(tailText, true);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:JavaPsiClassReferenceElement.java

示例3: renderElement

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
@Override
public void renderElement(final LookupItem item, final Object element, final LookupElementPresentation presentation) {
  presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal()));

  presentation.setItemText(getName(element, item));
  presentation.setStrikeout(isToStrikeout(item));
  presentation.setItemTextBold(item.getAttribute(LookupItem.HIGHLIGHTED_ATTR) != null);

  presentation.setTailText((String)item.getAttribute(LookupItem.TAIL_TEXT_ATTR), item.getAttribute(LookupItem.TAIL_TEXT_SMALL_ATTR) != null);

  presentation.setTypeText(getTypeText(element, item));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:JavaElementLookupRenderer.java

示例4: renderClassItem

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
public static void renderClassItem(LookupElementPresentation presentation,
		LookupElement item,
		PsiClass psiClass,
		boolean diamond,
		@NotNull String locationString,
		@NotNull PsiSubstitutor substitutor)
{
	if(!(psiClass instanceof PsiTypeParameter))
	{
		presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal()));
	}

	boolean strikeout = JavaElementLookupRenderer.isToStrikeout(item);
	presentation.setItemText(getName(psiClass, item, diamond, substitutor));
	presentation.setStrikeout(strikeout);

	String tailText = locationString;

	if(item instanceof PsiTypeLookupItem)
	{
		if(((PsiTypeLookupItem) item).isIndicateAnonymous() && (psiClass.isInterface() || psiClass.hasModifierProperty(PsiModifier.ABSTRACT)) || ((PsiTypeLookupItem) item)
				.isAddArrayInitializer())
		{
			tailText = "{...}" + tailText;
		}
	}
	if(substitutor == PsiSubstitutor.EMPTY && !diamond && psiClass.getTypeParameters().length > 0)
	{
		String separator = "," + (showSpaceAfterComma(psiClass) ? " " : "");
		tailText = "<" + StringUtil.join(psiClass.getTypeParameters(), PsiTypeParameter::getName, separator) + ">" + tailText;
	}
	presentation.setTailText(tailText, true);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:34,代码来源:JavaPsiClassReferenceElement.java

示例5: renderElement

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
@Override
public void renderElement(final LookupItem item, final Object element, final LookupElementPresentation presentation)
{
	presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal()));

	presentation.setItemText(PsiUtilCore.getName((PsiElement) element));
	presentation.setStrikeout(isToStrikeout(item));

	presentation.setTailText((String) item.getAttribute(LookupItem.TAIL_TEXT_ATTR), item.getAttribute(LookupItem.TAIL_TEXT_SMALL_ATTR) != null);

	PsiType type = ((BeanPropertyElement) element).getPropertyType();
	presentation.setTypeText(type == null ? null : type.getPresentableText());
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:JavaElementLookupRenderer.java

示例6: renderElement

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation) {
  presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(this, presentation.isReal()));
  myHelper.renderElement(presentation, !myHelper.willBeImported(), true, PsiSubstitutor.EMPTY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:JavaGlobalMemberLookupElement.java

示例7: renderElement

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation) {
  presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(this, presentation.isReal()));
  myHelper.renderElement(presentation, null, PsiSubstitutor.EMPTY);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:JavaGlobalMemberLookupElement.java

示例8: renderElement

import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer; //导入依赖的package包/类
@Override
public void renderElement(LookupElementPresentation presentation)
{
	presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(this, presentation.isReal()));
	myHelper.renderElement(presentation, !myHelper.willBeImported(), true, PsiSubstitutor.EMPTY);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:JavaGlobalMemberLookupElement.java


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