本文整理汇总了Java中com.intellij.util.text.MatcherHolder类的典型用法代码示例。如果您正苦于以下问题:Java MatcherHolder类的具体用法?Java MatcherHolder怎么用?Java MatcherHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatcherHolder类属于com.intellij.util.text包,在下文中一共展示了MatcherHolder类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:consulo,项目名称:consulo,代码行数:31,代码来源:PsiElementListCellRenderer.java
示例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;
}
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:NavigationItemListCellRenderer.java
示例3: rebuildList
import com.intellij.util.text.MatcherHolder; //导入依赖的package包/类
protected void rebuildList(final int pos,
final int delay,
@NotNull final ModalityState modalityState,
@Nullable final Runnable postRunnable) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (!myInitialized) {
return;
}
myAlarm.cancelAllRequests();
if (delay > 0) {
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
rebuildList(pos, 0, modalityState, postRunnable);
}
}, delay, ModalityState.stateForComponent(myTextField));
return;
}
myListUpdater.cancelAll();
final CalcElementsThread calcElementsThread = myCalcElementsThread;
if (calcElementsThread != null) {
calcElementsThread.cancel();
}
final String text = getTrimmedText();
if (!canShowListForEmptyPattern() && text.isEmpty()) {
myListModel.clear();
hideList();
myTextFieldPanel.hideHint();
myCard.show(myCardContainer, CHECK_BOX_CARD);
return;
}
ListCellRenderer cellRenderer = myList.getCellRenderer();
if (cellRenderer instanceof ExpandedItemListCellRendererWrapper) {
cellRenderer = ((ExpandedItemListCellRendererWrapper)cellRenderer).getWrappee();
}
if (cellRenderer instanceof MatcherHolder) {
final String pattern = patternToLowerCase(transformPattern(text));
final Matcher matcher = buildPatternMatcher(isSearchInAnyPlace() ? "*" + pattern : pattern);
((MatcherHolder)cellRenderer).setPatternMatcher(matcher);
}
scheduleCalcElements(text, myCheckBox.isSelected(), modalityState, new Consumer<Set<?>>() {
@Override
public void consume(Set<?> elements) {
ApplicationManager.getApplication().assertIsDispatchThread();
backgroundCalculationFinished(elements, pos);
if (postRunnable != null) {
postRunnable.run();
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:ChooseByNameBase.java
示例4: rebuildList
import com.intellij.util.text.MatcherHolder; //导入依赖的package包/类
protected void rebuildList(final int pos,
final int delay,
@NotNull final ModalityState modalityState,
@Nullable final Runnable postRunnable) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (!myInitialized) {
return;
}
myListIsUpToDate = false;
myAlarm.cancelAllRequests();
myListUpdater.cancelAll();
cancelCalcElementsThread();
final String text = myTextField.getText();
if (!canShowListForEmptyPattern() &&
(text == null || text.trim().isEmpty())) {
myListModel.clear();
hideList();
myTextFieldPanel.hideHint();
myCard.show(myCardContainer, CHECK_BOX_CARD);
return;
}
ListCellRenderer cellRenderer = myList.getCellRenderer();
if (cellRenderer instanceof ExpandedItemListCellRendererWrapper) {
cellRenderer = ((ExpandedItemListCellRendererWrapper)cellRenderer).getWrappee();
}
if (cellRenderer instanceof MatcherHolder) {
final String pattern = transformPattern(text);
final Matcher matcher = buildPatternMatcher(isSearchInAnyPlace() ? "*" + pattern : pattern);
((MatcherHolder)cellRenderer).setPatternMatcher(matcher);
}
final Runnable request = new Runnable() {
@Override
public void run() {
scheduleCalcElements(text, myCheckBox.isSelected(), postRunnable == null, modalityState, new Consumer<Set<?>>() {
@Override
public void consume(Set<?> elements) {
synchronized (myRebuildMutex) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (checkDisposed()) {
return;
}
myListIsUpToDate = true;
setElementsToList(pos, elements);
myList.repaint();
chosenElementMightChange();
if (elements.isEmpty()) {
myTextFieldPanel.hideHint();
}
if (postRunnable != null) {
postRunnable.run();
}
}
}
});
}
};
if (delay > 0) {
myAlarm.addRequest(request, delay, ModalityState.stateForComponent(myTextField));
}
else {
request.run();
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:73,代码来源:ChooseByNameBase.java
示例5: getListCellRendererComponent
import com.intellij.util.text.MatcherHolder; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component cmp;
PsiElement file;
myLocationString = null;
String pattern = "*" + myPopupField.getText();
Matcher matcher = NameUtil.buildMatcher(pattern, 0, true, true, pattern.toLowerCase().equals(pattern));
if (isMoreItem(index)) {
cmp = More.get(isSelected);
}
else if (value instanceof VirtualFile &&
myProject != null &&
((((VirtualFile)value).isDirectory() && (file = PsiManager.getInstance(myProject).findDirectory((VirtualFile)value)) != null) ||
(file = PsiManager.getInstance(myProject).findFile((VirtualFile)value)) != null)) {
MatcherHolder.associateMatcher(myFileRenderer, matcher);
cmp = myFileRenderer.getListCellRendererComponent(list, file, index, isSelected, cellHasFocus);
}
else if (value instanceof PsiElement) {
MatcherHolder.associateMatcher(myFileRenderer, matcher);
cmp = myFileRenderer.getListCellRendererComponent(list, value, index, isSelected, isSelected);
}
else {
cmp = super.getListCellRendererComponent(list, value, index, isSelected, isSelected);
final JPanel p = new JPanel(new BorderLayout());
p.setBackground(UIUtil.getListBackground(isSelected));
p.add(cmp, BorderLayout.CENTER);
cmp = p;
}
if (myLocationString != null || value instanceof BooleanOptionDescription) {
final JPanel panel = new JPanel(new BorderLayout());
panel.setBackground(UIUtil.getListBackground(isSelected));
panel.add(cmp, BorderLayout.CENTER);
final Component rightComponent;
if (value instanceof BooleanOptionDescription) {
final OnOffButton button = new OnOffButton();
button.setSelected(((BooleanOptionDescription)value).isOptionEnabled());
rightComponent = button;
}
else {
rightComponent = myLocation.getListCellRendererComponent(list, value, index, isSelected, isSelected);
}
panel.add(rightComponent, BorderLayout.EAST);
cmp = panel;
}
Color bg = cmp.getBackground();
if (bg == null) {
cmp.setBackground(UIUtil.getListBackground(isSelected));
bg = cmp.getBackground();
}
myMainPanel.setBorder(new CustomLineBorder(bg, 0, 0, 2, 0));
String title = getModel().titleIndex.getTitle(index);
myMainPanel.removeAll();
if (title != null) {
myTitle.setText(title);
myMainPanel.add(createTitle(" " + title), BorderLayout.NORTH);
}
myMainPanel.add(cmp, BorderLayout.CENTER);
final int width = myMainPanel.getPreferredSize().width;
if (width > myPopupActualWidth) {
myPopupActualWidth = width;
//schedulePopupUpdate();
}
return myMainPanel;
}
开发者ID:consulo,项目名称:consulo,代码行数:66,代码来源:SearchEverywhereAction.java
示例6: rebuildList
import com.intellij.util.text.MatcherHolder; //导入依赖的package包/类
protected void rebuildList(final int pos,
final int delay,
@Nonnull final ModalityState modalityState,
@Nullable final Runnable postRunnable) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (!myInitialized) {
return;
}
myAlarm.cancelAllRequests();
if (delay > 0) {
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
rebuildList(pos, 0, modalityState, postRunnable);
}
}, delay, ModalityState.stateForComponent(myTextField));
return;
}
myListUpdater.cancelAll();
final CalcElementsThread calcElementsThread = myCalcElementsThread;
if (calcElementsThread != null) {
calcElementsThread.cancel();
}
final String text = getTrimmedText();
if (!canShowListForEmptyPattern() && text.isEmpty()) {
myListModel.clear();
hideList();
myTextFieldPanel.hideHint();
myCard.show(myCardContainer, CHECK_BOX_CARD);
return;
}
ListCellRenderer cellRenderer = myList.getCellRenderer();
if (cellRenderer instanceof ExpandedItemListCellRendererWrapper) {
cellRenderer = ((ExpandedItemListCellRendererWrapper)cellRenderer).getWrappee();
}
if (cellRenderer instanceof MatcherHolder) {
final String pattern = patternToLowerCase(transformPattern(text));
final Matcher matcher = buildPatternMatcher(isSearchInAnyPlace() ? "*" + pattern : pattern);
((MatcherHolder)cellRenderer).setPatternMatcher(matcher);
}
scheduleCalcElements(text, myCheckBox.isSelected(), modalityState, new Consumer<Set<?>>() {
@Override
public void consume(Set<?> elements) {
ApplicationManager.getApplication().assertIsDispatchThread();
backgroundCalculationFinished(elements, pos);
if (postRunnable != null) {
postRunnable.run();
}
}
});
}
开发者ID:consulo,项目名称:consulo,代码行数:60,代码来源:ChooseByNameBase.java
注:本文中的com.intellij.util.text.MatcherHolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论