Пример #1
0
 protected void load() {
   if (m_session == null || ClientSessionThreadLocal.get() == m_session) {
     m_env = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
   } else {
     ClientAsyncJob job =
         new ClientAsyncJob("Load user preferences", m_session) {
           @Override
           protected void runVoid(IProgressMonitor monitor) throws Throwable {
             m_env = SERVICES.getService(IUserPreferencesStorageService.class).loadPreferences();
           }
         };
     job.schedule();
     try {
       job.join();
     } catch (InterruptedException e) {
       // nop
     }
   }
   if (m_env == null) {
     throw new IllegalStateException("Could not load preferences in client job");
   }
 }
Пример #2
0
 /**
  * @return a new instance of the {@link ClientUIPreferences} based on the {@link
  *     IUserPreferencesStorageService}
  *     <p>Warning: Only use this class within a ClientJob with an {@link IClientSession}.
  *     <p>Calling from outside a {@link IClientSession} {@link
  *     org.eclipse.scout.rt.client.ClientJob ClientJob} will produce a warning. Starting with
  *     release 3.9 it will fail with an error.
  */
 public static ClientUIPreferences getInstance() {
   return new ClientUIPreferences(ClientSessionThreadLocal.get());
 }