com.intellij.ui.ListSpeedSearch Java Examples
The following examples show how to use
com.intellij.ui.ListSpeedSearch.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CrudList.java From crud-intellij-plugin with Apache License 2.0 | 6 votes |
public CrudList() { setCellRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel jbl = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); ListElement ele = (ListElement) value; jbl.setIcon(ele.getIcon()); jbl.setText(ele.getName()); return jbl; } }); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setModel(model); new ListSpeedSearch<ListElement>(this) { @Override protected String getElementText(Object element) { return ((ListElement) element).getName(); } }.setComparator(new SpeedSearchComparator(false)); }
Example #2
Source File: ProjectLibraryTabContext.java From consulo with Apache License 2.0 | 6 votes |
public ProjectLibraryTabContext(final ClasspathPanel classpathPanel, StructureConfigurableContext context) { super(classpathPanel, context); StructureLibraryTableModifiableModelProvider projectLibrariesProvider = context.getProjectLibrariesProvider(); Library[] libraries = projectLibrariesProvider.getModifiableModel().getLibraries(); final Condition<Library> condition = LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel()); myItems = ContainerUtil.filter(libraries, condition); ContainerUtil.sort(myItems, new Comparator<Library>() { @Override public int compare(Library o1, Library o2) { return StringUtil.compare(o1.getName(), o2.getName(), false); } }); myLibraryList = new JBList(myItems); myLibraryList.setCellRenderer(new ColoredListCellRendererWrapper<Library>() { @Override protected void doCustomize(JList list, Library value, int index, boolean selected, boolean hasFocus) { final CellAppearanceEx appearance = OrderEntryAppearanceService.getInstance().forLibrary(classpathPanel.getProject(), value, false); appearance.customize(this); } }); new ListSpeedSearch(myLibraryList); }
Example #3
Source File: FileTemplateTabAsList.java From consulo with Apache License 2.0 | 6 votes |
FileTemplateTabAsList(String title) { super(title); myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myList.setCellRenderer(new MyListCellRenderer()); myList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { onTemplateSelected(); } }); new ListSpeedSearch(myList, new Function<Object, String>() { @Override public String fun(final Object o) { if (o instanceof FileTemplate) { return ((FileTemplate)o).getName(); } return null; } }); }
Example #4
Source File: ModuleDependencyTabContext.java From consulo with Apache License 2.0 | 5 votes |
public ModuleDependencyTabContext(ClasspathPanel panel, StructureConfigurableContext context) { super(panel, context); myNotAddedModules = getNotAddedModules(); myModuleList = new JBList(myNotAddedModules); myModuleList.setCellRenderer(new ModuleListCellRenderer()); new ListSpeedSearch(myModuleList); }