Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating multiple XText Eclipse editors for one extension
Creating multiple XText Eclipse editors for one extension [message #1809971] Fri, 26 July 2019 16:54 Go to next message
Ben Holland is currently offline Ben HollandFriend
Messages: 34
Registered: April 2019
Member
Is it possible to create multiple Eclipse UI editors for one extension (example: .mydsl)? I'd like to have one editor that is syntax highlighting only and one editor that also is tied to the JVM Inference code generation. I tried creating a separate plugin project and copying over my grammar, but it seems the two plugin projects are fighting each other and I can no longer trigger the JVM Inference logic from my original plugin with that approach.
Re: Creating multiple XText Eclipse editors for one extension [message #1809973 is a reply to message #1809971] Fri, 26 July 2019 18:29 Go to previous messageGo to next message
Ben Holland is currently offline Ben HollandFriend
Messages: 34
Registered: April 2019
Member
Follow up: I see now the second plugin was producing an error which prevented the original plugin from running the JVM model inference. The plugins are playing nicer together now, but I still think I am approaching this wrong. Can I create two separate xtext models for the same file extension without interfering with each other?
Re: Creating multiple XText Eclipse editors for one extension [message #1809974 is a reply to message #1809973] Fri, 26 July 2019 19:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I have heavy doubts
But I have no idea what the actual problem is you try to solve


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Creating multiple XText Eclipse editors for one extension [message #1809975 is a reply to message #1809974] Fri, 26 July 2019 19:15 Go to previous messageGo to next message
Ben Holland is currently offline Ben HollandFriend
Messages: 34
Registered: April 2019
Member
I have a working JVM model inference generator, but it is a little slow. I had an idea to create a second editor view that is just dumb syntax highlighting (no code generator, type checking, etc.). I did this by creating an entirely new xtext project with a different namespace but the same file extension. What I have now seems to work more or less, but I'm not clear on the XText lifecycle for two xtext projects sharing the same extension. I noticed that the AST of one project is affected by the second project, which I did not expect.

Your response makes me think this is not going to be a good route to pursue. Thanks!
Re: Creating multiple XText Eclipse editors for one extension [message #1809976 is a reply to message #1809975] Fri, 26 July 2019 19:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
but what is the criteria for which mode?
or if you want to use a dumb editor always why no writing one without xtext and remove the one xtext registers from plugin.xml


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Creating multiple XText Eclipse editors for one extension [message #1809977 is a reply to message #1809976] Fri, 26 July 2019 19:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Eclipse supports multiple editors per extension and opening uses the most recently used/default. You can use Open With... to select which you use explicitly.

This should all happen before any Xtext functionality is involved so it should just work.

But, you already have two plugins per editor, do you really want four? As Christian hints, find out what your real problem is and perhaps have some preferences/configuration/alternative menu entries.

Regards

Ed Willink
Re: Creating multiple XText Eclipse editors for one extension [message #1809978 is a reply to message #1809977] Fri, 26 July 2019 20:13 Go to previous message
Ben Holland is currently offline Ben HollandFriend
Messages: 34
Registered: April 2019
Member
Thanks I think the plugin.xml file was the lead I needed, the second plugin was contributing features I didn't want which were clashing! The idea of the two views was a dumb/fast editor (an interim solution until I fix the underlying slowness issues) and a slower but more complete editor view with all the standard features view.
Previous Topic:Exception when referencing between Resources in same ResourceSet
Next Topic:Background Color of Embedded Xtext editor does not follow dark theme
Goto Forum:
  


Current Time: Fri Apr 19 07:09:06 GMT 2024

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

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

Back to the top