Search in sources :

Example 6 with ProgressOperation

use of org.rstudio.core.client.widget.ProgressOperation in project rstudio by rstudio.

the class Plots method onRemovePlot.

void onRemovePlot() {
    // delete plot gesture indicates we are done with locator
    safeClearLocator();
    // confirm
    globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Remove Plot", "Are you sure you want to remove the current plot?", new ProgressOperation() {

        public void execute(final ProgressIndicator indicator) {
            indicator.onProgress("Removing plot...");
            server_.removePlot(new VoidServerRequestCallback(indicator));
        }
    }, true);
    view_.bringToFront();
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 7 with ProgressOperation

use of org.rstudio.core.client.widget.ProgressOperation in project rstudio by rstudio.

the class Presentation method onClearPresentationCache.

@Handler
void onClearPresentationCache() {
    globalDisplay_.showYesNoMessage(MessageDialog.INFO, "Clear Knitr Cache", "Clearing the Knitr cache will discard previously cached " + "output and re-run all of the R code chunks within the " + "presentation.\n\n" + "Are you sure you want to clear the cache now?", false, new ProgressOperation() {

        @Override
        public void execute(final ProgressIndicator indicator) {
            indicator.onProgress("Clearing Knitr Cache...");
            server_.clearPresentationCache(new ServerRequestCallback<Void>() {

                @Override
                public void onResponseReceived(Void response) {
                    indicator.onCompleted();
                    refreshPresentation();
                }

                @Override
                public void onError(ServerError error) {
                    indicator.onCompleted();
                    globalDisplay_.showErrorMessage("Error Clearing Cache", getErrorMessage(error));
                }
            });
        }
    }, new ProgressOperation() {

        @Override
        public void execute(ProgressIndicator indicator) {
            indicator.onCompleted();
        }
    }, true);
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ServerRequestCallback(org.rstudio.studio.client.server.ServerRequestCallback) Void(org.rstudio.studio.client.server.Void) Handler(org.rstudio.core.client.command.Handler)

Aggregations

ProgressIndicator (org.rstudio.core.client.widget.ProgressIndicator)7 ProgressOperation (org.rstudio.core.client.widget.ProgressOperation)7 VoidServerRequestCallback (org.rstudio.studio.client.server.VoidServerRequestCallback)5 Handler (org.rstudio.core.client.command.Handler)3 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)2 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)2 SelectionCommitHandler (org.rstudio.core.client.events.SelectionCommitHandler)2 ServerError (org.rstudio.studio.client.server.ServerError)2 ConsoleResetHistoryHandler (org.rstudio.studio.client.workbench.views.console.events.ConsoleResetHistoryHandler)2 FetchCommandsHandler (org.rstudio.studio.client.workbench.views.history.events.FetchCommandsHandler)2 HistoryEntriesAddedHandler (org.rstudio.studio.client.workbench.views.history.events.HistoryEntriesAddedHandler)2 JsArrayNumber (com.google.gwt.core.client.JsArrayNumber)1 JsArrayString (com.google.gwt.core.client.JsArrayString)1 RSConnectLintResults (org.rstudio.studio.client.rsconnect.model.RSConnectLintResults)1 ServerRequestCallback (org.rstudio.studio.client.server.ServerRequestCallback)1 Void (org.rstudio.studio.client.server.Void)1