本文整理汇总了Java中com.intellij.util.text.MatcherHolder.getAssociatedMatcher方法的典型用法代码示例。如果您正苦于以下问题:Java MatcherHolder.getAssociatedMatcher方法的具体用法?Java MatcherHolder.getAssociatedMatcher怎么用?Java MatcherHolder.getAssociatedMatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.text.MatcherHolder
的用法示例。
在下文中一共展示了MatcherHolder.getAssociatedMatcher方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getListCellRendererComponent
import com.intellij.util.text.MatcherHolder; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
removeAll();
myRightComponentWidth = 0;
DefaultListCellRenderer rightRenderer = getRightCellRenderer(value);
Component rightCellRendererComponent = null;
JPanel spacer = null;
if (rightRenderer != null) {
rightCellRendererComponent = rightRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
add(rightCellRendererComponent, BorderLayout.EAST);
spacer = new JPanel();
spacer.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
add(spacer, BorderLayout.CENTER);
myRightComponentWidth = rightCellRendererComponent.getPreferredSize().width;
myRightComponentWidth += spacer.getPreferredSize().width;
}
ListCellRenderer leftRenderer = new LeftRenderer(null, MatcherHolder.getAssociatedMatcher(list));
final Component leftCellRendererComponent = leftRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
add(leftCellRendererComponent, LEFT);
final Color bg = isSelected ? UIUtil.getListSelectionBackground() : leftCellRendererComponent.getBackground();
setBackground(bg);
if (rightCellRendererComponent != null) {
rightCellRendererComponent.setBackground(bg);
}
if (spacer != null) {
spacer.setBackground(bg);
}
return this;
}
示例2: getListCellRendererComponent
import com.intellij.util.text.MatcherHolder; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
removeAll();
final boolean hasRightRenderer = UISettings.getInstance().getShowIconInQuickNavigation();
final LeftRenderer left = new LeftRenderer(true, MatcherHolder.getAssociatedMatcher(list));
final Component leftCellRendererComponent = left.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
final Color listBg = leftCellRendererComponent.getBackground();
add(leftCellRendererComponent, BorderLayout.WEST);
setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg);
if (hasRightRenderer) {
final DefaultListCellRenderer moduleRenderer = new PsiElementModuleRenderer();
final Component rightCellRendererComponent = moduleRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
((JComponent)rightCellRendererComponent).setOpaque(false);
rightCellRendererComponent.setBackground(listBg);
add(rightCellRendererComponent, BorderLayout.EAST);
final JPanel spacer = new NonOpaquePanel();
final Dimension size = rightCellRendererComponent.getSize();
spacer.setSize(new Dimension((int)(size.width * 0.015 + leftCellRendererComponent.getSize().width * 0.015), size.height));
spacer.setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg);
add(spacer, BorderLayout.CENTER);
}
return this;
}