use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class ConnectionsPresenter method onViewConnectionDataset.
@Override
public void onViewConnectionDataset(ViewConnectionDatasetEvent event) {
if (exploredConnection_ == null)
return;
GlobalProgressDelayer progress = new GlobalProgressDelayer(globalDisplay_, 100, "Previewing table...");
server_.connectionPreviewTable(exploredConnection_.getId(), event.getDataset(), new VoidServerRequestCallback(progress.getIndicator()));
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class Packages method onInstallPackage.
void onInstallPackage() {
withPackageInstallContext(new OperationWithInput<PackageInstallContext>() {
@Override
public void execute(final PackageInstallContext installContext) {
if (installContext.isDefaultLibraryWriteable()) {
continueInstallPackage(installContext);
} else {
globalDisplay_.showYesNoMessage(MessageDialog.QUESTION, "Create Package Library", "Would you like to create a personal library '" + installContext.getDefaultUserLibraryPath() + "' " + "to install packages into?", false, new // Yes operation
Operation() {
@Override
public void execute() {
ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Error Creating Library");
server_.initDefaultUserLibrary(new VoidServerRequestCallback(indicator) {
@Override
protected void onSuccess() {
// call this function back recursively
// so we can retrieve the updated
// PackageInstallContext from the server
onInstallPackage();
}
});
}
}, new // No operation
Operation() {
@Override
public void execute() {
globalDisplay_.showMessage(MessageDialog.WARNING, "Install Packages", "Unable to install packages (default library '" + installContext.getDefaultLibraryPath() + "' is " + "not writeable)");
}
}, true);
}
}
});
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class FilesCopy method copyNextFile.
private void copyNextFile(final ArrayList<FileSystemItem> filesQueue, final FileSystemItem targetDirectory, final Command completedCommand) {
// terminate if there are no files left
if (filesQueue.size() == 0) {
if (completedCommand != null)
completedCommand.execute();
return;
}
// remove the first file from the list
final FileSystemItem sourceFile = filesQueue.remove(0);
// determine the default name and default selection
final String COPY_PREFIX = "CopyOf";
String defaultName = COPY_PREFIX + sourceFile.getName();
int defaultSelectionLength = COPY_PREFIX.length() + sourceFile.getStem().length();
// show prompt for new filename
final String objectName = sourceFile.isDirectory() ? "Folder" : "File";
globalDisplay_.promptForText("Copy " + objectName, "Enter a name for the copy of '" + sourceFile.getName() + "':", defaultName, 0, defaultSelectionLength, null, new ProgressOperationWithInput<String>() {
public void execute(String input, ProgressIndicator progress) {
progress.onProgress("Copying " + objectName.toLowerCase() + "...");
String targetFilePath = targetDirectory.completePath(input);
final FileSystemItem targetFile = FileSystemItem.createFile(targetFilePath);
server_.copyFile(sourceFile, targetFile, false, new VoidServerRequestCallback(progress) {
@Override
protected void onSuccess() {
// copy the next file in the queue
copyNextFile(filesQueue, targetDirectory, completedCommand);
}
});
}
});
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback 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);
}
use of org.rstudio.studio.client.server.VoidServerRequestCallback in project rstudio by rstudio.
the class CompilePdfOutputPresenter method confirmClose.
public void confirmClose(Command onConfirmed) {
// wrap the onConfirmed in another command which notifies the server
// that we've closed the tab
final Command confirmedCommand = CommandUtil.join(onConfirmed, new Command() {
@Override
public void execute() {
server_.compilePdfClosed(new VoidServerRequestCallback());
}
});
server_.isCompilePdfRunning(new DelayedProgressRequestCallback<Boolean>("Closing Compile PDF...") {
@Override
public void onSuccess(Boolean isRunning) {
if (isRunning) {
confirmTerminateRunningCompile("close the Compile PDF tab", confirmedCommand);
} else {
confirmedCommand.execute();
}
}
});
}
Aggregations