[XText] Attaching a behavioral extension in a non intrusive way [message #46798] |
Sun, 31 May 2009 17:16  |
Eclipse User |
|
|
|
In my previous mail, I mentionned the solution I found to add a
behavioral extension to the model managed by a Xtext editor.
First of all, is it the proper way to do it ?
The primary limitation I see with this solution is that it requires
modifying the editor. Is there a solution which would allow adding the
behavioral extension in some non intrusive way ?
Ideally, an extension point allowing attaching the behavioral extension
declaratively would be great. Or maybe using guice IoC. I'm not familiar
enough with guice though.
Regards,
Cédric Vidal
|
|
|
|
Re: [XText] Attaching a behavioral extension in a non intrusive way [message #49040 is a reply to message #46828] |
Sun, 07 June 2009 12:03  |
Eclipse User |
|
|
|
Hi Sven,
Sure it helps :) but actually, I don't know yet if my behavioral
extension should be activated at the resource level in any context or
only in the context of my specific editor.
If it ends up being activated at all time, I'll definitely try your
solution.
Is there a solution that would enable to attach an adapter to an
existing Xtext editor at the editor or resource level without requiring
to modify the editor source code ?
Regards,
Cédric Vidal
Sven Efftinge a écrit :
> Hi Cédric,
>
> if you want to make sure that models of a certain type are always
> adapted with a certain Adapter I'ld make this the responsibility of the
> Resource.
> So instead of subclassing the editor you could subclass XtextResource.
> In both cases I'ld use Guice to make sure the custom types are used
> instead of the common.
>
> This is done by adding (overriding) the corresponding mapping in your
> module. For the resource this would go into the MyLanguageRuntimeModule
> (for the editor it would go into MyLanguageUIModule):
>
> class MyLanguageRuntimeModule extends AbstractMyLanguageRuntimeModule {
> public Class<? extends XtextResource> bindXtextResource() {
> return MySpecialXtextResource.class;
> }
> }
>
> Hope that helps,
> Sven
>
> Cédric Vidal schrieb:
>> In my previous mail, I mentionned the solution I found to add a
>> behavioral extension to the model managed by a Xtext editor.
>>
>> First of all, is it the proper way to do it ?
>>
>> The primary limitation I see with this solution is that it requires
>> modifying the editor. Is there a solution which would allow adding the
>> behavioral extension in some non intrusive way ?
>>
>> Ideally, an extension point allowing attaching the behavioral
>> extension declaratively would be great. Or maybe using guice IoC. I'm
>> not familiar enough with guice though.
>>
>> Regards,
>>
>> Cédric Vidal
|
|
|
Powered by
FUDForum. Page generated in 0.07002 seconds