3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.datasource
.handler
;
13 import org
.eclipse
.core
.commands
.ExecutionEvent
;
14 import org
.eclipse
.jface
.viewers
.ISelection
;
15 import org
.eclipse
.jface
.viewers
.StructuredSelection
;
16 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
18 import eu
.etaxonomy
.cdm
.database
.CdmPersistentDataSource
;
19 import eu
.etaxonomy
.taxeditor
.datasource
.CdmDataSourceRepository
;
20 import eu
.etaxonomy
.taxeditor
.datasource
.view
.CdmMetaDataAwareDataSourceContainer
;
23 * <p>DeleteDataSourceHandler class.</p>
29 public class DeleteDataSourceHandler
extends AbstractDataSourceHandler
{
32 * @see eu.etaxonomy.taxeditor.store.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
36 public boolean specificExecute(ExecutionEvent event
) {
37 ISelection menuSelection
= HandlerUtil
.getActiveMenuSelection(event
);
38 Object
[] selectedObjects
= ((StructuredSelection
) menuSelection
).toArray();
40 // Delete from persistent data sources
41 for(Object object
: selectedObjects
){
42 CdmPersistentDataSource dataSource
= (CdmPersistentDataSource
) ((CdmMetaDataAwareDataSourceContainer
) object
).getDataSource();
43 CdmDataSourceRepository
.delete(dataSource
);