|
Re: [Xtext2] Extending XbaseCompiler [message #685773 is a reply to message #685769] |
Sun, 19 June 2011 19:22 |
|
Hi,
i guess you should not add something to the import manager but rather add the ref to the appendable
public void _toJavaExpression(XDateLiteral lit, IAppendable b) {
b.append("new ");
b.append(getTypeReferences().getTypeForName(SimpleDateFormat.class, lit));
b.append("( \"").append(F_DATE).append("\" ).parse( \"").append(lit.getValue()).append("\" )");
}
but i am not quite sure if this is the correct way to aquire the type.
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Sun, 19 June 2011 19:29] Report message to a moderator
|
|
|
|
|
|
|
Re: [Xtext2] Extending XbaseCompiler [message #699889 is a reply to message #699860] |
Fri, 22 July 2011 14:30 |
Eclipse User |
|
|
|
Originally posted by:
On 22.07.11 15.53, Ingo Meyer wrote:
>
> Also one want to generate more then one java class from one model entity
> (e.g. interface and impl class). How can that be handled in the inferrer?
> With a lot of entities in the model we may have dependencies from entity
> A and B in both directions. As far as I found out the JdtTypeProvider
> can just reference already existing java classes in scr-gen folder,
> cause it wants to load them with the JDT AST parser in the
> JdtBasedTypeFactory.createType. This is totally strange for me as I just
> want to generate text files and the generator should not depend on a
> specific ordering of the generated artifacts!
My impression, from writing my own inferrer, is that the types will
either come from the classpath, i.e. existing classes indexed by Jdt, or
the set of classes inferred by you. In the latter case, you
create/instantiate the type/class descriptions yourself during the
inference, using an injected typesFactory, and when needed create
TypeReferences to them.
Hallvard
|
|
|
|
Re: [Xtext2] Extending XbaseCompiler [message #700667 is a reply to message #700638] |
Sat, 23 July 2011 21:10 |
Eclipse User |
|
|
|
Originally posted by:
On 23.07.11 22.25, Sven Efftinge wrote:
>
> So if you want to reference something which is not on the classpath
> you'll have to create the EMF objects somehow and make sure it is in the
> index.
I still wonder how to ensure that the manually created JvmTypes are in
the index. You wrote in a previous post that if you put them in the
resource's, at the top level, they would be indexed. What kind of
container should they (the JvmTypes) be collected in? An arbitrary
EObject? Would it also work if I put them in a separate resource in the
resourceSet (a bit cleaner)?
Hallvard
|
|
|
Powered by
FUDForum. Page generated in 0.05409 seconds