Project

General

Profile

Download (1.67 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.local.view.datasource.e4.handler;
10

    
11
import org.eclipse.core.runtime.IStatus;
12
import org.eclipse.jface.wizard.Wizard;
13
import org.eclipse.jface.wizard.WizardDialog;
14
import org.eclipse.swt.widgets.Shell;
15

    
16
import eu.etaxonomy.cdm.config.ICdmSource;
17
import eu.etaxonomy.cdm.database.ICdmDataSource;
18
import eu.etaxonomy.taxeditor.local.datasource.wizard.CdmDataSourceWizard;
19
import eu.etaxonomy.taxeditor.local.view.datasource.CdmMetaDataAwareDataSourceContainer;
20
import eu.etaxonomy.taxeditor.local.view.datasource.e4.CdmDataSourceViewPartE4;
21

    
22
/**
23
 * @author pplitzner
24
 * @date 22.08.2017
25
 */
26
public class EditDataSourceHandlerE4 extends AbstractDataSourceHandler {
27

    
28
    @Override
29
    public boolean specificExecute(CdmDataSourceViewPartE4 dataSourceViewPart, CdmMetaDataAwareDataSourceContainer container, Shell shell) {
30
		ICdmSource cdmSource = container.getCdmSource();
31
		//FIXME:Remoting we need another wizard for ICdmRemoteSource
32
		if(cdmSource instanceof ICdmDataSource) {
33
			Wizard wizard = new CdmDataSourceWizard((ICdmDataSource)cdmSource, CdmDataSourceWizard.Mode.EDIT);
34
			WizardDialog dialog = new WizardDialog(shell, wizard);
35

    
36
			int result = dialog.open();
37

    
38
			if(result == IStatus.OK){
39
				if(dataSourceViewPart != null){
40
					container.getMetaDataFromDataSource();
41
					dataSourceViewPart.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
42
				}
43
			}
44
		}
45
		return false;
46
	}
47
}
(5-5/5)