use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class HTMLPreviewPresenter method onSaveHtmlPreviewAs.
@Handler
public void onSaveHtmlPreviewAs() {
if (lastSuccessfulPreview_ != null) {
FileSystemItem defaultDir = savePreviewDir_ != null ? FileSystemItem.createDir(savePreviewDir_) : FileSystemItem.home();
final FileSystemItem sourceFile = FileSystemItem.createFile(lastSuccessfulPreview_.getHtmlFile());
FileSystemItem initialFilePath = FileSystemItem.createFile(defaultDir.completePath(sourceFile.getStem()));
fileDialogs_.saveFile("Save File As", fileSystemContext_, initialFilePath, sourceFile.getExtension(), false, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(FileSystemItem targetFile, ProgressIndicator indicator) {
if (targetFile == null || sourceFile.equalTo(targetFile)) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving File...");
server_.copyFile(sourceFile, targetFile, true, new VoidServerRequestCallback(indicator));
savePreviewDir_ = targetFile.getParentPathString();
session_.persistClientState();
}
});
}
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class ProfilerEditingTarget method onGotoProfileSource.
@Handler
public void onGotoProfileSource() {
FilePosition filePosition = FilePosition.create(selectedLine_, 0);
fileTypeRegistry_.editFile(FileSystemItem.createFile(selectedPath_), filePosition);
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class Presentation method onTutorialFeedback.
@Handler
void onTutorialFeedback() {
EditDialog editDialog = new EditDialog("Provide Feedback", "Submit", "", false, true, new Size(450, 300), new ProgressOperationWithInput<String>() {
@Override
public void execute(String input, ProgressIndicator indicator) {
if (input == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving feedback...");
server_.tutorialFeedback(input, new VoidServerRequestCallback(indicator));
}
});
editDialog.showModal();
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class Presentation method onPresentationFullscreen.
@Handler
void onPresentationFullscreen() {
// clear the internal iframe so there is no conflict over handling
// presentation events (we'll restore it on zoom close)
view_.clear();
// show the zoomed version of the presentation. after it closes
// restore the inline version
view_.zoom(session_.getSessionInfo().getPresentationName(), buildPresentationUrl("zoom"), new Command() {
@Override
public void execute() {
view_.load(buildPresentationUrl(), currentState_.getFilePath());
}
});
}
use of org.rstudio.core.client.command.Handler in project rstudio by rstudio.
the class Presentation method onPresentationSaveAsStandalone.
@Handler
void onPresentationSaveAsStandalone() {
// determine the default file name
if (saveAsStandaloneDefaultPath_ == null) {
FileSystemItem presFilePath = FileSystemItem.createFile(currentState_.getFilePath());
saveAsStandaloneDefaultPath_ = FileSystemItem.createFile(presFilePath.getParentPath().completePath(presFilePath.getStem() + ".html"));
}
fileDialogs_.saveFile("Save Presentation As", fileSystemContext_, saveAsStandaloneDefaultPath_, ".html", false, new ProgressOperationWithInput<FileSystemItem>() {
@Override
public void execute(final FileSystemItem targetFile, ProgressIndicator indicator) {
if (targetFile == null) {
indicator.onCompleted();
return;
}
indicator.onProgress("Saving Presentation...");
server_.createStandalonePresentation(targetFile.getPath(), new VoidServerRequestCallback(indicator) {
@Override
public void onSuccess() {
saveAsStandaloneDefaultPath_ = targetFile;
}
});
}
});
}
Aggregations