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


Java PopupChooserBuilder.setFilteringEnabled方法代码示例

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


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

示例1: installSpeedSearch

import com.intellij.openapi.ui.popup.PopupChooserBuilder; //导入方法依赖的package包/类
public void installSpeedSearch(PopupChooserBuilder builder, final boolean includeContainerText) {
  builder.setFilteringEnabled(new Function<Object, String>() {
    @Override
    public String fun(Object o) {
      if (o instanceof PsiElement) {
        final String elementText = getElementText((T)o);
        if (includeContainerText) {
          return elementText + " " + getContainerText((T)o, elementText);
        }
        return elementText;
      }
      else {
        return o.toString();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PsiElementListCellRenderer.java

示例2: buildPopup

import com.intellij.openapi.ui.popup.PopupChooserBuilder; //导入方法依赖的package包/类
private JBPopup buildPopup(final JBList list,
         final Map<Object, String> filterIndex)
{
   final PopupChooserBuilder listPopupBuilder = JBPopupFactory.getInstance().createListPopupBuilder(list);
   listPopupBuilder.setTitle("Run a Forge command");
   listPopupBuilder.setResizable(true);
   listPopupBuilder.addListener(new JBPopupAdapter()
   {
      @Override
      public void onClosed(LightweightWindowEvent event)
      {
         CommandListPopupBuilder.active = false;
      }
   });
   listPopupBuilder.setItemChoosenCallback((Runnable) () -> {
      Object selectedObject = list.getSelectedValue();
      if (selectedObject instanceof UICommand)
      {
         UICommand selectedCommand = (UICommand) selectedObject;

         // Make sure that this cached command is still enabled
         if (selectedCommand.isEnabled(uiContext))
         {
            openWizard(selectedCommand);
         }
      }
   });
   listPopupBuilder.setFilteringEnabled(filterIndex::get);

   return listPopupBuilder.createPopup();
}
 
开发者ID:forge,项目名称:intellij-idea-plugin,代码行数:32,代码来源:CommandListPopupBuilder.java

示例3: installSpeedSearch

import com.intellij.openapi.ui.popup.PopupChooserBuilder; //导入方法依赖的package包/类
public void installSpeedSearch(PopupChooserBuilder builder, final boolean includeContainerText) {
  builder.setFilteringEnabled(o -> {
    if (o instanceof PsiElement) {
      final String elementText = getElementText((T)o);
      if (includeContainerText) {
        return elementText + " " + getContainerText((T)o, elementText);
      }
      return elementText;
    }
    else {
      return o.toString();
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:PsiElementListCellRenderer.java

示例4: selectTargets

import com.intellij.openapi.ui.popup.PopupChooserBuilder; //导入方法依赖的package包/类
@Override
protected void selectTargets(final List<PsiMember> targets, final Consumer<List<PsiMember>> selectionConsumer) {
  if (targets.isEmpty()) {
    selectionConsumer.consume(Collections.<PsiMember>emptyList());
    return;
  }
  if (targets.size() == 1) {
    selectionConsumer.consume(Collections.singletonList(targets.get(0)));
    return;
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    selectionConsumer.consume(targets);
    return;
  }
  Collections.sort(targets, new PsiMemberComparator());
  final List<Object> model = new ArrayList<Object>();
  model.add(CodeInsightBundle.message("highlight.thrown.exceptions.chooser.all.entry"));
  model.addAll(targets);
  final JList list = new JBList(model);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  final ListCellRenderer renderer = new NavigationItemListCellRenderer();
  list.setCellRenderer(renderer);
  final PopupChooserBuilder builder = new PopupChooserBuilder(list);
  builder.setFilteringEnabled(new Function<Object, String>() {
    @Override
    public String fun(Object o) {
      if (o instanceof PsiMember) {
        final PsiMember member = (PsiMember)o;
        return member.getName();
      }
      return o.toString();
    }
  });
  if (myImportStatic) {
    builder.setTitle(CodeInsightBundle.message("highlight.imported.members.chooser.title"));
  } else {
    builder.setTitle(CodeInsightBundle.message("highlight.imported.classes.chooser.title"));
  }
  builder.setItemChoosenCallback(new Runnable() {
    @Override
    public void run() {
      final int index= list.getSelectedIndex();
      if (index == 0) {
        selectionConsumer.consume(targets);
      }
      else {
        selectionConsumer.consume(Collections.singletonList(targets.get(index - 1)));
      }
    }
  });
  final JBPopup popup = builder.createPopup();
  popup.showInBestPositionFor(myEditor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:HighlightImportedElementsHandler.java


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