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


Java SpeedSearchUtil类代码示例

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


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

示例1: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
    Color bgColor = UIUtil.getListBackground();
    setPaintFocusBorder(hasFocus && UIUtil.isToUseDottedCellBorder());

    if (value instanceof SearchResultElement) {
        SearchResultElement element = (SearchResultElement) value;
        String stringKeyText = "(" + element.getName() + ")";
        String text = new StringEllipsisPolicy().ellipsizeText(element.getValue(), matcher);

        SimpleTextAttributes nameAttributes = new SimpleTextAttributes(Font.PLAIN, list.getForeground());
        SpeedSearchUtil.appendColoredFragmentForMatcher(text, this, nameAttributes, matcher, bgColor, selected);
        append(" " + stringKeyText, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
    }

    setBackground(selected ? UIUtil.getListSelectionBackground() : bgColor);
}
 
开发者ID:hoai265,项目名称:SearchResourcePlugin,代码行数:18,代码来源:ResultElementListCellRenderer.java

示例2: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
    Color bgColor = UIUtil.getListBackground();
    setPaintFocusBorder(hasFocus && UIUtil.isToUseDottedCellBorder());

    if (value instanceof StringElement) {
        StringElement element = (StringElement) value;
        String stringKeyText = "(" + element.getName() + ")";
        String text = new StringEllipsisPolicy().ellipsizeText(element.getValue(), matcher);

        SimpleTextAttributes nameAttributes = new SimpleTextAttributes(Font.PLAIN, list.getForeground());
        SpeedSearchUtil.appendColoredFragmentForMatcher(text, this, nameAttributes, matcher, bgColor, selected);
        // TODO Change icon
        setIcon(AndroidIcons.EmptyFlag);

        append(" " + stringKeyText, new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
    }

    setBackground(selected ? UIUtil.getListSelectionBackground() : bgColor);
}
 
开发者ID:konifar,项目名称:android-strings-search-plugin,代码行数:21,代码来源:StringElementListCellRenderer.java

示例3: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
  if (value instanceof FileInfo) {
    Project project = mySwitcherPanel.project;
    VirtualFile virtualFile = ((FileInfo)value).getFirst();
    String renderedName = ((FileInfo)value).getNameForRendering();
    setIcon(IconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, project));

    FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile);
    open = FileEditorManager.getInstance(project).isFileOpen(virtualFile);
    TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
    append(renderedName, SimpleTextAttributes.fromTextAttributes(attributes));

    // calc color the same way editor tabs do this, i.e. including EPs
    Color color = EditorTabbedContainer.calcTabColor(project, virtualFile);

    if (!selected && color != null) {
      setBackground(color);
    }
    SpeedSearchUtil.applySpeedSearchHighlighting(mySwitcherPanel, this, false, selected);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:Switcher.java

示例4: 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

示例5: 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

示例6: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
protected void customizeCellRenderer(@Nonnull JList list, Object value, int index, boolean selected, boolean hasFocus) {
  if (value instanceof FileInfo) {
    Project project = mySwitcherPanel.project;
    VirtualFile virtualFile = ((FileInfo)value).getFirst();
    String renderedName = ((FileInfo)value).getNameForRendering();
    setIcon(VfsIconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, project));

    FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile);
    open = FileEditorManager.getInstance(project).isFileOpen(virtualFile);
    TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
    append(renderedName, SimpleTextAttributes.fromTextAttributes(attributes));

    // calc color the same way editor tabs do this, i.e. including EPs
    Color color = EditorTabbedContainer.calcTabColor(project, virtualFile);

    if (!selected && color != null) {
      setBackground(color);
    }
    SpeedSearchUtil.applySpeedSearchHighlighting(mySwitcherPanel, this, false, selected);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:Switcher.java

示例7: 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

示例8: 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

