/*
 * 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.newdatasource;

import static com.codenvy.ide.api.notification.Notification.Type.ERROR;

import com.codenvy.ide.api.notification.Notification;
import com.codenvy.ide.api.notification.NotificationManager;
import com.codenvy.ide.api.ui.action.Action;
import com.codenvy.ide.api.ui.action.ActionEvent;
import com.codenvy.ide.api.ui.wizard.DefaultWizard;
import com.codenvy.ide.api.ui.wizard.WizardDialog;
import com.codenvy.ide.api.ui.wizard.WizardDialogFactory;
import com.google.inject.Inject;

public class NewDatasourceAction extends Action {

    protected NotificationManager   notificationManager;
    protected WizardDialogFactory   wizardDialogFactory;
    protected DefaultWizard wizard;

    @Inject
    public NewDatasourceAction(NotificationManager notificationManager,
                                 WizardDialogFactory wizardDialogFactory,
                                 @NewDatasourceWizardQualifier DefaultWizard wizard) {
        super("New Datasource Connection");
        this.notificationManager = notificationManager;
        this.wizardDialogFactory = wizardDialogFactory;
        this.wizard = wizard;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        try {
            WizardDialog wizardDialog = wizardDialogFactory.create(wizard);
            wizardDialog.show();
        } catch (Exception e1) {
            String errorMassage = e1.getMessage() != null ? e1.getMessage()
                : "An error occured while creating the datasource connection";
            Notification notification = new Notification(errorMassage, ERROR);
            notificationManager.showNotification(notification);
        }
    }

}

@@ -653,16 +653,614 @@
 ource;%0A%0A
+/*%0A * Copyright 2014 Codenvy, S.A.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A
 import s
@@ -1814,18 +1814,16 @@
 Manager 
-  
 notifica
@@ -1869,18 +1869,16 @@
 Factory 
-  
 wizardDi
@@ -1914,24 +1914,30 @@
 faultWizard 
+      
 wizard;%0A%0A   
@@ -2040,34 +2040,32 @@
                 
-  
 WizardDialogFact
@@ -2089,18 +2089,16 @@
 actory,%0A
-  
         

Add missing copyright header