Search in sources :

Example 1 with DebugConfigurationDto

use of org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto 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));
    }
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) ArrayList(java.util.ArrayList) DebugConfigurationDto(org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto)

Example 2 with DebugConfigurationDto

use of org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto in project che by eclipse.

the class DebugConfigurationsManagerImpl method retrieveConfigurations.

private List<DebugConfigurationDto> retrieveConfigurations() {
    List<DebugConfigurationDto> configurationsList;
    if (localStorageOptional.isPresent()) {
        final LocalStorage localStorage = localStorageOptional.get();
        final Optional<String> data = Optional.fromNullable(localStorage.getItem(LOCAL_STORAGE_DEBUG_CONF_KEY));
        if (data.isPresent() && !data.get().isEmpty()) {
            configurationsList = dtoFactory.createListDtoFromJson(data.get(), DebugConfigurationDto.class);
        } else {
            configurationsList = emptyList();
        }
    } else {
        configurationsList = emptyList();
    }
    return configurationsList;
}
Also used : LocalStorage(org.eclipse.che.ide.util.storage.LocalStorage) DebugConfigurationDto(org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto)

Aggregations

DebugConfigurationDto (org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto)2 ArrayList (java.util.ArrayList)1 DebugConfiguration (org.eclipse.che.ide.api.debug.DebugConfiguration)1 LocalStorage (org.eclipse.che.ide.util.storage.LocalStorage)1