Package org.rstudio.core.client

Examples of org.rstudio.core.client.Barrier


      return handlerManager_.addHandler(SlideIndexChangedEvent.TYPE, handler);
   }
  
   private void reloadWorkbench()
   {
      Barrier barrier = new Barrier();
      barrier.addBarrierReleasedHandler(new BarrierReleasedHandler() {

         @Override
         public void onBarrierReleased(BarrierReleasedEvent event)
         {
            eventBus_.fireEvent(new ReloadEvent());
         }
      });
     
      Token token = barrier.acquire();
      try
      {
         eventBus_.fireEvent(new LastChanceSaveEvent(barrier));
      }
      finally
View Full Code Here


                                                               250,
                                                               msg);

         // Use a barrier and LastChanceSaveEvent to allow source documents
         // and client state to be synchronized before quitting.
         Barrier barrier = new Barrier();
         barrier.addBarrierReleasedHandler(new BarrierReleasedHandler()
         {
            public void onBarrierReleased(BarrierReleasedEvent event)
            {
               // All last chance save operations have completed (or possibly
               // failed). Now do the real quit.

               // notify the desktop frame that we are about to quit
               if (Desktop.isDesktop())
               {
                  Desktop.getFrame().setPendingQuit(switchToProject_ != null ?
                           DesktopFrame.PENDING_QUIT_RESTART_AND_RELOAD :
                           DesktopFrame.PENDING_QUIT_AND_EXIT);  
               }
              
               server_.quitSession(
                  saveChanges_,
                  switchToProject_,
                  new ServerRequestCallback<Boolean>()
                  {
                     @Override
                     public void onResponseReceived(Boolean response)
                     {
                        if (response)
                        {
                           // clear progress only if we aren't switching projects
                           // (otherwise we want to leave progress up until
                           // the app reloads)
                           if (switchToProject_ == null)
                              progress.dismiss();
                          
                           // fire onQuitAcknowledged
                           if (onQuitAcknowledged_ != null)
                              onQuitAcknowledged_.execute();
                        }
                        else
                        {
                           onFailedToQuit();
                        }
                     }

                     @Override
                     public void onError(ServerError error)
                     {
                        onFailedToQuit();
                     }
                    
                     private void onFailedToQuit()
                     {
                        progress.dismiss();

                        if (Desktop.isDesktop())
                        {
                           Desktop.getFrame().setPendingQuit(
                                         DesktopFrame.PENDING_QUIT_NONE);
                        }
                     }
                  });
            }
         });

         // We acquire a token to make sure that the barrier doesn't fire before
         // all the LastChanceSaveEvent listeners get a chance to acquire their
         // own tokens.
         Token token = barrier.acquire();
         try
         {
            eventBus_.fireEvent(new LastChanceSaveEvent(barrier));
         }
         finally
View Full Code Here

   private void reloadApplication(final String switchToProject)
   {
      // use a last chance save barrier since we typically call this very
      // early in the lifetime of the application before client/server
      // sync has occurred
      Barrier barrier = new Barrier();
      barrier.addBarrierReleasedHandler(new BarrierReleasedHandler() {
         @Override
         public void onBarrierReleased(BarrierReleasedEvent event)
         {
            if (switchToProject.length() > 0)
               pApplicationQuit_.get().forceSwitchProject(switchToProject);
            else
               reloadWindowWithDelay(true);
         }
      });
     
      Token token = barrier.acquire();
      try
      {
         events_.fireEvent(new LastChanceSaveEvent(barrier));
      }
      finally
View Full Code Here

TOP

Related Classes of org.rstudio.core.client.Barrier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.