Search in sources :

Example 1 with FindInFilesEvent

use of org.rstudio.studio.client.workbench.views.output.find.events.FindInFilesEvent in project rstudio by rstudio.

the class Source method onFindInFiles.

@Handler
public void onFindInFiles() {
    String searchPattern = "";
    if (activeEditor_ != null && activeEditor_ instanceof TextEditingTarget) {
        TextEditingTarget textEditor = (TextEditingTarget) activeEditor_;
        String selection = textEditor.getSelectedText();
        boolean multiLineSelection = selection.indexOf('\n') != -1;
        if ((selection.length() != 0) && !multiLineSelection)
            searchPattern = selection;
    }
    events_.fireEvent(new FindInFilesEvent(searchPattern));
}
Also used : FindInFilesEvent(org.rstudio.studio.client.workbench.views.output.find.events.FindInFilesEvent) TextEditingTarget(org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget) JSONString(com.google.gwt.json.client.JSONString) JsArrayString(com.google.gwt.core.client.JsArrayString) NativePreviewHandler(com.google.gwt.user.client.Event.NativePreviewHandler) FileTypeChangedHandler(org.rstudio.studio.client.workbench.views.source.editors.text.events.FileTypeChangedHandler) Handler(org.rstudio.core.client.command.Handler) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) SelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler) CloseHandler(com.google.gwt.event.logical.shared.CloseHandler) ViewDataHandler(org.rstudio.studio.client.workbench.views.data.events.ViewDataHandler) SourceOnSaveChangedHandler(org.rstudio.studio.client.workbench.views.source.editors.text.events.SourceOnSaveChangedHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) OpenSourceFileHandler(org.rstudio.studio.client.common.filetypes.events.OpenSourceFileHandler)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 CloseHandler (com.google.gwt.event.logical.shared.CloseHandler)1 SelectionHandler (com.google.gwt.event.logical.shared.SelectionHandler)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 JSONString (com.google.gwt.json.client.JSONString)1 NativePreviewHandler (com.google.gwt.user.client.Event.NativePreviewHandler)1 Handler (org.rstudio.core.client.command.Handler)1 OpenSourceFileHandler (org.rstudio.studio.client.common.filetypes.events.OpenSourceFileHandler)1 ViewDataHandler (org.rstudio.studio.client.workbench.views.data.events.ViewDataHandler)1 FindInFilesEvent (org.rstudio.studio.client.workbench.views.output.find.events.FindInFilesEvent)1 TextEditingTarget (org.rstudio.studio.client.workbench.views.source.editors.text.TextEditingTarget)1 FileTypeChangedHandler (org.rstudio.studio.client.workbench.views.source.editors.text.events.FileTypeChangedHandler)1 SourceOnSaveChangedHandler (org.rstudio.studio.client.workbench.views.source.editors.text.events.SourceOnSaveChangedHandler)1