com.intellij.ui.SpeedSearchComparator Java Examples

The following examples show how to use com.intellij.ui.SpeedSearchComparator. 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 vote down vote up
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));
}