I would like to extend the Visual Editor to allow the user to select the
constructor that is used to instantiate Swing components. The process as I
am currently envisioning it is as follows: a user selects a Swing
component from the palette and then clicks on the desired container in the
graphical view; a dialog is displayed immediately after (just as the
nameincomposition dialog is by default) that presents a selection of
constructors to choose from, including appropriate text fields that allow
the user to specify the parameters for the chosen constructor; finally,
the end result is that the chosen constructor and parameters have been
used to generate the constructor code instead of the default constructor.

This extension is targeting an educational environment with students who
are new to GUI programming. It will attempt to simplify the process of
building GUI's by allowing them to do it visually. To keep the students
from developing a dependency on the Visual Editor, however, and to assist
in the understanding of the code behind the GUI programming, the extension
will attempt to expose the students to the code in certain situations
(thus the extra dialog that allows the students to view the Swing
constructors and parameters).

I've previously done some extension work with the VE (creating a classpath
container, new class wizard, and custom palette container and components)
and have been searching the newsgroup for posts concerning generating
constructor code. Several of the existing posts have died off without any
resolution (someone says something about wanting to generate custom
constructor code, another person seconds the idea, and then the post
dies), while a couple seem to result in the original poster finding a
resolution, but not necessarily documenting it well enough for someone
else to pick up on. One particular post [1] suggests that an xmi file
similar to the one used for the SWT label can be used to specify a
non-default constructor and parameters for Swing components. As this post
was created back in October 2006, I was curious as to whether anyone knows
if this is still a reasonable approach for generating non-default
constructor code. Also, given that my situation requires the constructor
to be chosen from a dialog immediately after the component is dropped onto
the graphical view, will I need a different approach to generating the
code? In particular, how can I make it so that my dialog is displayed
immediately after the nameincomposition dialog, or so that my dialog
extends this dialog and includes the necessary means for choosing a
constructor and specifying the parameters?

Thus far, everything we have been working on with the extension is a
plugin; we have had no need to modify and rebuild the VE source. Since the
extension would likely be used on the computer lab installs of Eclipse,
I'm not sure that we would even be able to get it installed if it required
a separate install of Eclipse or the Visual Editor. Given that limitation,
is a solution to this constructor problem possible? Any information that
you can provide on the subject would be greatly appreciated, even if you
just point me to old posts that I might have missed.