use of org.eclipse.che.ide.api.debug.DebugConfiguration 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);
}
}
use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.
the class DebugConfigurationsManagerImpl method generateUniqueConfigurationName.
private String generateUniqueConfigurationName(DebugConfigurationType configurationType, String customName) {
Set<String> configurationNames = new HashSet<>(configurations.size());
for (DebugConfiguration configuration : configurations) {
configurationNames.add(configuration.getName());
}
final String configurationName;
if (customName == null || customName.isEmpty()) {
configurationName = "Remote " + configurationType.getDisplayName();
} else {
if (!configurationNames.contains(customName)) {
return customName;
}
configurationName = customName + " copy";
}
if (!configurationNames.contains(configurationName)) {
return configurationName;
}
for (int count = 1; count < 1000; count++) {
if (!configurationNames.contains(configurationName + "-" + count)) {
return configurationName + "-" + count;
}
}
return configurationName;
}
use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.
the class DebugConfigurationsManagerImpl method saveConfigurations.
private void saveConfigurations() {
if (localStorageOptional.isPresent()) {
List<DebugConfigurationDto> configurationDtos = new ArrayList<>();
for (DebugConfiguration configuration : configurations) {
configurationDtos.add(dtoFactory.createDto(DebugConfigurationDto.class).withType(configuration.getType().getId()).withName(configuration.getName()).withHost(configuration.getHost()).withPort(configuration.getPort()).withConnectionProperties(configuration.getConnectionProperties()));
}
localStorageOptional.get().setItem(LOCAL_STORAGE_DEBUG_CONF_KEY, dtoFactory.toJson(configurationDtos));
}
}
use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.
the class EditDebugConfigurationsPresenter method fetchConfigurations.
/** Fetch configurations and update view. */
private void fetchConfigurations() {
final String originName = editedConfigurationOriginName;
reset();
view.setCancelButtonState(false);
view.setSaveButtonState(false);
view.setDebugButtonState(view.getSelectedConfiguration() != null);
final List<DebugConfiguration> configurationsList = debugConfigurationsManager.getConfigurations();
final Map<DebugConfigurationType, List<DebugConfiguration>> categories = new HashMap<>();
for (DebugConfigurationType type : debugConfigurationTypeRegistry.getTypes()) {
final List<DebugConfiguration> settingsCategory = new ArrayList<>();
for (DebugConfiguration configuration : configurationsList) {
if (type.getId().equals(configuration.getType().getId())) {
settingsCategory.add(configuration);
if (configuration.getName().equals(originName)) {
view.setSelectedConfiguration(configuration);
}
}
}
Collections.sort(settingsCategory, new Comparator<DebugConfiguration>() {
@Override
public int compare(DebugConfiguration o1, DebugConfiguration o2) {
return o1.getName().compareTo(o2.getName());
}
});
categories.put(type, settingsCategory);
}
view.setData(categories);
view.setFilterState(!configurationsList.isEmpty());
view.focusCloseButton();
}
use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.
the class EditDebugConfigurationsPresenter method handleConfigurationSelection.
private void handleConfigurationSelection(DebugConfiguration configuration) {
editedConfiguration = configuration;
editedConfigurationOriginName = configuration.getName();
view.setConfigurationName(configuration.getName());
view.setDebugButtonState(true);
final DebugConfigurationPage<? extends DebugConfiguration> page = configuration.getType().getConfigurationPage();
final DebugConfigurationPage<DebugConfiguration> p = ((DebugConfigurationPage<DebugConfiguration>) page);
editedPage = p;
p.setDirtyStateListener(new DirtyStateListener() {
@Override
public void onDirtyStateChanged() {
view.setCancelButtonState(isViewModified());
view.setSaveButtonState(isViewModified());
view.setDebugButtonState(!isViewModified());
}
});
p.resetFrom(configuration);
p.go(view.getDebugConfigurationPageContainer());
}
Aggregations