Search in sources :

Example 6 with TextFileType

use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.

the class TextEditingTargetRenameHelper method renameInScope.

public int renameInScope() {
    init();
    TextFileType type = editor_.getFileType();
    if (type.isR() || type.isRhtml() || type.isRmd() || type.isRnw() || type.isRpres())
        return renameInScopeR();
    return 0;
}
Also used : TextFileType(org.rstudio.studio.client.common.filetypes.TextFileType)

Example 7 with TextFileType

use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.

the class DocumentOutlineWidget method shouldDisplayNode.

private boolean shouldDisplayNode(Scope node) {
    String shownSectionsPref = uiPrefs_.shownSectionsInDocumentOutline().getGlobalValue();
    if (node.isChunk() && shownSectionsPref.equals(UIPrefsAccessor.DOC_OUTLINE_SHOW_SECTIONS_ONLY))
        return false;
    if (isUnnamedNode(node) && !shownSectionsPref.equals(UIPrefsAccessor.DOC_OUTLINE_SHOW_ALL))
        return false;
    // NOTE: the 'is*' items are not mutually exclusive
    if (node.isAnon() || node.isLambda() || node.isTopLevel())
        return false;
    // Don't show namespaces in the scope tree
    if (node.isNamespace())
        return false;
    // don't show R functions or R sections in .Rmd unless requested
    TextFileType fileType = target_.getDocDisplay().getFileType();
    if (!shownSectionsPref.equals(UIPrefsAccessor.DOC_OUTLINE_SHOW_ALL) && fileType.isRmd()) {
        if (node.isFunction())
            return false;
        if (node.isSection() && !node.isMarkdownHeader())
            return false;
    }
    // TODO: Annotate scope tree in such a way that this isn't necessary
    if (node.getLabel() != null && node.getLabel().startsWith("<function>"))
        return false;
    return node.isChunk() || node.isClass() || node.isFunction() || node.isNamespace() || node.isSection();
}
Also used : TextFileType(org.rstudio.studio.client.common.filetypes.TextFileType)

Example 8 with TextFileType

use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.

the class TextEditingTargetIdleMonitor method refreshCommands.

private void refreshCommands() {
    commands_.clear();
    timer_.cancel();
    // attach commands based on file type
    TextFileType fileType = display_.getFileType();
    if (fileType == null)
        return;
    if (fileType.isRmd()) {
        registerCommand(idleCommands_.PREVIEW_LINK);
        registerCommand(idleCommands_.PREVIEW_LATEX);
    }
}
Also used : TextFileType(org.rstudio.studio.client.common.filetypes.TextFileType)

Example 9 with TextFileType

use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.

the class AceEditorBackgroundLinkHighlighter method refreshHighlighters.

private void refreshHighlighters(String mode) {
    clearAllMarkers();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            TextFileType fileType = editor_.getFileType();
            highlighters_.clear();
            highlighters_.add(webLinkHighlighter());
            if (fileType != null && (fileType.isMarkdown() || fileType.isRmd()))
                highlighters_.add(markdownLinkHighlighter());
            nextHighlightStart_ = 0;
            timer_.schedule(700);
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) TextFileType(org.rstudio.studio.client.common.filetypes.TextFileType)

Aggregations

TextFileType (org.rstudio.studio.client.common.filetypes.TextFileType)9 FileSystemItem (org.rstudio.core.client.files.FileSystemItem)4 JsArrayString (com.google.gwt.core.client.JsArrayString)2 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)2 JsArray (com.google.gwt.core.client.JsArray)1 RepeatingCommand (com.google.gwt.core.client.Scheduler.RepeatingCommand)1 JSONString (com.google.gwt.json.client.JSONString)1 Command (com.google.gwt.user.client.Command)1 MenuItem (com.google.gwt.user.client.ui.MenuItem)1 UIObject (com.google.gwt.user.client.ui.UIObject)1 FilePosition (org.rstudio.core.client.FilePosition)1 AppCommand (org.rstudio.core.client.command.AppCommand)1 SimpleRequestCallback (org.rstudio.studio.client.common.SimpleRequestCallback)1 OpenPresentationSourceFileEvent (org.rstudio.studio.client.common.filetypes.events.OpenPresentationSourceFileEvent)1 RmdPreviewParams (org.rstudio.studio.client.rmarkdown.model.RmdPreviewParams)1 EditingTarget (org.rstudio.studio.client.workbench.views.source.editors.EditingTarget)1 CodeBrowserEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.codebrowser.CodeBrowserEditingTarget)1 DataEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.data.DataEditingTarget)1 TextEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget)1 CppCompletionOperation (org.rstudio.studio.client.workbench.views.source.editors.text.cpp.CppCompletionOperation)1