use of org.rstudio.studio.client.workbench.views.source.editors.text.ace.Selection in project rstudio by rstudio.
the class DesktopApplicationHeader method isSelectionEmpty.
public static boolean isSelectionEmpty() {
Element activeElement = DomUtils.getActiveElement();
AceEditorNative editor = AceEditorNative.getEditor(activeElement);
if (editor != null) {
Selection selection = editor.getSession().getSelection();
return selection.isEmpty();
}
// has focus)
return false;
}
use of org.rstudio.studio.client.workbench.views.source.editors.text.ace.Selection in project rstudio by rstudio.
the class Source method getEditorContext.
private void getEditorContext(String id, String path, DocDisplay docDisplay) {
AceEditor editor = (AceEditor) docDisplay;
Selection selection = editor.getNativeSelection();
Range[] ranges = selection.getAllRanges();
JsArray<DocumentSelection> docSelections = JavaScriptObject.createArray().cast();
for (int i = 0; i < ranges.length; i++) {
docSelections.push(DocumentSelection.create(ranges[i], editor.getTextForRange(ranges[i])));
}
id = StringUtil.notNull(id);
path = StringUtil.notNull(path);
GetEditorContextEvent.SelectionData data = GetEditorContextEvent.SelectionData.create(id, path, editor.getCode(), docSelections);
server_.getEditorContextCompleted(data, new VoidServerRequestCallback());
}
Aggregations