List of usage examples for com.google.gwt.dom.client Range selectNodeContents
public final native void selectNodeContents(Node referenceNode) ;
From source file:org.rstudio.core.client.dom.impl.DomUtilsStandardImpl.java
License:Open Source License
public void focus(Element element, boolean alwaysDriveSelection) { ElementEx el = (ElementEx) element;//ww w . ja v a 2 s .c o m el.focus(); if (alwaysDriveSelection || (el.getContentEditable() && (el.getInnerText() == null || el.getInnerText() == ""))) { Document doc = el.getOwnerDocument(); Range range = Range.create(doc); range.selectNodeContents(el); Selection sel = Selection.get(NativeWindow.get(doc)); sel.setRange(range); } NativeWindow.get().focus(); }