Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Preventing the generation of default constructor
Preventing the generation of default constructor [message #131833] Thu, 05 October 2006 13:34 Go to next message
Eclipse UserFriend
Originally posted by: nsat28.yahoo.com

Hi,

How to prevent the default constructor from getting generated, when
"Constructors from superclass"
is checked in the new visual class wizard.

This is for my custom widget written using swing.
Since this is already done for SWT widgets, how to achieve the same in
Swing.

Thanks,
Anand
Re: Preventing the generation of default constructor [message #131851 is a reply to message #131833] Thu, 05 October 2006 15:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

This is a function of JDT, not of the VE. The reason it is not done for
SWT widgets is because SWT widgets do not have a default ctor. Since
they don't have one, then one is not generated for the subclass. The
algorithm is simply duplicate any constructor the super class has.

Anand wrote:
> Hi,
>
> How to prevent the default constructor from getting generated, when
> "Constructors from superclass"
> is checked in the new visual class wizard.
>
> This is for my custom widget written using swing.
> Since this is already done for SWT widgets, how to achieve the same in
> Swing.
>
> Thanks,
> Anand
>

--
Thanks,
Rich Kulp
Re: Preventing the generation of default constructor [message #131899 is a reply to message #131851] Fri, 06 October 2006 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nsat28.yahoo.com

Hi Rich,

By removing the default constructor I started getting
NoSuchMethodException.
When I checked the code for SWT widgets found that,
actually SWT widgets does have a default constructor but without any
access specifiers.
Doing the same to my CustomWidget works, but gave rise to a new problem.
VE executes the code present only in the default constructor and not the
one that is custom generated using JET template.
Is there any workaround for this.

Thanks,
Anand


Rich Kulp wrote:

> This is a function of JDT, not of the VE. The reason it is not done for
> SWT widgets is because SWT widgets do not have a default ctor. Since
> they don't have one, then one is not generated for the subclass. The
> algorithm is simply duplicate any constructor the super class has.

> Anand wrote:
>> Hi,
>>
>> How to prevent the default constructor from getting generated, when
>> "Constructors from superclass"
>> is checked in the new visual class wizard.
>>
>> This is for my custom widget written using swing.
>> Since this is already done for SWT widgets, how to achieve the same in
>> Swing.
>>
>> Thanks,
>> Anand
>>
Re: Preventing the generation of default constructor [message #131950 is a reply to message #131899] Fri, 06 October 2006 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I don't know. We actually don't "execute" code from the constructor. We
look for the "initialize()" method and other methods.

--
Thanks,
Rich Kulp
Re: Preventing the generation of default constructor [message #132150 is a reply to message #131950] Wed, 11 October 2006 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nsat28.yahoo.com

Hi Rich,

I managed to make VE use the constructor with arguments.
This was done by providing a seperate xmi file to my widget similar to the
xmi file used for SWT label.

Now I dont need to use JET templates as VE uses and generates the
constructor I want.
Now there is one problem , upon changing the values in the constructor,
the new values do not get reflected. Is there any solution for this?

Thanks,
Anand
Re: Preventing the generation of default constructor [message #132299 is a reply to message #132150] Wed, 18 October 2006 16:04 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I don't know what:

> Now there is one problem , upon changing the values in the constructor,
> the new values do not get reflected. Is there any solution for this?
>

means. Is this where you are using the class somewhere else and you
changed the settings on the using constructor (i.e. say I had a class
XYZ(String arg1). If I had dropped XYZ on some other class and in the
code the usage of the ctor is

new XYZ("abc");

And then later I typed in

new XYZ("cde");

And you don't see any change?

Or is it something else?

--
Thanks,
Rich Kulp
Re: Preventing the generation of default constructor [message #614682 is a reply to message #131833] Thu, 05 October 2006 15:20 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

This is a function of JDT, not of the VE. The reason it is not done for
SWT widgets is because SWT widgets do not have a default ctor. Since
they don't have one, then one is not generated for the subclass. The
algorithm is simply duplicate any constructor the super class has.

Anand wrote:
> Hi,
>
> How to prevent the default constructor from getting generated, when
> "Constructors from superclass"
> is checked in the new visual class wizard.
>
> This is for my custom widget written using swing.
> Since this is already done for SWT widgets, how to achieve the same in
> Swing.
>
> Thanks,
> Anand
>

--
Thanks,
Rich Kulp
Re: Preventing the generation of default constructor [message #614689 is a reply to message #131851] Fri, 06 October 2006 12:17 Go to previous message
Anand is currently offline AnandFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Rich,

By removing the default constructor I started getting
NoSuchMethodException.
When I checked the code for SWT widgets found that,
actually SWT widgets does have a default constructor but without any
access specifiers.
Doing the same to my CustomWidget works, but gave rise to a new problem.
VE executes the code present only in the default constructor and not the
one that is custom generated using JET template.
Is there any workaround for this.

Thanks,
Anand


Rich Kulp wrote:

> This is a function of JDT, not of the VE. The reason it is not done for
> SWT widgets is because SWT widgets do not have a default ctor. Since
> they don't have one, then one is not generated for the subclass. The
> algorithm is simply duplicate any constructor the super class has.

> Anand wrote:
>> Hi,
>>
>> How to prevent the default constructor from getting generated, when
>> "Constructors from superclass"
>> is checked in the new visual class wizard.
>>
>> This is for my custom widget written using swing.
>> Since this is already done for SWT widgets, how to achieve the same in
>> Swing.
>>
>> Thanks,
>> Anand
>>
Re: Preventing the generation of default constructor [message #614693 is a reply to message #131899] Fri, 06 October 2006 13:47 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I don't know. We actually don't "execute" code from the constructor. We
look for the "initialize()" method and other methods.

--
Thanks,
Rich Kulp
Re: Preventing the generation of default constructor [message #614706 is a reply to message #131950] Wed, 11 October 2006 11:58 Go to previous message
Anand is currently offline AnandFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Rich,

I managed to make VE use the constructor with arguments.
This was done by providing a seperate xmi file to my widget similar to the
xmi file used for SWT label.

Now I dont need to use JET templates as VE uses and generates the
constructor I want.
Now there is one problem , upon changing the values in the constructor,
the new values do not get reflected. Is there any solution for this?

Thanks,
Anand
Re: Preventing the generation of default constructor [message #614716 is a reply to message #132150] Wed, 18 October 2006 16:04 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

I don't know what:

> Now there is one problem , upon changing the values in the constructor,
> the new values do not get reflected. Is there any solution for this?
>

means. Is this where you are using the class somewhere else and you
changed the settings on the using constructor (i.e. say I had a class
XYZ(String arg1). If I had dropped XYZ on some other class and in the
code the usage of the ctor is

new XYZ("abc");

And then later I typed in

new XYZ("cde");

And you don't see any change?

Or is it something else?

--
Thanks,
Rich Kulp
Previous Topic:Remove allocation code if cancel
Next Topic:Installed VE doesn't do SWT/JFace
Goto Forum:
  


Current Time: Fri Mar 29 14:42:39 GMT 2024

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

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

Back to the top