Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem faced with Xtext when running in headless application(Problem faced with Xtext when running in headless application)
Problem faced with Xtext when running in headless application [message #1770114] Tue, 08 August 2017 13:22 Go to next message
vikas kuswaha is currently offline vikas kuswahaFriend
Messages: 4
Registered: August 2017
Junior Member
Hi,

I am facing an issue when running a scenario:

I am validating a xtext resource from both Eclipse UI as well as in headless.

My validation logic checks for duplicate across the projects.

When running through Eclipse UI,
JavaProjectsState container is loaded while running in headless mode, FlatResourceSetBasedAllContainersState is loaded and the container 'all' is coming as below:
[StateBasedContainer] container 'all' from org.eclipse.xtext.resource.containers.FlatResourceSetBasedAllContainersState

So duplicate issue does not come if the resource exist in indirect reference project in Eclipse UI run, as the resource is looked upon the different container.
But when running in headless, duplicate issue comes as the container is one for all direct and indirect reference projects.

Is there any way to solve the issue in headless run? Please suggest.
Thanks.

Regards
Vikas
Re: Problem faced with Xtext when running in headless application [message #1770157 is a reply to message #1770114] Tue, 08 August 2017 16:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
hmmm, am not sure if i get what your problem is. please explain in more details.
and have a look what xbase does
in ui by org.eclipse.xtext.xbase.ui.validation.ProjectAwareUniqueClassNameValidator beeing used
in standalone by org.eclipse.xtext.xbase.validation.UniqueClassNameValidator beeing used


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Problem faced with Xtext when running in headless application [message #1770826 is a reply to message #1770157] Thu, 17 August 2017 12:33 Go to previous messageGo to next message
vikas kuswaha is currently offline vikas kuswahaFriend
Messages: 4
Registered: August 2017
Junior Member
Hi Christian,

When running in Eclipse UI, all of my projects are in different container ,e.g [[StateBasedContainer] container 'Project1' from org.eclipse.xtext.ui.containers.JavaProjectsState@4f84c9bb, [StateBasedContainer] container 'Project2' from org.eclipse.xtext.ui.containers.JavaProjectsState@4f84c9bb

But when running in standalone setup my projects are in 'all' container e.g
[StateBasedContainer] container 'all' from org.eclipse.xtext.resource.containers.FlatResourceSetBasedAllContainersState@420321a6


Is there any way I could have different containers for my projects in standalone setup?
Re: Problem faced with Xtext when running in headless application [message #1770838 is a reply to message #1770826] Thu, 17 August 2017 14:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
standalone != headless != eclipse.

so what do you mean by "my projects in standalone setup"


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Problem faced with Xtext when running in headless application [message #1770840 is a reply to message #1770838] Thu, 17 August 2017 14:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
if you really mean headless you need to make sure

- the plugins are activated
- you add bindings similar to the ones in MyDslUiModule, AbstractMyDslUiModule, DefaultUiModule etc.
e.g.
public com.google.inject.Provider<org.eclipse.xtext.resource.containers.IAllContainersState> provideIAllContainersState() {
return org.eclipse.xtext.ui.shared.Access.getJavaProjectsState();
}

=> would be interesting what you did customize to get stuff running headless.


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Problem faced with Xtext when running in headless application [message #1770880 is a reply to message #1770840] Fri, 18 August 2017 10:28 Go to previous messageGo to next message
vikas kuswaha is currently offline vikas kuswahaFriend
Messages: 4
Registered: August 2017
Junior Member
Hi Christian,

Can I use xtext.ui component in headless? org.eclipse.xtext.ui.shared.Access.getJavaProjectsState()

Re: Problem faced with Xtext when running in headless application [message #1770882 is a reply to message #1770880] Fri, 18 August 2017 10:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
yes and no,

there are parts you can use and parts you cant
i know guy that decide inside the activator of mydslui if the mydsluimodule is used or a custom headlessmydslmodule with stuff copied from mydsluimodule/abstractmydsluimodule/defaultuimodule that is not swt/workbench dependent

the real question: why doesnt your code run in real standalone mode.
what would be preferred.


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Problem faced with Xtext when running in headless application [message #1770885 is a reply to message #1770882] Fri, 18 August 2017 11:40 Go to previous messageGo to next message
vikas kuswaha is currently offline vikas kuswahaFriend
Messages: 4
Registered: August 2017
Junior Member
Ok..My code runs in standalone mode but the issue is with different behaviour in Eclipse UI and headless mode.
for validating in headless application, I provide all my workspace projects which exists in one container and then when validation happens for duplicate , multiple entity is found as all projects are existing in one container.
But in Eclipse UI each project is a separate container and validated in that container.

I would try to explain in more detail.
Re: Problem faced with Xtext when running in headless application [message #1770892 is a reply to message #1770885] Fri, 18 August 2017 12:38 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11892
Registered: July 2009
Senior Member
Should'nt you build project by project in standalone e.g. Using xtext maven or xtext gradle plugin

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Previous Topic:Ambiguity detected but why?
Next Topic:First use is a declaration
Goto Forum:
  


Current Time: Thu Apr 19 15:56:37 GMT 2018

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

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