Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Simple Xbase example?
Simple Xbase example? [message #717797] Mon, 22 August 2011 11:52 Go to next message
Mark Utting is currently offline Mark UttingFriend
Messages: 9
Registered: August 2011
Junior Member
Is there a working example anywhere of how to embed Xbase into another language?

I've updated to XText 2.0.1 and then tried the org.eclipse.xtext.example.domainmodel example, but it doesn't connect to the Java types correctly. I get type errors on 'java.lang.String' and 'String' in the following example:

=====================
import java.lang.*

package Foo {}
package Bar {
entity Abc {
op move(java.lang.String x) : String {
}
}
}
=======================

And this example doesn't seem to include interpretation or code generation either.
It would be nice to have an example that used Xbase and included interpretation.


I notice that in the generated MANIFEST.MF file for my org.eclipse.xtext.example.domainmodel project, all the dependencies are to version 2.0.0, not version 2.0.1, even though I created the project after upgrading to XText 2.0.1. Is this correct, or is it a bug?


Can anyone else get Xbase working (with Java types)?
After spending a week or two on Xbase with little success, I'm getting rather frustrated...

Thanks
Mark
Re: Simple Xbase example? [message #717806 is a reply to message #717797] Mon, 22 August 2011 12:16 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

I cannot reproduce the Errors you get. A trivial example for Xbase usage is the PureXbase plugin. Just materialise the Xbase tutorial example. Then you can have Xbase expressions evaluated on pressing "Return/Enter".

You have simple access to the code if you add a dependency to the org.eclipse.xtext.purexbase(.ui) plugins. The XbaseInterpreter is used in the UI plugin in the ReplAutoEdit class.

You may also want to have a look at the following project for some more documentation/examples concerning Xbase.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
(no subject) [message #718086 is a reply to message #717797] Tue, 23 August 2011 08:14 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
The latest online docs contain a walkthrough example.
Jan

Am 22.08.11 13:52, schrieb Mark Utting:
> Is there a working example anywhere of how to embed Xbase into another
> language?
>
> I've updated to XText 2.0.1 and then tried the
> org.eclipse.xtext.example.domainmodel example, but it doesn't connect to
> the Java types correctly. I get type errors on 'java.lang.String' and
> 'String' in the following example:
>
> =====================
> import java.lang.*
>
> package Foo {}
> package Bar {
> entity Abc {
> op move(java.lang.String x) : String {
> }
> }
> }
> =======================
>
> And this example doesn't seem to include interpretation or code
> generation either.
> It would be nice to have an example that used Xbase and included
> interpretation.
>
>
> I notice that in the generated MANIFEST.MF file for my
> org.eclipse.xtext.example.domainmodel project, all the dependencies are
> to version 2.0.0, not version 2.0.1, even though I created the project
> after upgrading to XText 2.0.1. Is this correct, or is it a bug?
>
>
> Can anyone else get Xbase working (with Java types)?
> After spending a week or two on Xbase with little success, I'm getting
> rather frustrated...
>
> Thanks
> Mark
>


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


---
Get professional support from the Xtext committers at www.typefox.io
(no subject) [message #718087 is a reply to message #718086] Tue, 23 August 2011 08:15 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Here's the link

http://www.eclipse.org/Xtext/documentation/2_0_0/199-xtext-and-java.php

Am 23.08.11 10:14, schrieb Jan Koehnlein:
> The latest online docs contain a walkthrough example.
> Jan
>
> Am 22.08.11 13:52, schrieb Mark Utting:
>> Is there a working example anywhere of how to embed Xbase into another
>> language?
>>
>> I've updated to XText 2.0.1 and then tried the
>> org.eclipse.xtext.example.domainmodel example, but it doesn't connect to
>> the Java types correctly. I get type errors on 'java.lang.String' and
>> 'String' in the following example:
>>
>> =====================
>> import java.lang.*
>>
>> package Foo {}
>> package Bar {
>> entity Abc {
>> op move(java.lang.String x) : String {
>> }
>> }
>> }
>> =======================
>>
>> And this example doesn't seem to include interpretation or code
>> generation either.
>> It would be nice to have an example that used Xbase and included
>> interpretation.
>>
>>
>> I notice that in the generated MANIFEST.MF file for my
>> org.eclipse.xtext.example.domainmodel project, all the dependencies are
>> to version 2.0.0, not version 2.0.1, even though I created the project
>> after upgrading to XText 2.0.1. Is this correct, or is it a bug?
>>
>>
>> Can anyone else get Xbase working (with Java types)?
>> After spending a week or two on Xbase with little success, I'm getting
>> rather frustrated...
>>
>> Thanks
>> Mark
>>
>
>


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


---
Get professional support from the Xtext committers at www.typefox.io
Re: Simple Xbase example? [message #726505 is a reply to message #717806] Sun, 18 September 2011 11:48 Go to previous message
Mark Utting is currently offline Mark UttingFriend
Messages: 9
Registered: August 2011
Junior Member
Ok, I finally got my XBase extension working. Smile

It turns out that following all the steps in the documentation is not quite enough.

You also have to manually add several .jar files into the classpath of each application-specific project you create for your DSL examples.

That is, after you create a new project and then create a new DSL file within it, and say "yes" to the question "Do you want to add the XText nature to this project", you need to add the org.eclipse.xtext.xbase.lib JAR to your project.

eg. eclipse_distros/eclipse_sdk_3.7_xtext_2.0.1/plugins/org.eclipse.xtext.xbase.lib_2.0.1.v201108020636.jar

Cheers
Mark
Previous Topic:Spell checking and Xtext
Next Topic:Modifying created EObjects
Goto Forum:
  


Current Time: Wed Apr 24 22:42:47 GMT 2024

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

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

Back to the top