* Helper for insert links while editing a document
*
* @param editor the wave editor
*/
public static void onCreateLink(EditorContext editor) {
FocusedRange range = editor.getSelectionHelper().getSelectionRange();
if (range == null || range.isCollapsed()) {
Window.alert("Select some text to create a link.");
return;
}
try {
// We try to create a link with the current selection, if fails, we ask
// for a link
Range rg = range.asRange();
String text = DocHelper.getText(editor.getDocument(), rg.getStart(), rg.getEnd());
String linkAnnotationValue = Link.normalizeLink(text);
EditorAnnotationUtil.setAnnotationOverSelection(editor, Link.KEY, linkAnnotationValue);
} catch (InvalidLinkException e) {
String rawLinkValue =