use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class Workbench method onVersionControlShowRsaKey.
@Handler
public void onVersionControlShowRsaKey() {
final ProgressIndicator indicator = new GlobalProgressDelayer(globalDisplay_, 500, "Reading RSA public key...").getIndicator();
// compute path to public key
String sshDir = session_.getSessionInfo().getDefaultSSHKeyDir();
final String keyPath = FileSystemItem.createDir(sshDir).completePath("id_rsa.pub");
// read it
server_.gitSshPublicKey(keyPath, new ServerRequestCallback<String>() {
@Override
public void onResponseReceived(String publicKeyContents) {
indicator.onCompleted();
new ShowPublicKeyDialog("RSA Public Key", publicKeyContents).showModal();
}
@Override
public void onError(ServerError error) {
String msg = "Error attempting to read key '" + keyPath + "' (" + error.getUserMessage() + ")";
indicator.onError(msg);
}
});
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class TextEditingTarget method onExecuteToCurrentLine.
@Handler
void onExecuteToCurrentLine() {
docDisplay_.focus();
int row = docDisplay_.getSelectionEnd().getRow();
int col = docDisplay_.getLength(row);
codeExecution_.executeRange(Range.fromPoints(Position.create(0, 0), Position.create(row, col)));
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class ViewerPresenter method onViewerSaveAsWebPage.
@Handler
public void onViewerSaveAsWebPage() {
display_.bringToFront();
if (saveAsWebPageDefaultPath_ == null)
saveAsWebPageDefaultPath_ = workbenchContext_.getCurrentWorkingDir();
dependencyManager_.withRMarkdown("Saving standalone web pages", new Command() {
@Override
public void execute() {
fileDialogs_.saveFile("Save As Web Page", fileSystemContext_, saveAsWebPageDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
if (targetFile == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving as web page...");
server_.viewerSaveAsWebPage(targetFile.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
saveAsWebPageDefaultPath_ = targetFile.getParentPath();
}
});
}
});
}
});
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class Projects method onShowDiagnosticsProject.
@Handler
public void onShowDiagnosticsProject() {
final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Lint");
indicator.onProgress("Analyzing project sources...");
projServer_.analyzeProject(new ServerRequestCallback<Void>() {
@Override
public void onResponseReceived(Void response) {
indicator.onCompleted();
}
@Override
public void onError(ServerError error) {
Debug.logError(error);
indicator.onCompleted();
}
});
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class HTMLPreviewPresenter method onSaveHtmlPreviewAsLocalFile.
@Handler
public void onSaveHtmlPreviewAsLocalFile() {
if (lastSuccessfulPreview_ != null) {
final FileSystemItem htmlFile = FileSystemItem.createFile(lastSuccessfulPreview_.getHtmlFile());
pFileExport_.get().export("Download to Local File", "web page", htmlFile);
}
}
Aggregations