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 02:52 Go to next message
Timothy Vogel is currently offline Timothy Vogel
Messages: 71
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 10:22 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2149
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 05:44 Go to previous message
Timothy Vogel is currently offline Timothy Vogel
Messages: 71
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: Mon Sep 01 19:46:19 EDT 2014

Powered by FUDForum. Page generated in 0.01647 seconds