- let module M = Minidom in
- match !(rendering_window#output)#get_selection with
- None -> (rendering_window#errors : GEdit.text)#insert "\nNo selection!\n"
- | Some node ->
- let xpath =
- match M.node_get_attribute node (M.mDOMString_of_string "xref") with
- None -> assert false
- | Some xpath -> M.string_of_mDOMString xpath
- in
- try
- let annobj = get_annotated_obj ()
+ let module O = Ominidom in
+ match rendering_window#output#get_selection with
+ | Some node ->
+ begin
+ match (node#get_attribute (O.o_mDOMString_of_string "xref")) with
+ | Some xpath ->
+ let annobj = get_annotated_obj ()
+ (* next "cast" can't got rid of, but I don't know why *)
+ and annotation = (annotation_window#annotation : GEdit.text) in
+ ann := CicXPath.get_annotation annobj (xpath#get_string) ;
+ CicAnnotationHinter.create_hints annotation_window annobj (xpath#get_string) ;
+ annotation#delete_text 0 annotation#length ;
+ begin
+ match !(!ann) with
+ None ->
+ annotation#misc#set_sensitive false ;
+ annotation_window#radio_none#set_active true ;
+ radio_some_status := false
+ | Some ann' ->
+ annotation#insert ann' ;
+ annotation#misc#set_sensitive true ;
+ annotation_window#radio_some#set_active true ;
+ radio_some_status := true
+ end ;
+ GMain.Grab.add (annotation_window#window_to_annotate#coerce) ;
+ annotation_window#show () ;
+ | None ->