View Javadoc

1   package de.orangecafe.amazonrcp.interceptors;
2   
3   import org.aopalliance.intercept.MethodInterceptor;
4   import org.aopalliance.intercept.MethodInvocation;
5   import org.springframework.richclient.progress.BusyIndicator;
6   import org.springframework.richclient.application.Application;
7   
8   /**
9    * @author Torsten Strasser
10   */
11  public class BusyIndicateInterceptor implements MethodInterceptor {
12      //TODO: check why the indicator is not shown
13      public Object invoke(final MethodInvocation methodInvocation) throws Throwable {
14          BusyIndicator.showAt(Application.instance().getActiveWindow().getControl());
15          try {
16              return methodInvocation.proceed();
17          } finally {
18              BusyIndicator.clearAt(Application.instance().getActiveWindow().getControl());
19          }
20      }
21  }