Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ?(I hope you can help me i'm new user in xtext, i have xtext project , i want to call my java class ( with method main) to run it in Xtend file when generating the Xtext editor . also another case is w)
how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754722] Tue, 21 February 2017 19:21 Go to next message
abdf mncr is currently offline abdf mncrFriend
Messages: 41
Registered: February 2017
Member
I hope you can help me i'm new user in xtext, i have xtext project , i want to call my java class ( with method main) to run it in Xtend file when generating the Xtext editor . also another case is when generating the editor Xtext in runtime eclipce , i need to run my java class when save my Xtext model is there any solution for that .
Re: how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754723 is a reply to message #1754722] Tue, 21 February 2017 19:24 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 10423
Registered: July 2009
Senior Member
Hi,

can you please be a bit more specific on what your main does and which which parmeters/contexts it should be invoked?
Re: how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754724 is a reply to message #1754723] Tue, 21 February 2017 19:32 Go to previous messageGo to next message
abdf mncr is currently offline abdf mncrFriend
Messages: 41
Registered: February 2017
Member
I want to run java class after finishing writing my grammar in xtext ediitor ie: use Xtend Generator file to call my java class .
Re: how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754726 is a reply to message #1754724] Tue, 21 February 2017 19:35 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 10423
Registered: July 2009
Senior Member
i still dont get this.

you have opened your test.mydsl file and edit it.
then you hit save.
and then the main should be called with no params?
Re: how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754728 is a reply to message #1754726] Tue, 21 February 2017 19:47 Go to previous messageGo to next message
abdf mncr is currently offline abdf mncrFriend
Messages: 41
Registered: February 2017
Member
The class main has diffrent parameters independent for Xtext grammar
Re: how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754730 is a reply to message #1754728] Tue, 21 February 2017 20:04 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 10423
Registered: July 2009
Senior Member
If it is on save only have a look at IXtextEditorCallback

(Implement it in yourdsl.ui and add a binding to yourdsluimodule)


def void configureMySpecialCallback(com.google.inject.Binder
binder) {
binder.bind(IXtextEditorCallback).annotatedWith(Names. named( "MySpecialCallback")).to(
MySpecialCallback);
}

If it should be called during build as well call it from your generator is the easiest one

Re: how to call or run Java class(pure java code) in the Xtend Code when generate my Xtext Project ? [message #1754732 is a reply to message #1754730] Tue, 21 February 2017 20:30 Go to previous message
abdf mncr is currently offline abdf mncrFriend
Messages: 41
Registered: February 2017
Member
Thanks i will try it now .
Previous Topic:Producing multiple objects from one rule
Next Topic:Generate a final product for my DSL
Goto Forum:
  


Current Time: Mon Apr 24 13:37:55 GMT 2017

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

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