Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [Preferences] StringFieldEditor misses setter for widthInChars
[Preferences] StringFieldEditor misses setter for widthInChars [message #651028] Thu, 27 January 2011 08:50
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
Hi

The StringFieldEditor is often used as a base of refined editors, like
IntegerFieldEditor. We created our corresponding DoubleFieldEditor based
on this class as well. These derived classes typically need to invoke
the default constructor of StringFieldEditor because otherwise they
can't properly override initialization code. To support this idiom,
StringFieldEditor provides several setters that must be invoked very
early, like

setValidateStrategy
setEmptyStringAllowed
setErrorMessage

Unfortunately, this editor misses to provide a setter for the internal
property 'widthInChars' corresponding to the 'width' parameter of the
non-default c'tors. This is a pity, because these derived classes cannot
take advantage of the default implementation of doFillIntoGrid where
this parameter is used. On the other hand, sub-classes are *required* to
invoke this super class method, so we are in a bad situation here.

It seems to me that a very simple fix would be that StringFieldEditor
should provide a public or protected setter

setWidthInChars (alternatively: setTextWidthInChars)

that allows super classes to configure this customization point as well.

Any thoughts?

Greetings from Bremen,

Daniel Krügler
Previous Topic:[Preferences] Why does applyFont() FOR FieldEditor and FieldEditorPreferencePage?
Next Topic:[Preferences] FieldEditor.dispose() not called by FieldEditorPreferencePage
Goto Forum:
  


Current Time: Wed Jul 30 17:19:15 EDT 2014

Powered by FUDForum. Page generated in 0.01546 seconds