示例9: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {

    AbstractTreeNode treeNode = (AbstractTreeNode)value;
    append(treeNode.getText(), treeNode.getAttributes());
    final String errorText = treeNode.getErrorText();
    if (errorText != null) {
      append(" - ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
      append("Error: ", SimpleTextAttributes.ERROR_ATTRIBUTES);
      append(errorText, SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
    setIcon(treeNode.getIcon(false));
    SpeedSearchUtil.applySpeedSearchHighlighting(tree, this, true, selected);
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:UpdateTreeCellRenderer.java

示例10: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
public void customizeCellRenderer(JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  ChangesBrowserNode node = (ChangesBrowserNode)value;
  node.render(this, selected, expanded, hasFocus);
  SpeedSearchUtil.applySpeedSearchHighlighting(tree, this, true, selected);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ChangesBrowserNodeRenderer.java

示例11: getListCellRendererComponent

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, boolean focus) {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(true);

  final Color bg = sel ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
  final Color fg = sel ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground();
  panel.setBackground(bg);
  panel.setForeground(fg);

  SimpleTextAttributes attr = sel ? SELECTED : PLAIN;
  if (value instanceof InspectionToolWrapper) {
    final InspectionToolWrapper toolWrapper = (InspectionToolWrapper)value;
    final SimpleColoredComponent c = new SimpleColoredComponent();
    SpeedSearchUtil.appendColoredFragmentForMatcher("  " + toolWrapper.getDisplayName(), c, attr, myMatcher, bg, sel);
    panel.add(c, BorderLayout.WEST);

    final SimpleColoredComponent group = new SimpleColoredComponent();
    SpeedSearchUtil.appendColoredFragmentForMatcher(toolWrapper.getGroupDisplayName() + "  ", group, attr, myMatcher, bg, sel);
    final JPanel right = new JPanel(new BorderLayout());
    right.setBackground(bg);
    right.setForeground(fg);
    right.add(group, BorderLayout.CENTER);
    final JLabel icon = new JLabel(getIcon(toolWrapper));
    icon.setBackground(bg);
    icon.setForeground(fg);
    right.add(icon, BorderLayout.EAST);
    panel.add(right, BorderLayout.EAST);
  }
  else {
    // E.g. "..." item
    return value == ChooseByNameBase.NON_PREFIX_SEPARATOR ? ChooseByNameBase.renderNonPrefixSeparatorComponent(UIUtil.getListBackground()) :
           super.getListCellRendererComponent(list, value, index, sel, focus);
  }

  return panel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:InspectionListCellRenderer.java

示例12: getListCellRendererComponent

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList jList, Object value, int i, boolean sel, boolean focus) {
    JPanel jPanel = new JPanel(new BorderLayout());
    jPanel.setOpaque(true);

    final Color bg = sel ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
    final Color fg = sel ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground();
    jPanel.setBackground(bg);
    jPanel.setForeground(fg);

    SimpleTextAttributes attr = sel ? SELECTED : PLAIN;
    if (value instanceof EmberItem) {
        EmberItem item = (EmberItem) value;
        final SimpleColoredComponent c = new SimpleColoredComponent();
        SpeedSearchUtil.appendColoredFragmentForMatcher("  " + item.getItemName(), c, attr, null, bg, sel);
        jPanel.add(c, BorderLayout.WEST);

        final SimpleColoredComponent group = new SimpleColoredComponent();
        SpeedSearchUtil.appendColoredFragmentForMatcher(item.getItemType() + "  ", group, attr, null, bg, sel);
        final JPanel right = new JPanel(new BorderLayout());
        right.setBackground(bg);
        right.setForeground(fg);
        right.add(group, BorderLayout.CENTER);
        jPanel.add(right, BorderLayout.EAST);
    }
    else {
        // E.g. "..." item
        return ChooseByNameBase.renderNonPrefixSeparatorComponent(UIUtil.getListBackground());
    }

    return jPanel;
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:33,代码来源:GotoEmberModel.java

示例13: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
  setBorder(null);
  if (value == null) {
    return;
  }
  append(value.toString(), applyHighlighters(this, row, column, hasFocus, selected));
  SpeedSearchUtil.applySpeedSearchHighlighting(table, this, false, selected);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:VcsLogGraphTable.java

示例14: customizeCellRenderer

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
public void customizeCellRenderer(@Nonnull JTree tree,
                                  Object value,
                                  boolean selected,
                                  boolean expanded,
                                  boolean leaf,
                                  int row,
                                  boolean hasFocus) {
  ChangesBrowserNode node = (ChangesBrowserNode)value;
  node.render(this, selected, expanded, hasFocus);
  SpeedSearchUtil.applySpeedSearchHighlighting(tree, this, true, selected);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ChangesBrowserNodeRenderer.java

示例15: renderTreeNode

import com.intellij.ui.speedSearch.SpeedSearchUtil; //导入依赖的package包/类
@Override
public void renderTreeNode(SimpleColoredComponent component, JTree tree) {
  SpeedSearchUtil.appendFragmentsForSpeedSearch(tree, getText(), SimpleTextAttributes.REGULAR_ATTRIBUTES, false, component);
  component.setIcon(myParameter.getIcon(0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ParameterClassMember.java


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