Search in sources :

Example 1 with ProgressOperation

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

the class RSConnect method onRSConnectDeployInitiated.

@Override
public void onRSConnectDeployInitiated(final RSConnectDeployInitiatedEvent event) {
    // shortcut: when deploying static content we don't need to do any linting
    if (event.getSettings().getAsStatic()) {
        doDeployment(event);
        return;
    }
    // get lint results for the file or directory being deployed, as 
    // appropriate
    server_.getLintResults(event.getSource().getDeployKey(), new ServerRequestCallback<RSConnectLintResults>() {

        @Override
        public void onResponseReceived(RSConnectLintResults results) {
            if (results.getErrorMessage().length() > 0) {
                display_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Lint Failed", "The content you tried to publish could not be checked " + "for errors. Do you want to proceed? \n\n" + results.getErrorMessage(), false, new ProgressOperation() {

                    @Override
                    public void execute(ProgressIndicator indicator) {
                        // "Publish Anyway"
                        doDeployment(event);
                        indicator.onCompleted();
                    }
                }, new ProgressOperation() {

                    @Override
                    public void execute(ProgressIndicator indicator) {
                        // "Cancel"
                        indicator.onCompleted();
                    }
                }, "Publish Anyway", "Cancel", false);
            } else if (results.hasLint()) {
                display_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Publish Content Issues Found", "Some issues were found in your content, which may " + "prevent it from working correctly after publishing. " + "Do you want to review these issues or publish anyway? ", false, new ProgressOperation() {

                    @Override
                    public void execute(ProgressIndicator indicator) {
                        // "Review Issues" -- we automatically show the
                        // markers so they're already behind the dialog.
                        indicator.onCompleted();
                    }
                }, new ProgressOperation() {

                    @Override
                    public void execute(ProgressIndicator indicator) {
                        // "Publish Anyway"
                        doDeployment(event);
                        indicator.onCompleted();
                    }
                }, "Review Issues", "Publish Anyway", true);
            } else {
                // no lint and no errors -- good to go for deployment
                doDeployment(event);
            }
        }

        @Override
        public void onError(ServerError error) {
            // we failed to lint, which is not encouraging, but we don't want to
            // fail the whole deployment lest a balky linter prevent people from
            // getting their work published, so forge on ahead.
            doDeployment(event);
        }
    });
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) ServerError(org.rstudio.studio.client.server.ServerError) RSConnectLintResults(org.rstudio.studio.client.rsconnect.model.RSConnectLintResults)

Example 2 with ProgressOperation

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

the class Plots method onClearPlots.

void onClearPlots() {
    // clear plots gesture indicates we are done with locator
    safeClearLocator();
    // confirm
    globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Clear Plots", "Are you sure you want to clear all of the plots in the history?", new ProgressOperation() {

        public void execute(final ProgressIndicator indicator) {
            indicator.onProgress("Clearing plots...");
            server_.clearPlots(new VoidServerRequestCallback(indicator));
        }
    }, true);
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback)

Example 3 with ProgressOperation

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

the class History method onHistoryRemoveEntries.

@Handler
void onHistoryRemoveEntries() {
    // get selected indexes (bail if there is no selection)
    final ArrayList<Integer> selectedRowIndexes = view_.getRecentCommandsSelectedRowIndexes();
    if (selectedRowIndexes.size() < 1) {
        globalDisplay_.showErrorMessage("Error", "No history entries currently selected.");
        return;
    }
    // bring view to front
    view_.bringToFront();
    globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Remove Entries", "Are you sure you want to remove the selected entries from " + "the history?", new ProgressOperation() {

        public void execute(final ProgressIndicator indicator) {
            indicator.onProgress("Removing items...");
            // for each selected row index we need to calculate
            // the offset from the bottom
            int rowCount = view_.getRecentCommandsRowsDisplayed();
            JsArrayNumber bottomIndexes = (JsArrayNumber) JsArrayNumber.createArray();
            for (int i = 0; i < selectedRowIndexes.size(); i++) bottomIndexes.push(rowCount - selectedRowIndexes.get(i) - 1);
            server_.removeHistoryItems(bottomIndexes, new VoidServerRequestCallback(indicator));
        }
    }, true);
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) JsArrayNumber(com.google.gwt.core.client.JsArrayNumber) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ConsoleResetHistoryHandler(org.rstudio.studio.client.workbench.views.console.events.ConsoleResetHistoryHandler) SelectionCommitHandler(org.rstudio.core.client.events.SelectionCommitHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) HistoryEntriesAddedHandler(org.rstudio.studio.client.workbench.views.history.events.HistoryEntriesAddedHandler) FetchCommandsHandler(org.rstudio.studio.client.workbench.views.history.events.FetchCommandsHandler) Handler(org.rstudio.core.client.command.Handler)

Example 4 with ProgressOperation

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

the class EnvironmentPresenter method onOpenDataFile.

public void onOpenDataFile(OpenDataFileEvent event) {
    final String dataFilePath = event.getFile().getPath();
    globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Load RData", "Do you want to load the R data file \"" + dataFilePath + "\" " + "into the global environment?", new ProgressOperation() {

        public void execute(ProgressIndicator indicator) {
            consoleDispatcher_.executeCommand("load", FileSystemItem.createFile(dataFilePath));
            indicator.onCompleted();
        }
    }, true);
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 5 with ProgressOperation

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

the class History method onClearHistory.

@Handler
void onClearHistory() {
    view_.bringToFront();
    globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_WARNING, "Confirm Clear History", "Are you sure you want to clear all history entries?", new ProgressOperation() {

        public void execute(final ProgressIndicator indicator) {
            indicator.onProgress("Clearing history...");
            server_.clearHistory(new VoidServerRequestCallback(indicator));
        }
    }, true);
}
Also used : ProgressOperation(org.rstudio.core.client.widget.ProgressOperation) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) VoidServerRequestCallback(org.rstudio.studio.client.server.VoidServerRequestCallback) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ConsoleResetHistoryHandler(org.rstudio.studio.client.workbench.views.console.events.ConsoleResetHistoryHandler) SelectionCommitHandler(org.rstudio.core.client.events.SelectionCommitHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) HistoryEntriesAddedHandler(org.rstudio.studio.client.workbench.views.history.events.HistoryEntriesAddedHandler) FetchCommandsHandler(org.rstudio.studio.client.workbench.views.history.events.FetchCommandsHandler) 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