// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
* @version 1.0
*/
public class UpdateDataSourceHandler extends AbstractDataSourceHandler {
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.datasource.handler.AbstractDataSourceHandler#specificExecute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public boolean specificExecute(ExecutionEvent event) {
final CdmMetaDataAwareDataSourceContainer container = getSelectedDataSourceContainer(event);
-
+
final Display display = Display.getCurrent();
- if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Are you sure you want to update the datasource?")){
+ if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Update Datasource", "Are you sure you want to update the datasource?")){
return false;
}
Job job = new Job("Updating datasource " + container.getDataSource().getName()){
protected IStatus run(IProgressMonitor monitor) {
CdmUpdater updater = new CdmUpdater();
IStatus status = null;
-
+
try{
if(updater.updateToCurrentVersion(container.getDataSource(), CdmProgressMonitorAdapter.CreateMonitor(monitor))){
display.asyncExec(new Runnable(){
@Override
public void run() {
-
+
CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
if(view != null){
view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
}
-
+
}
});
status = Status.OK_STATUS;
status = new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, e.getMessage(), e);
StoreUtil.errorDialog("Could not run updater", getClass(), status);
}
-
-
+
+
return status;
}
-
+
};
-
+
job.setPriority(Job.BUILD);
job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
job.schedule();
-
+
return false;
}
}