Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » EmbeddedFactory customization
EmbeddedFactory customization [message #1272980] Wed, 19 March 2014 08:16 Go to next message
Peter N is currently offline Peter NFriend
Messages: 4
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

Re: EmbeddedFactory customization [message #1276159 is a reply to message #1272980] Mon, 24 March 2014 07:05 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Yes, the embedded editor API needs to be overhauled and designed for
better extendability.
Could you file a feature enhancement in bugzilla?

Am 19/03/14 09:16, schrieb Peter N:
> 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
> without copypasting half of class.
>
> What do you think?


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Previous Topic:Xtext 2.6 binary compatibility
Next Topic:Version compatibility
Goto Forum:
  


Current Time: Tue Jan 21 21:30:03 GMT 2020

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

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

Back to the top