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();
}
}
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);
}
}
Aggregations