On Mon, 12 Jun 2000, Phillip Lord wrote:
[snip - discussion of jde-wiz-choose-imports and selection methods]
>
> Yes you are probably right about this. When I wrote this
> stuff I guess I was playing around with the widget library, and that
> is why it ended up being the way it is. Perhaps it should be changed
> so that its more sensible. User centred design ho!
>
> Unfortunately ispell does this in an ad-hoc manner, which can
> only be used for ispell, and would require the code re-writing for
> anything else. A simple radio check button would be easier, and would
> require only two clicks...
>
> (*) java.awt.List
> ( ) java.util.List
> ( ) myown.package.List
>
> I shall see if I can find time to get around to this
> sometime. Its not a big change, and I haven't written any lisp for a
> while...
>
[snip]
So, I've taken the plunge and dived head first into the deep end of elisp.
Here is the result of my first hack - a radio button style list for
the jde-wiz-find-and-import function.
A direct replacement for jde-wiz-choose-imports - ripped directly from
the jde-help-choose-document function.
This has only been tested on GNU/Emacs (I don't have XEmacs).
- Mark.
------------
(defun jde-wiz-choose-imports (new-imports)
"Prompts the user to select a class to import from a list of similarly
named candidates."
(let ((buf (get-buffer-create "*Select Import Class*" )))
(setq jde-wiz-import-window-config (current-window-configuration))
(setq jde-wiz-selected-import (car new-imports))
(set-buffer buf)
(widget-insert "Several classes match the name you specified.\n")
(widget-insert "Select the one you want to import.\n")
(widget-insert "Then click the OK button.\n" )
(let ((args (list
'radio-button-choice
:value (car new-imports)
:notify (lambda (widget &rest ignore)
(setq jde-wiz-selected-import (widget-value
widget))
(message "You selected: %s"
(widget-value widget))))))
(setq args (nconc
args
(mapcar (lambda (x) (list 'item x)) new-imports)))
(apply 'widget-create args))
(widget-insert "\n")
(widget-create 'push-button
:notify (lambda (&rest ignore)
(let ((dialog-buffer
(current-buffer)))
(delete-window)
(kill-buffer dialog-buffer)
(set-window-configuration
jde-wiz-import-window-config)
(jde-wiz-insert-imports-into-buffer (cons
jde-wiz-selected-import nil))
(message "Import complete.")))
"Ok")
(use-local-map widget-keymap)
(widget-setup)
(pop-to-buffer buf)))
-------------