Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Infer from external source
Infer from external source [message #1060246] Thu, 23 May 2013 16:42 Go to next message
First Last is currently offline First LastFriend
Messages: 17
Registered: March 2013
Junior Member
I would like for a dynamic external source (project/jar) to provide code to be called during infer processing.

The goal is for a user to be able to create two Eclipse projects -- one that uses the DSL, and one that provides an implementation of certain parts of infer() that might be inappropriate to hard-code. (In trivial cases, they'd only create the DSL project.)

There seem to be a number of options for approaching this, from reflection to injection; I am wondering what mechanism would be recommended.
Re: Infer from external source [message #1060355 is a reply to message #1060246] Fri, 24 May 2013 09:22 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Can't you just integrate the code on the target platform, e.g. let your
inferred elements inherit from or delegate to some implementation in the
second plug-in?

Alternatively, you could use Xtend instead of a DSL and dynamically add
your changes using Active Annotations
http://www.eclipse.org/xtend/documentation.html#activeAnnotations

Am 23.05.13 18:43, schrieb First Last:
> I would like for a dynamic external source (project/jar) to provide code
> to be called during infer processing.
>
> The goal is for a user to be able to create two Eclipse projects -- one
> that uses the DSL, and one that provides an implementation of certain
> parts of infer() that might be inappropriate to hard-code. (In trivial
> cases, they'd only create the DSL project.)
>
> There seem to be a number of options for approaching this, from
> reflection to injection; I am wondering what mechanism would be
> recommended.
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: Infer from external source [message #1060542 is a reply to message #1060355] Sun, 26 May 2013 14:04 Go to previous message
First Last is currently offline First LastFriend
Messages: 17
Registered: March 2013
Junior Member
Jan Kohnlein wrote on Fri, 24 May 2013 05:22
Can't you just integrate the code on the target platform, e.g. let your
inferred elements inherit from or delegate to some implementation in the
second plug-in?

Alternatively, you could use Xtend instead of a DSL and dynamically add
your changes using Active Annotations


No; the other project isn't a plugin at all; it's just a normal project or even just a jar file.

What I am accomplishing is somewhat similar to what Active Annotations does; but there are a lot of options in terms of what types are exposed how dependencies flow.

At this point I have an implementation that uses reflection; the DSL plug-in examines the DSL, finds references to external code, reflects to find it, passes a set of generic Map/List structured data to that code, gets back some Map/List structured data, and uses that to build methods.

This is "fine", but obviously means passing around just basic Java types; but that's not too bad, since it means none of the code has a weird compilation dependency. However I may still create yet a third project which the DSL and extension code depend on simply to define the data types to make them easier to work with & possibly to version.
Previous Topic:generated launch configuration
Next Topic:Javadoc-style context/hover information for rules/keywords
Goto Forum:
  


Current Time: Fri Apr 26 19:53:39 GMT 2024

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

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

Back to the top