Code generation

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 generation

Postby eismeraldo » Mon Nov 16, 2009 11:08 am

We use checkstyle to control some naming conventions. For example parameter with the prefix p, variable names as camel case without underscore. Have we a possibility to influence the templates for the code generation?

Thank you
eismeraldo
 
Posts: 2
Joined: Mon Nov 16, 2009 9:49 am

Re: Code generation

Postby Eric Clayberg » Mon Nov 16, 2009 11:20 am

eismeraldo wrote:Have we a possibility to influence the templates for the code generation?

Yes. See the WindowBuilder > SWT > Code Generation > Variables preferences.

Image Image
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: Code generation

Postby eismeraldo » Mon Nov 16, 2009 12:56 pm

Thank you for the answer
But the generated code looks like:
FormData formData_1 = new FormData();
In the preferences I could not see, what I have to do, so the generated code looks like:
FormData formData1 = new FormData();
and for a Composite class
public BlaBlaComposite(Composite parent, int style) {
instead of
public BlaBlaComposite(Composite pParent, int pStyle) {
eismeraldo
 
Posts: 2
Joined: Mon Nov 16, 2009 9:49 am

Re: Code generation

Postby Eric Clayberg » Tue Nov 24, 2009 3:20 pm

eismeraldo wrote:But the generated code looks like:
FormData formData_1 = new FormData();
In the preferences I could not see, what I have to do, so the generated code looks like:
FormData formData1 = new FormData();

The latest build adds a new preference to control the style of the generated layoutData variable names...

Image

You want the "${dataAcronym}${controlName-cap}" option.

eismeraldo wrote:and for a Composite class
public BlaBlaComposite(Composite parent, int style) {
instead of
public BlaBlaComposite(Composite pParent, int pStyle) {

The constructor is part of a fixed template that can't be changed. You would need to change that in the source.
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