本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}