X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Fhandler%2FAbstractDatabaseHandler.java;fp=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Fhandler%2FAbstractDatabaseHandler.java;h=b1a30988cf4f331336f89b15a8739c8b3d40388a;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/AbstractDatabaseHandler.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/AbstractDatabaseHandler.java new file mode 100644 index 000000000..b1a30988c --- /dev/null +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/handler/AbstractDatabaseHandler.java @@ -0,0 +1,21 @@ +package org.simantics.ui.workbench.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.simantics.db.exception.DatabaseException; + +abstract public class AbstractDatabaseHandler extends AbstractHandler { + + abstract public Object checkedExecute(ExecutionEvent event) throws ExecutionException, DatabaseException; + + @Override + final public Object execute(ExecutionEvent event) throws ExecutionException { + try { + return checkedExecute(event); + } catch (DatabaseException e) { + throw new ExecutionException("The handler caught an unhandled exception, ", e); + } + } + +}