]> git.argeo.org Git - lgpl/argeo-commons.git/blob - admin/internal/UiAdminUtils.java
Prepare next development cycle
[lgpl/argeo-commons.git] / admin / internal / UiAdminUtils.java
1 package org.argeo.security.ui.admin.internal;
2
3 import javax.transaction.UserTransaction;
4
5 import org.argeo.cms.CmsException;
6 import org.argeo.security.ui.admin.internal.providers.UserTransactionProvider;
7 import org.eclipse.ui.IWorkbenchWindow;
8 import org.eclipse.ui.PlatformUI;
9 import org.eclipse.ui.services.ISourceProviderService;
10
11 /** First effort to centralize back end methods used by the user admin UI */
12 public class UiAdminUtils {
13 /*
14 * INTERNAL METHODS: Below methods are meant to stay here and are not part
15 * of a potential generic backend to manage the useradmin
16 */
17 /** Easily notify the ActiveWindow that the transaction had a state change */
18 public final static void notifyTransactionStateChange(
19 UserTransaction userTransaction) {
20 try {
21 IWorkbenchWindow aww = PlatformUI.getWorkbench()
22 .getActiveWorkbenchWindow();
23 ISourceProviderService sourceProviderService = (ISourceProviderService) aww
24 .getService(ISourceProviderService.class);
25 UserTransactionProvider esp = (UserTransactionProvider) sourceProviderService
26 .getSourceProvider(UserTransactionProvider.TRANSACTION_STATE);
27 esp.fireTransactionStateChange();
28 } catch (Exception e) {
29 throw new CmsException("Unable to begin transaction", e);
30 }
31 }
32 }