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


Java SpeedSearchUtil.appendColoredFragments方法代码示例

本文整理汇总了Java中com.intellij.ui.speedSearch.SpeedSearchUtil.appendColoredFragments方法的典型用法代码示例。如果您正苦于以下问题:Java SpeedSearchUtil.appendColoredFragments方法的具体用法?Java SpeedSearchUtil.appendColoredFragments怎么用?Java SpeedSearchUtil.appendColoredFragments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.speedSearch.SpeedSearchUtil的用法示例。


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

示例1: renderItemName

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入方法依赖的package包/类
private void renderItemName(LookupElement item,
                    Color foreground,
                    boolean selected,
                    @SimpleTextAttributes.StyleAttributeConstant int style,
                    String name,
                    final SimpleColoredComponent nameComponent) {
  final SimpleTextAttributes base = new SimpleTextAttributes(style, foreground);

  final String prefix = item instanceof EmptyLookupItem ? "" : myLookup.itemPattern(item);
  if (prefix.length() > 0) {
    Iterable<TextRange> ranges = getMatchingFragments(prefix, name);
    if (ranges != null) {
      SimpleTextAttributes highlighted =
        new SimpleTextAttributes(style, selected ? SELECTED_PREFIX_FOREGROUND_COLOR : PREFIX_FOREGROUND_COLOR);
      SpeedSearchUtil.appendColoredFragments(nameComponent, name, ranges, base, highlighted);
      return;
    }
  }
  nameComponent.append(name, base);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LookupCellRenderer.java

示例2: appendWithColoredMatches

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入方法依赖的package包/类
private static void appendWithColoredMatches(SimpleColoredComponent nameComponent,
                                             String name,
                                             String pattern,
                                             Color fg,
                                             boolean selected) {
  SimpleTextAttributes plain = new SimpleTextAttributes(STYLE_PLAIN, fg);
  SimpleTextAttributes highlighted = new SimpleTextAttributes(null, fg, null, STYLE_SEARCH_MATCH);
  List<TextRange> fragments = ContainerUtil.newArrayList();
  if (selected) {
    int matchStart = StringUtil.indexOfIgnoreCase(name, pattern, 0);
    if (matchStart >= 0) {
      fragments.add(TextRange.from(matchStart, pattern.length()));
    }
  }
  SpeedSearchUtil.appendColoredFragments(nameComponent, name, fragments, plain, highlighted);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GotoActionModel.java

示例3: renderItemName

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入方法依赖的package包/类
private void renderItemName(LookupElement item,
                            Color foreground,
                            boolean selected,
                            @SimpleTextAttributes.StyleAttributeConstant int style,
                            String name,
                            final SimpleColoredComponent nameComponent) {
  final SimpleTextAttributes base = new SimpleTextAttributes(style, foreground);

  final String prefix = item instanceof EmptyLookupItem ? "" : myLookup.itemPattern(item);
  if (prefix.length() > 0) {
    Iterable<TextRange> ranges = getMatchingFragments(prefix, name);
    if (ranges != null) {
      SimpleTextAttributes highlighted =
              new SimpleTextAttributes(style, selected ? SELECTED_PREFIX_FOREGROUND_COLOR : PREFIX_FOREGROUND_COLOR);
      SpeedSearchUtil.appendColoredFragments(nameComponent, name, ranges, base, highlighted);
      return;
    }
  }
  nameComponent.append(name, base);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:LookupCellRenderer.java

示例4: addText

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入方法依赖的package包/类
@Override
protected void addText(@NotNull Object value, boolean isSelected, int row)
{
	String presentation = ((ReferenceType) value).name();
	append(" ");
	if(isSelected)
	{
		FList<TextRange> textRanges = myMatcher.matchingFragments(presentation);
		if(textRanges != null)
		{
			SimpleTextAttributes attributes = new SimpleTextAttributes(getBackground(), getForeground(), null, SimpleTextAttributes.STYLE_SEARCH_MATCH);
			SpeedSearchUtil.appendColoredFragments(this, presentation, textRanges, SimpleTextAttributes.REGULAR_ATTRIBUTES, attributes);
		}
	}
	else
	{
		append(String.format("%s", presentation), SimpleTextAttributes.REGULAR_ATTRIBUTES);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:ClassesTable.java


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