|
Re: [Xtext] Processing Xtext Model [message #666881 is a reply to message #666875] |
Sat, 23 April 2011 19:36 |
|
Hi,
the JavaBeansMetamodel message is just a warning. if you want to explicitely configure it
component = org.eclipse.xpand2.Generator {
metaModel = org.eclipse.xtend.type.impl.java.JavaBeansMetaModel {}
expand = "templates::Template::main FOREACH greetings"
outlet = {
path = targetDir
}
fileEncoding = fileEncoding
}
your second question
Quote: |
Secondly in which file I have to write code to "process xtext model"?
|
i do not understand.
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
Re: [Xtext] Processing Xtext Model [message #666958 is a reply to message #666875] |
Mon, 25 April 2011 06:03 |
Timotei Mising name Messages: 89 Registered: March 2010 |
Member |
|
|
Hi!
Well, for example, within Eclipse' framework, using the API, I can get, let's say, a file from a project:
project.getFile("myfile").
But that returns an IFile instance. How can I convert it to a model so I can use that code:
ResourceSet rs = new ResourceSetImpl();
Resource resource = rs.getResource(URI.createURI("./mymodel.dmodel"), true);
EObject eobject = resource.getContents().get(0);
Or maybe, I should have a .dmodel file somewhere for that file?
Thanks,
Timo
|
|
|
|
|
|
|
Re: [Xtext] Processing Xtext Model [message #692570 is a reply to message #685381] |
Mon, 04 July 2011 18:56 |
Timotei Mising name Messages: 89 Registered: March 2010 |
Member |
|
|
Hi there!
I've managed to get an instance of the Root of my grammar, from a specific file, using this code:
URI uri = URI.createPlatformResourceURI( file.getFullPath( ).toString( ), true );
ResourceSet resSet = new ResourceSetImpl( );
Resource res = resSet.getResource( uri, true );
EObject obj = res.getContents( ).get( 0 );
System.out.println( obj);
However, the first time I use that code, the eclipse freezes like 2-3 seconds. Just first time in a session. Afterwards goes just fine, instantly.
Is there a reason behind it? Or it's the same reason the editor takes a while first time, to init and all that stuff?
Thanks,
Timo
|
|
|
Re: [Xtext] Processing Xtext Model [message #692609 is a reply to message #692570] |
Mon, 04 July 2011 20:38 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Timo,
it's the same reason. The activator takes a moment to start.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
On 04.07.11 20:56, forums-noreply@eclipse.org wrote:
> Hi there!
>
> I've managed to get an instance of the Root of my grammar, from a
> specific file, using this code:
>
>
> URI uri = URI.createPlatformResourceURI( file.getFullPath( ).toString(
> ), true );
> ResourceSet resSet = new ResourceSetImpl( );
> Resource res = resSet.getResource( uri, true );
> EObject obj = res.getContents( ).get( 0 );
> System.out.println( obj);
>
>
> However, the first time I use that code, the eclipse freezes like 2-3
> seconds. Just first time in a session. Afterwards goes just fine,
> instantly.
>
> Is there a reason behind it? Or it's the same reason the editor takes a
> while first time, to init and all that stuff?
>
> Thanks,
> Timo
|
|
|
Powered by
FUDForum. Page generated in 0.03936 seconds