Search in sources :

Example 1 with OpenPresentationSourceFileEvent

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));
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) TextFileType(org.rstudio.studio.client.common.filetypes.TextFileType) FilePosition(org.rstudio.core.client.FilePosition) OpenPresentationSourceFileEvent(org.rstudio.studio.client.common.filetypes.events.OpenPresentationSourceFileEvent)

Aggregations

FilePosition (org.rstudio.core.client.FilePosition)1 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)1 TextFileType (org.rstudio.studio.client.common.filetypes.TextFileType)1 OpenPresentationSourceFileEvent (org.rstudio.studio.client.common.filetypes.events.OpenPresentationSourceFileEvent)1