Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [XText] Attaching a behavioral extension in a non intrusive way
[XText] Attaching a behavioral extension in a non intrusive way [message #46798] Sun, 31 May 2009 17:16 Go to next message
Eclipse UserFriend
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 #46828 is a reply to message #46798] Mon, 01 June 2009 15:31 Go to previous messageGo to next message
Eclipse UserFriend
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
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:[XText] Attaching a behavioral extension
Next Topic:oaw and TMF Xtext
Goto Forum:
  


Current Time: Wed Jun 04 10:34:03 EDT 2025

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

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

Back to the top