code structure

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

code structure

Postby tibs » Wed Mar 31, 2004 7:08 pm

hi:
I've been playing around with SWT and would like to know if is there any
way to structure the code a bit better. I want to add methods with parameters. I don't want to repeat the same block twice if the difference is only in the showed content and in the font style for example.
The generated code grows to a size where it becomes really hard to handle.
How can I break it into parts that Designer can identify?
I haven't found any documentation about these aspects..
Thanks
Tibor
tibs
 
Posts: 2
Joined: Wed Mar 31, 2004 6:58 pm

Re: code structure

Postby Eric Clayberg » Wed Mar 31, 2004 9:01 pm

tibs wrote:I've been playing around with SWT and would like to know if is there any way to structure the code a bit better. I want to add methods with parameters. I don't want to repeat the same block twice if the difference is only in the showed content and in the font style for example. The generated code grows to a size where it becomes really hard to handle. How can I break it into parts that Designer can identify?

You can refactor the code in a variety of ways and Designer will still be able to edit it. Give it a try and see what happens. For example, you can spilt the generated code into pieces. As long as there is some identifiable top-down tree structure, Designer should be able to interpret it. If you spilt the code into multiple methods, make sure that each of those methods is only called once. Using the same code to generate multiple widgets is not supported (too much ambiguity, if you then wanted to change a widget property). For SWT, most sub methods will need to pass in the appropriate parent (either the shell or a composite).

Designer is a true two-way tool (e.g., edit graphically or in code and the changes are reflected in the other). It can read and write almost any format and reverse-engineer most hand-written Java GUI code. It also supports free form code editing (make changes anywhere...not just in "special" areas) and most user refactorings (you can move, rename and subdivide methods without a problem).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby tibs » Wed Mar 31, 2004 11:54 pm

Oops. I forgot to mention that I've been playing with the Free version.
I think when you mentioned two way reverse engineering, you were really talking of the Professional Edition. Is that correct?
Otherwise I am in trouble.
Thanks for the fast answer.
Tibor
tibs
 
Posts: 2
Joined: Wed Mar 31, 2004 6:58 pm

Postby Eric Clayberg » Thu Apr 01, 2004 5:11 am

tibs wrote:I think when you mentioned two way reverse engineering, you were really talking of the Professional Edition. Is that correct?

No. The two-way, reverse engineering works in any version. Some widgets and layout managers are not supported in the free version, however. BT, the latest v2.0.0 beta will allow you to try the pro features for 14 days before reverting back to free mode.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest