import eu.etaxonomy.taxeditor.datasource.view.CdmMetaDataAwareDataSourceContainer;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* @author n.hoffmann
@Override
protected IStatus run(IProgressMonitor monitor) {
CdmUpdater updater = new CdmUpdater();
- boolean result = updater.updateToCurrentVersion(container.getDataSource(), CdmProgressMonitorAdapter.CreateMonitor(monitor));
-
- if(result){
- display.asyncExec(new Runnable(){
+ 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);
+ @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;
+ }
+ }catch(Exception e){
+ status = new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, e.getMessage(), e);
+ StoreUtil.errorDialog("Could not run updater", getClass(), status);
}
- return result ? Status.OK_STATUS : Status.CANCEL_STATUS;
+
+ return status;
}
};
}
});
}
+
+ public static void errorDialog(final String title, final Object source, final IStatus status){
+
+ }
public static boolean confirmDialog(String title, String message) {
return MessageDialog.openQuestion(getShell(), title, message);
*/
public static void error(Class source, String message, Throwable t){
IStatus status = new Status(IStatus.ERROR, getPluginId(), message, t);
- getLog4JLogger(source).error(message, t);
+ error(source, status);
+ }
+
+ public static void error(Class source, IStatus status){
+ getLog4JLogger(source).error(status.getMessage(), status.getException());
log(status);
}