use of org.rstudio.studio.client.workbench.views.viewer.export.SaveViewerPlotAsImageDesktopDialog in project rstudio by rstudio.
the class ViewerPresenter method onViewerSaveAsImage.
@Handler
public void onViewerSaveAsImage() {
display_.bringToFront();
final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Error");
indicator.onProgress("Preparing to export plot...");
// get the default directory
FileSystemItem defaultDir = ExportPlotUtils.getDefaultSaveDirectory(workbenchContext_.getCurrentWorkingDir());
// get context
server_.getViewerExportContext(defaultDir.getPath(), new SimpleRequestCallback<SavePlotAsImageContext>() {
@Override
public void onResponseReceived(SavePlotAsImageContext context) {
indicator.onCompleted();
new SaveViewerPlotAsImageDesktopDialog(globalDisplay_, display_.getUrl(), context, ExportPlotOptions.adaptToSize(pUIPrefs_.get().exportViewerOptions().getValue(), display_.getViewerFrameSize()), saveExportOptionsOperation_).showModal();
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
Aggregations