General question on SWT Designer architecture requirements.

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

General question on SWT Designer architecture requirements.

Postby tquinn » Wed Nov 25, 2009 7:18 pm

I like SWT Designer a lot for getting something up and going quickly. What I am struggling with is that I end up with huge classes that are difficult to tweak and maintain. Is it possible to extract some of these things out into separate classes that would hopefully be more manageable?

For instance, I downloaded some example code from http://www.eclipse.org/swt/examples.php

When I bring up the ControlExample, SWTD recognizes that it is a GUI class, but the designer view shows an empty window, as opposed to what the application looks like when run. My coding style preference would tend to be similar.

Are there some guidelines on how one can modify the code that SWTD generates and maintain the design view?

Thanks in advance.
tquinn
 
Posts: 3
Joined: Wed Nov 25, 2009 6:02 pm

Re: General question on SWT Designer architecture requirements.

Postby Eric Clayberg » Wed Nov 25, 2009 8:56 pm

tquinn wrote:What I am struggling with is that I end up with huge classes that are difficult to tweak and maintain

Why?

tquinn wrote:Is it possible to extract some of these things out into separate classes that would hopefully be more manageable?

Sure. The ideal approach would be to build your UI up out of Composites each representing a discreet piece of functionality. Each Composite is defined in its own class.

tquinn wrote:When I bring up the ControlExample, SWTD recognizes that it is a GUI class, but the designer view shows an empty window

All of its content is added dynamically at runtime. While that code can show you how to use specific controls, I think it is a horrible example of how to build an SWT app.

tquinn wrote:Are there some guidelines on how one can modify the code that SWTD generates and maintain the design view?

You can typically refactor the generated code any way that you like with few restrictions. You can split the generated code into smaller methods, use Composites, use Factories, etc.
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

Re: General question on SWT Designer architecture requirements.

Postby tquinn » Fri Nov 27, 2009 10:14 pm

Thanks Eric, that was a huge help.

As a follow up question, if I build my skeleton application as a SWT application, how should I structure it so that I can later turn it into a RCP application should I decide to do so? I am getting your book; is it covered in there? Do you have a suggestion of what I should read? Do you know of a "best practices" for SWT?

I am not a very experienced coder, and the experience I do have is not in GUI development; I would prefer to keep it that way :) This is just code I use myself, and would like to keep it flexible as it evolves.
tquinn
 
Posts: 3
Joined: Wed Nov 25, 2009 6:02 pm

Re: General question on SWT Designer architecture requirements.

Postby Eric Clayberg » Sat Nov 28, 2009 8:42 am

tquinn wrote:As a follow up question, if I build my skeleton application as a SWT application, how should I structure it so that I can later turn it into a RCP application should I decide to do so?

SWT is just a subset of RCP, so your SWT app is already an RCP app. This would be a good question for the Eclipse RCP newsgroup.

tquinn wrote:is it covered in there?

Our book does cover SWT, but it is primarily focused on Eclipse plugin development. Most of the material can also be useful for building RCP apps although that is not the focus.

tquinn wrote:Do you have a suggestion of what I should read?

If you are interested in building an RCP app, I would recommend the McAffer Eclipse RCP book.

tquinn wrote:Do you know of a "best practices" for SWT?

A number of books have been written on SWT that cover SWT best practices. The Eclipse SWT newsgroup is also a good place to visit
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: Google [Bot] and 2 guests