import javax.transaction.Status;
import javax.transaction.UserTransaction;
-import org.argeo.ArgeoException;
+import org.argeo.cms.CmsException;
import org.argeo.security.ui.admin.SecurityAdminPlugin;
import org.argeo.security.ui.admin.internal.UiAdminUtils;
import org.argeo.security.ui.admin.internal.UserAdminWrapper;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.handlers.HandlerUtil;
import org.osgi.service.useradmin.UserAdminEvent;
/** Manage the transaction that is bound to the current perspective */
try {
if (TRANSACTION_BEGIN.equals(commandId)) {
if (userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION)
- throw new ArgeoException("A transaction already exists");
+ throw new CmsException("A transaction already exists");
else
userTransaction.begin();
} else if (TRANSACTION_COMMIT.equals(commandId)) {
if (userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION)
- throw new ArgeoException("No transaction.");
+ throw new CmsException("No transaction.");
else
userTransaction.commit();
} else if (TRANSACTION_ROLLBACK.equals(commandId)) {
if (userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION)
- throw new ArgeoException("No transaction to rollback.");
+ throw new CmsException("No transaction to rollback.");
else {
userTransaction.rollback();
userAdminWrapper.notifyListeners(new UserAdminEvent(null,
}
}
+ UiAdminUtils.notifyTransactionStateChange(userTransaction);
// Try to remove invalid thread access errors when managing users.
- HandlerUtil.getActivePart(event).getSite().getShell().getDisplay()
- .asyncExec(new Runnable() {
- @Override
- public void run() {
- UiAdminUtils
- .notifyTransactionStateChange(userTransaction);
- }
- });
+ // HandlerUtil.getActivePart(event).getSite().getShell().getDisplay()
+ // .asyncExec(new Runnable() {
+ // @Override
+ // public void run() {
+ // UiAdminUtils
+ // .notifyTransactionStateChange(userTransaction);
+ // }
+ // });
- } catch (ArgeoException e) {
+ } catch (CmsException e) {
throw e;
} catch (Exception e) {
- throw new ArgeoException("Unable to call " + commandId + " on "
+ throw new CmsException("Unable to call " + commandId + " on "
+ userTransaction, e);
}
return null;