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);
}
});
}
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);
}
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);
}
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);
}
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);
}
Aggregations