Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Subclassing Text
Subclassing Text [message #778951] Sat, 14 January 2012 07:52 Go to next message
Timothy Vogel is currently offline Timothy VogelFriend
Messages: 82
Registered: July 2009
Member
I need to provide default behavior on all text fields in an application. Examples are selectAll() on gainFocus and restriction to a subset of keys.

My first approach was to build a class hierarchy anchored on Text but it is marked @noextend. The only other way I can come up with is to add the code to each control individually or in a loop. This appears to me to be very non-OO and difficult to support.

Can anyone educate me on the reason that Text is marked @noextend? A link to existing discussion would be great.

Thanks for taking the time to read my question!
Timothy Vogel
Re: Subclassing Text [message #779798 is a reply to message #778951] Mon, 16 January 2012 15:22 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
See http://www.eclipse.org/swt/faq.php#subclassing . The suggested
approach is to create a class of your own that wraps Text (not
subclasses it), and create instances of your class instead of Text.

Grant


On 1/14/2012 2:52 AM, Timothy Vogel wrote:
> I need to provide default behavior on all text fields in an application.
> Examples are selectAll() on gainFocus and restriction to a subset of keys.
>
> My first approach was to build a class hierarchy anchored on Text but it
> is marked @noextend. The only other way I can come up with is to add the
> code to each control individually or in a loop. This appears to me to be
> very non-OO and difficult to support.
>
> Can anyone educate me on the reason that Text is marked @noextend? A
> link to existing discussion would be great.
>
> Thanks for taking the time to read my question!
> Timothy Vogel
Re: Subclassing Text [message #780500 is a reply to message #779798] Wed, 18 January 2012 10:44 Go to previous message
Timothy Vogel is currently offline Timothy VogelFriend
Messages: 82
Registered: July 2009
Member
Grant,
Thanks for the links. They were very helpful in both understanding what and how.
Timothy Vogel
Previous Topic:eclipse doesnt start on osx 10.6.8
Next Topic:TabDescriptorProvider and tabbed.propertyTabs extension point
Goto Forum:
  


Current Time: Tue Apr 23 09:36:12 GMT 2024

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

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

Back to the top