use of org.rstudio.studio.client.common.filetypes.events.OpenPresentationSourceFileEvent in project rstudio by rstudio.
the class PresentationDispatcher method performSourceCommand.
private void performSourceCommand(String param1, String param2) {
if (param1 != null) {
// get filename and type
FileSystemItem file = FileSystemItem.createFile(getPresentationPath(param1));
TextFileType fileType = fileTypeRegistry_.getTextTypeForFile(file);
// check for a file position and/or pattern
FilePosition pos = null;
String pattern = null;
if (param2 != null) {
if (param2.length() > 2 && param2.startsWith("/") && param2.endsWith("/")) {
pattern = param2.substring(1, param2.length() - 1);
} else {
int line = StringUtil.parseInt(param2, 0);
if (line > 0)
pos = FilePosition.create(line, 1);
}
}
// dispatch
fireOpenSourceFileEvent(new OpenPresentationSourceFileEvent(file, fileType, pos, pattern));
}
}
Aggregations