use of org.rstudio.studio.client.workbench.views.console.events.SendToConsoleEvent in project rstudio by rstudio.
the class TextEditingTarget method onClearPrerenderedOutput.
@Handler
void onClearPrerenderedOutput() {
withSavedDoc(new Command() {
@Override
public void execute() {
// determine the output path (use relative path if possible)
String path = docUpdateSentinel_.getPath();
String relativePath = FileSystemItem.createFile(path).getPathRelativeTo(workbenchContext_.getCurrentWorkingDir());
if (relativePath != null)
path = relativePath;
final String docPath = path;
globalDisplay_.showYesNoMessage(MessageDialog.QUESTION, "Clear Prerendered Output", "This will remove all previously generated output " + "for " + docPath + " (html, prerendered data, knitr cache, etc.)." + "\n\nAre you sure you want to clear the output now?", false, new Operation() {
@Override
public void execute() {
String code = "rmarkdown::shiny_prerendered_clean(" + ConsoleDispatcher.escapedPath(docPath) + ")";
events_.fireEvent(new SendToConsoleEvent(code, true));
}
}, null, true);
}
});
}
use of org.rstudio.studio.client.workbench.views.console.events.SendToConsoleEvent in project rstudio by rstudio.
the class TextEditingTarget method onClearKnitrCache.
@Handler
void onClearKnitrCache() {
withSavedDoc(new Command() {
@Override
public void execute() {
// determine the cache path (use relative path if possible)
String path = docUpdateSentinel_.getPath();
FileSystemItem fsi = FileSystemItem.createFile(path);
path = fsi.getParentPath().completePath(fsi.getStem() + "_cache");
String relativePath = FileSystemItem.createFile(path).getPathRelativeTo(workbenchContext_.getCurrentWorkingDir());
if (relativePath != null)
path = relativePath;
final String docPath = path;
globalDisplay_.showYesNoMessage(MessageDialog.QUESTION, "Clear Knitr Cache", "Clearing the Knitr cache will delete the cache " + "directory for " + docPath + ". " + "\n\nAre you sure you want to clear the cache now?", false, new Operation() {
@Override
public void execute() {
String code = "unlink(" + ConsoleDispatcher.escapedPath(docPath) + ", recursive = TRUE)";
events_.fireEvent(new SendToConsoleEvent(code, true));
}
}, null, true);
}
});
}
Aggregations