Search in sources :

Example 1 with Category

use of org.eclipse.che.ide.ui.list.Category in project che by eclipse.

the class EditCommandsViewImpl method renderCategoriesList.

/**
     * Render the commands list.
     * It also takes into account the name filter and restores the selected command.
     */
private void renderCategoriesList(Map<CommandType, List<CommandImpl>> categories) {
    final List<Category<?>> categoriesToRender = new ArrayList<>();
    for (CommandType type : categories.keySet()) {
        List<CommandImpl> commands = new ArrayList<>();
        if (filterTextValue.isEmpty()) {
            commands = categories.get(type);
        } else {
            // filtering List
            for (final CommandImpl command : categories.get(type)) {
                if (command.getName().contains(filterTextValue)) {
                    commands.add(command);
                }
            }
        }
        Category<CommandImpl> category = new Category<>(type.getId(), commandRenderer, commands, commandEventDelegate);
        categoriesToRender.add(category);
    }
    categoriesList.clear();
    categoriesList.render(categoriesToRender, true);
    if (selectedCommand != null) {
        categoriesList.selectElement(selectedCommand);
        if (filterTextValue.isEmpty()) {
            selectText(commandName.getElement());
        }
    } else {
        resetView();
    }
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) Category(org.eclipse.che.ide.ui.list.Category) CommandType(org.eclipse.che.ide.api.command.CommandType) ArrayList(java.util.ArrayList)

Example 2 with Category

use of org.eclipse.che.ide.ui.list.Category in project che by eclipse.

the class EditDebugConfigurationsViewImpl method renderCategoriesList.

private void renderCategoriesList(Map<DebugConfigurationType, List<DebugConfiguration>> categories) {
    if (categories == null) {
        return;
    }
    final List<Category<?>> categoriesList = new ArrayList<>();
    for (DebugConfigurationType type : categories.keySet()) {
        List<DebugConfiguration> configurations = new ArrayList<>();
        if (filterTextValue.isEmpty()) {
            configurations = categories.get(type);
        } else {
            // filtering List
            for (final DebugConfiguration configuration : categories.get(type)) {
                if (configuration.getName().contains(filterTextValue)) {
                    configurations.add(configuration);
                }
            }
        }
        Category<DebugConfiguration> category = new Category<>(type.getId(), categoryRenderer, configurations, categoryEventDelegate);
        categoriesList.add(category);
    }
    list.clear();
    list.render(categoriesList, true);
    if (selectedConfiguration != null) {
        list.selectElement(selectedConfiguration);
        if (filterTextValue.isEmpty()) {
            selectText(configurationName.getElement());
        }
    } else {
        contentPanel.clear();
        contentPanel.add(hintLabel);
        namePanel.setVisible(false);
    }
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) Category(org.eclipse.che.ide.ui.list.Category) ArrayList(java.util.ArrayList) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType)

Aggregations

ArrayList (java.util.ArrayList)2 Category (org.eclipse.che.ide.ui.list.Category)2 CommandImpl (org.eclipse.che.ide.api.command.CommandImpl)1 CommandType (org.eclipse.che.ide.api.command.CommandType)1 DebugConfiguration (org.eclipse.che.ide.api.debug.DebugConfiguration)1 DebugConfigurationType (org.eclipse.che.ide.api.debug.DebugConfigurationType)1