directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <>
Subject Re: [Studio] Questions about LdifSourceViewerConfiguration class
Date Sat, 14 Mar 2015 19:42:03 GMT
Le 12/03/15 20:40, Stefan Seelmann a écrit :
> Hi Emmanuel,
> On 03/12/2015 07:48 PM, Emmanuel Lécharny wrote:
>> OTOH, all those setters are called in the
>> LdifEditorWidget.createWidget() method, when we call
>> sourceViewer.configure( sourceViewerConfiguration );
>> That makes me wonder why we don't create all the elements in the
>> constructor. Any good reason ?
> To be honest I don't remember if there is/was a good reason. When
> looking into other implementations the objects are also created lazily
> when calling the getter, however the objects are not assigned to a
> member variable.
Yes, this is what I saw when looking for code samples on internet. My
understanding is that as all those methods have parameters that are not
available in the constructor, so it makes sense to have them initialized
in their setters.

> It would be interesting to test if the getters are called more than
> once. 
I'll do that, but even if it's the case, the test (if blah == null then
create blah) cost almost nothing.

> You can try to move the creation to the constructor and see what
> happens. Please note that the class is not only used by the LDIF editor
> itself, but also from a number of ModificationLogsView, SearchLogsView,
> BatchOperationWizardPage, and LdifEditorSyntaxColoringPreferencePage.

Yep. I think I will leave the code as is.
> Another thought, I think e4 supports dependency injection, so maybe it
> makes sense to try to migrate (later, much much later) to e4 and avoid
> hand-wiring all the stuff.

Probably, but I'm way too a newbie in eclipse to do that :-)

FTR, I'm creating a LDIF anonymizer that I'd like to have added to the
Ldif editor, this is why I'm looking at this code (which is quite old...
I realized it was written more than 8 years ago !)

Thanks Stefan !

View raw message