commit de620fc821953f041a5348bae7d230fd694544b0
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Fri May 4 17:31:51 2018 +0200

    ref #6913 Remove datasource handler

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/AbstractDataSourceHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/AbstractDataSourceHandler.java
deleted file mode 100644
index 26e8177de..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/AbstractDataSourceHandler.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
-
-/**
- * @author n.hoffmann
- * @created 19.05.2009
- * @version 1.0
- */
-abstract class AbstractDataSourceHandler extends AbstractHandler {
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	/** {@inheritDoc} */
-	@Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-
-//		boolean refresh = specificExecute(event);
-
-//		CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.showView(CdmDataSourceViewPart.ID);
-//		if(refresh) {
-//            view.refresh();
-//        }
-
-		return null;
-	}
-
-	/**
-	 * <p>getSelectedDataSourceContainer</p>
-	 *
-	 * @param event a {@link org.eclipse.core.commands.ExecutionEvent} object.
-	 * @return a {@link eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer} object.
-	 */
-	protected CdmMetaDataAwareDataSourceContainer getSelectedDataSourceContainer(ExecutionEvent event){
-		ISelection menuSelection = HandlerUtil.getCurrentSelection(event);
-		CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) ((StructuredSelection) menuSelection).getFirstElement();
-		return container;
-	}
-
-	/**
-	 * <p>specificExecute</p>
-	 *
-	 * @param event a {@link org.eclipse.core.commands.ExecutionEvent} object.
-	 * @return a boolean.
-	 */
-	public abstract boolean specificExecute(ExecutionEvent event);
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/ChangeConnectionHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/ChangeConnectionHandler.java
deleted file mode 100644
index 59c727227..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/ChangeConnectionHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
-import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
-
-/**
- * @author n.hoffmann
- * @created 15.04.2009
- * @version 1.0
- */
-public class ChangeConnectionHandler extends AbstractHandler {
-
-	/** {@inheritDoc} */
-	@Override
-    public Object execute(ExecutionEvent event) {
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-
-		if(selection != null && selection instanceof IStructuredSelection){
-			CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) ((IStructuredSelection) selection).getFirstElement();
-
-			if(CdmStore.isConnecting()){
-				MessagingUtils.warningDialog(Messages.ChangeConnectionHandler_ALREADY_CONNECTING, this, Messages.ChangeConnectionHandler_CURRENTLY_CONNECTING_ALREADY);
-				return null;
-			}
-
-			try {
-				container.getCdmSource().checkConnection();
-				boolean confirmed = MessagingUtils.confirmDialog(Messages.ChangeConnectionHandler_CREATE_DATAMODEL, String.format(Messages.ChangeConnectionHandler_REALLY_CREATE_DATAMODEL, container.getCdmSource().getName()));
-
-				if(confirmed){
-					CdmDataSourceRepository.changeDataSource(container.getCdmSource());
-				}
-			} catch (Exception e) {
-				MessagingUtils.warningDialog(Messages.ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE, this, Messages.ChangeConnectionHandler_NOT_AVAILABLE_REASONS);
-				MessagingUtils.warn(getClass(), e);
-				return null;
-			}
-		}
-
-		return null;
-	}
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CloneDataSourceHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CloneDataSourceHandler.java
deleted file mode 100644
index 8830cecc6..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CloneDataSourceHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.config.ICdmSource;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
-import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard;
-import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
-
-/**
- * <p>CloneDataSourceHandler class.</p>
- *
- */
-public class CloneDataSourceHandler extends AbstractDataSourceHandler {
-
-	/* (non-Javadoc)
-	 * @see eu.etaxonomy.taxeditor.store.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	/** {@inheritDoc} */
-	@Override
-	public boolean specificExecute(ExecutionEvent event) {
-		CdmMetaDataAwareDataSourceContainer container = getSelectedDataSourceContainer(event);
-		ICdmSource cdmSource = container.getCdmSource();
-		//FIXME:Remoting we need another wizard for ICdmRemoteSource
-		if(cdmSource instanceof ICdmDataSource) {
-			Wizard wizard = new CdmDataSourceWizard((ICdmDataSource)cdmSource, CdmDataSourceWizard.Mode.CLONE);
-			WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-
-			int result = dialog.open();
-
-			if(result == IStatus.OK){
-//				CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
-//				if(view != null){
-//					container.getMetaDataFromDataSource();
-//					view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
-//
-//				}
-			}
-		}
-
-		return true;
-	}
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CreateDataSourceHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CreateDataSourceHandler.java
deleted file mode 100644
index c25945bd5..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CreateDataSourceHandler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard;
-
-/**
- * <p>CreateDataSourceHandler class.</p>
- *
- * @author n.hoffmann
- * @created 15.04.2009
- * @version 1.0
- */
-public class CreateDataSourceHandler extends AbstractDataSourceHandler {
-
-	/* (non-Javadoc)
-	 * @see eu.etaxonomy.taxeditor.store.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	/** {@inheritDoc} */
-	@Override
-	public boolean specificExecute(ExecutionEvent event) {
-		Shell shell = HandlerUtil.getActiveShell(event);
-		CdmDataSourceWizard wizard = new CdmDataSourceWizard(); 
-		
-		WizardDialog dialog = new WizardDialog(shell, wizard);
-	    		
-		return dialog.open() == IStatus.OK;
-	}
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/DeleteDataSourceHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/DeleteDataSourceHandler.java
deleted file mode 100644
index 9be4a0df8..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/DeleteDataSourceHandler.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
-import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
-import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
-
-/**
- * @author n.hoffmann
- * @created 15.04.2009
- * @version 1.0
- */
-public class DeleteDataSourceHandler extends AbstractDataSourceHandler {
-
-	/** {@inheritDoc} */
-	@Override
-	public boolean specificExecute(ExecutionEvent event) {
-		ISelection selection = HandlerUtil.getActivePart(event).getSite().getSelectionProvider().getSelection();
-		if(selection instanceof IStructuredSelection){
-			Object[] selectedObjects = ((IStructuredSelection) selection).toArray();
-
-			if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you want to delete the selected datasources?")){
-				return false;
-			}
-			// Delete from persistent data sources
-			for(Object object : selectedObjects){
-				CdmPersistentDataSource dataSource = (CdmPersistentDataSource) ((CdmMetaDataAwareDataSourceContainer) object).getCdmSource();
-				CdmDataSourceRepository.delete(dataSource);
-			}
-
-			return true;
-		}
-		return false;
-	}
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/EditDataSourceHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/EditDataSourceHandler.java
deleted file mode 100644
index 9221164c2..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/EditDataSourceHandler.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.config.ICdmSource;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
-import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard;
-import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
-
-/**
- * <p>EditDataSourceHandler class.</p>
- *
- * @author n.hoffmann
- * @created 15.04.2009
- * @version 1.0
- */
-public class EditDataSourceHandler extends AbstractDataSourceHandler {
-
-	/* (non-Javadoc)
-	 * @see eu.etaxonomy.taxeditor.store.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	/** {@inheritDoc} */
-	@Override
-	public boolean specificExecute(ExecutionEvent event) {
-		CdmMetaDataAwareDataSourceContainer container = getSelectedDataSourceContainer(event);
-		ICdmSource cdmSource = container.getCdmSource();
-		//FIXME:Remoting we need another wizard for ICdmRemoteSource
-		if(cdmSource instanceof ICdmDataSource) {
-			Wizard wizard = new CdmDataSourceWizard((ICdmDataSource)cdmSource, CdmDataSourceWizard.Mode.EDIT);
-			WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-
-			int result = dialog.open();
-
-			if(result == IStatus.OK){
-//				CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
-//				if(view != null){
-//					container.getMetaDataFromDataSource();
-//					view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
-//
-//				}
-			}
-		}
-
-		return false;
-	}
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/UpdateDataSourceHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/UpdateDataSourceHandler.java
deleted file mode 100644
index 810fae13a..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/UpdateDataSourceHandler.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.datasource.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.progress.IProgressConstants;
-
-import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
-
-/**
- * <p>UpdateDataSourceHandler class.</p>
- *
- * @author n.hoffmann
- * @created Sep 22, 2010
- * @version 1.0
- */
-public class UpdateDataSourceHandler extends AbstractDataSourceHandler {
-
-	/* (non-Javadoc)
-	 * @see eu.etaxonomy.taxeditor.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	/** {@inheritDoc} */
-	@Override
-	public boolean specificExecute(ExecutionEvent event) {
-		final CdmMetaDataAwareDataSourceContainer container = getSelectedDataSourceContainer(event);
-
-		final Display display = Display.getCurrent();
-		if(! MessageDialog.open(MessageDialog.CONFIRM, HandlerUtil.getActiveShell(event), "Update Datasource", "WARNING!\n\n" +
-				"This will change your data base structure! Be sure you have an up-to-date backup of your data before running the update! \n\n " +
-				"Are you sure you want to update the datasource?", SWT.NONE)){
-			return false;
-		}
-		Job job = new Job("Updating datasource " + container.getCdmSource().getName()){
-
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-//				CdmUpdater updater = new CdmUpdater();
-				IStatus status = null;
-//				ICdmSource cdmSource = container.getCdmSource();
-//				//FIXME:Remoting we need another updater for ICdmRemoteSource
-//				if(cdmSource instanceof ICdmDataSource) {
-//				try{
-//					SchemaUpdateResult result = updater.updateToCurrentVersion(
-//							(ICdmDataSource)cdmSource, CdmProgressMonitorAdapter.CreateMonitor(monitor));
-//					if(result.isSuccess()){
-//						display.asyncExec(new Runnable(){
-//
-//							@Override
-//							public void run() {
-//
-//								CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
-//								if(view != null){
-//								    container.getMetaDataFromDataSource();
-//									view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
-//								}
-//
-//							}
-//						});
-//						status = Status.OK_STATUS;
-//					}else{
-//						throw new RuntimeException("An error occurred during the update.");
-//					}
-//				}catch(Exception e){
-//					status = new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, e.getMessage(), e);
-//					MessagingUtils.errorDialog("Could not complete updater", updater, status.getMessage(), status.getPlugin(), e, true);
-//				}
-//				}
-
-				return status;
-			}
-
-		};
-
-		job.setPriority(Job.BUILD);
-		job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
-		job.schedule();
-
-		return false;
-	}
-}
