/*
 * Copyright 2014 Codenvy, S.A.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.codenvy.ide.ext.datasource.client.editdatasource;

import com.google.inject.Inject;

/**
 * The presenter for the datasource edit/delete datasources dialog.
 * 
 * @author "Mickaël Leduque"
 */
public class EditDatasourcesPresenter implements EditDatasourcesView.ActionDelegate {

    /** The view component. */
    private EditDatasourcesView view;

    @Inject
    public EditDatasourcesPresenter(final EditDatasourcesView view) {
        this.view = view;
    }

    /** Show dialog. */
    public void showDialog() {
        this.view.showDialog();
    }

    @Override
    public void closeDialog() {
        this.view.closeDialog();

    }
}

@@ -654,16 +654,203 @@
 ource;%0A%0A
+import com.codenvy.ide.ext.datasource.client.DatasourceManager;%0Aimport com.codenvy.ide.ext.datasource.shared.DatabaseConfigurationDTO;%0Aimport com.google.gwt.view.client.ListDataProvider;%0A
 import c
@@ -1114,16 +1114,22 @@
 private 
+final 
 EditData
@@ -1144,121 +1144,557 @@
 iew 
-view;%0A%0A    @Inject%0A    public EditDatasourcesPresenter(final EditDatasourcesView view) %7B%0A        this.view = view
+                       view;%0A%0A    /** The component that stores datasources. */%0A    private final DatasourceManager                          datasourceManager;%0A%0A    /** the datasource list model component. */%0A    private final ListDataProvider%3CDatabaseConfigurationDTO%3E dataProvider = new ListDataProvider%3C%3E();%0A%0A    @Inject%0A    public EditDatasourcesPresenter(final EditDatasourcesView view,%0A                                    final DatasourceManager datasourceManager) %7B%0A        this.view = view;%0A        this.datasourceManager = datasourceManager
 ;%0A  
@@ -1745,32 +1745,63 @@
  showDialog() %7B%0A
+        setupDatasourceList();%0A
         this.vie
@@ -1908,11 +1908,337 @@
 ;%0A%0A    %7D
+%0A%0A    /** Sets the content of the datasource widget. */%0A    private void setupDatasourceList() %7B%0A        this.dataProvider.getList().clear();%0A        for (DatabaseConfigurationDTO datasource : this.datasourceManager) %7B%0A            this.dataProvider.getList().add(datasource);%0A        %7D%0A        this.dataProvider.flush();%0A    %7D
 %0A%7D%0A

Maintain a ListDataProvider for the datasource list in the edit dialog - #21