EmbeddedFactory customization [message #1272980] |
Wed, 19 March 2014 08:16 |
Peter N Messages: 6 Registered: February 2014 |
Junior Member |
|
|
Question is about EmbeddedEditor and EmbeddedFactory customization.
I want to customize EmbeddedEditor for my own purposes (for example, I want to hold languageName in it). All I can do now is to create my own implementation of EmbeddedEditorFactory.Builder, and then copy whole 'withParent(...)' method (141 lines) just to rewrite 'new EmbeddedEditor(...)' to 'new MyEmbeddedEditor(...)'.
Maybe the better way to do it in base implementation is to create it in separate method? Like this:
public EmbeddedEditor withParent(final Composite parent) {
/* ... */
final EmbeddedEditor result = createEmbeddedEditor(...);
/* ... */
}
protected EmbeddedEditor createEmbeddedEditor(...) {
return new EmbeddedEditor(...);
}
So, that way, developers can make their own extension of EmbeddedEditor, and then overwrite 'createEmbeddedEditor(...)' method without copypasting half of class.
What do you think?
[Updated on: Thu, 20 March 2014 06:46] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03119 seconds