Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bundle activator on xtext
Bundle activator on xtext [message #1831374] Tue, 18 August 2020 13:16 Go to next message
Patrick Catillaz is currently offline Patrick CatillazFriend
Messages: 2
Registered: August 2020
Junior Member
Hello,

I have an Xtext project and try to allow simple java functions to extend the language by external user.
The goal is to allow the users to add custom functions

To do that I do the following :
1) I create an eclipse plugin with statics functions.
When I generate the jar a small annotation processor will build me an XML file.
Currently my jar must contain a dummy class that implement IStartup. (+

2) In my xtext project, I create a listener that activate the plugin created in step one and register all available functions.

It's work fine when I was only in Eclipse. But when I try to run with maven, I didn't found a way to activate my bundle.

Do you know how to do it?

Thanks in advance
Re: Bundle activator on xtext [message #1831375 is a reply to message #1831374] Tue, 18 August 2020 13:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
in standalone mode there is usually no osgi. Xtext offten solves these problems then via java ServiceLoader
see e.g.ResourceServiceProviderServiceLoader

i would assume you would have to come up with something similar


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Bundle activator on xtext [message #1831378 is a reply to message #1831375] Tue, 18 August 2020 15:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

By run with Maven I presume you just mean run standalone for which it is essential that you invoke the XXXStandaloneSetup.doSetup() that Xtext kindly generates for you.

Regards

Ed Willink
Re: Bundle activator on xtext [message #1831400 is a reply to message #1831378] Wed, 19 August 2020 05:47 Go to previous messageGo to next message
Patrick Catillaz is currently offline Patrick CatillazFriend
Messages: 2
Registered: August 2020
Junior Member
Quote:
in standalone mode there is usually no osgi. Xtext offten solves these problems then via java ServiceLoader
see e.g.ResourceServiceProviderServiceLoader

i would assume you would have to come up with something similar


Thanks, I will try with ServiceLoader

Ed Willink wrote on Tue, 18 August 2020 15:14
Hi

By run with Maven I presume you just mean run standalone for which it is essential that you invoke the XXXStandaloneSetup.doSetup() that Xtext kindly generates for you.

Regards

Ed Willink


Yes, following the message of Christian it's what I will try. My only assumption is the need to create needed files to use ServiceLoader (this jar will be made by business user and try to keep it simple.

Re: Bundle activator on xtext [message #1831401 is a reply to message #1831400] Wed, 19 August 2020 06:02 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes you need information in jar for service loaders.
maybe you can also try to use classgraph to search the classpath


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Cross-referencing challenges
Next Topic:Not able to open project files when xtext build runs
Goto Forum:
  


Current Time: Wed Apr 24 16:04:41 GMT 2024

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

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

Back to the top