+ public final static boolean isEmpty(String string) {
+ if (string == null)
+ return true;
+ else
+ return "".equals(string.trim());
+ }
+
+ /** Must be called from the UI Thread. */
+ public final static void beginTransactionIfNeeded(
+ UserTransaction userTransaction) {
+ try {
+ if (userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION) {
+ userTransaction.begin();
+ notifyTransactionStateChange(userTransaction);
+ }
+ } catch (Exception e) {
+ throw new ArgeoException("Unable to begin transaction", e);
+ }
+ }
+
+ /** Easily notify the ActiveWindow that the transaction had a state change */
+ public final static void notifyTransactionStateChange(
+ UserTransaction userTransaction) {
+ try {
+ IWorkbenchWindow aww = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ ISourceProviderService sourceProviderService = (ISourceProviderService) aww
+ .getService(ISourceProviderService.class);
+ UserTransactionProvider esp = (UserTransactionProvider) sourceProviderService
+ .getSourceProvider(UserTransactionProvider.TRANSACTION_STATE);
+ esp.fireTransactionStateChange();
+ } catch (Exception e) {
+ throw new ArgeoException("Unable to begin transaction", e);
+ }
+ }