Search in sources :

Example 1 with Barrier

use of org.rstudio.core.client.Barrier in project rstudio by rstudio.

the class Application method onReloadWithLastChanceSave.

public void onReloadWithLastChanceSave(ReloadWithLastChanceSaveEvent event) {
    Barrier barrier = new Barrier();
    barrier.addBarrierReleasedHandler(new BarrierReleasedHandler() {

        @Override
        public void onBarrierReleased(BarrierReleasedEvent event) {
            events_.fireEvent(new ReloadEvent());
        }
    });
    Token token = barrier.acquire();
    try {
        events_.fireEvent(new LastChanceSaveEvent(barrier));
    } finally {
        token.release();
    }
}
Also used : BarrierReleasedEvent(org.rstudio.core.client.events.BarrierReleasedEvent) BarrierReleasedHandler(org.rstudio.core.client.events.BarrierReleasedHandler) Barrier(org.rstudio.core.client.Barrier) Token(org.rstudio.core.client.Barrier.Token) LastChanceSaveEvent(org.rstudio.studio.client.workbench.events.LastChanceSaveEvent)

Aggregations

Barrier (org.rstudio.core.client.Barrier)1 Token (org.rstudio.core.client.Barrier.Token)1 BarrierReleasedEvent (org.rstudio.core.client.events.BarrierReleasedEvent)1 BarrierReleasedHandler (org.rstudio.core.client.events.BarrierReleasedHandler)1 LastChanceSaveEvent (org.rstudio.studio.client.workbench.events.LastChanceSaveEvent)1