Merge branch 'release/5.17.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / datasource / e4 / handler / DeleteDataSourceHandlerE4.java
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
10 package eu.etaxonomy.taxeditor.view.datasource.e4.handler;
11
12 import org.eclipse.jface.dialogs.MessageDialog;
13 import org.eclipse.swt.widgets.Shell;
14
15 import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
16 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
17 import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
18 import eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4;
19
20 /**
21 *
22 * @author pplitzner
23 * @date 22.08.2017
24 *
25 */
26 public class DeleteDataSourceHandlerE4 extends AbstractDataSourceHandlerE4 {
27
28 /** {@inheritDoc} */
29 @Override
30 public boolean specificExecute(CdmDataSourceViewPartE4 dataSourceViewPart, CdmMetaDataAwareDataSourceContainer container, Shell shell) {
31 if(! MessageDialog.openConfirm(shell, "Confirm Deletion", "Do you want to delete the selected datasources?")){
32 return false;
33 }
34 CdmPersistentDataSource dataSource = (CdmPersistentDataSource) container.getCdmSource();
35 CdmDataSourceRepository.delete(dataSource);
36 return true;
37 }
38
39 }