Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Dialogs for generating custom constructor code
Dialogs for generating custom constructor code [message #616997] Wed, 19 March 2008 20:06
BrandonR is currently offline BrandonRFriend
Messages: 4
Registered: July 2009
Junior Member
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.

[1] Preventing the generation of default constructor
http://dev.eclipse.org/newslists/news.eclipse.tools.ve/msg06 550.html

--
Thanks,
Brandon Rockhold
Previous Topic:Dialogs for generating custom constructor code
Next Topic:graphical SWT development
Goto Forum:
  


Current Time: Fri Nov 28 07:16:23 GMT 2014

Powered by FUDForum. Page generated in 0.13639 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software