Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to import EOL for syntax highlighting
How to import EOL for syntax highlighting [message #1842030] Mon, 07 June 2021 20:18 Go to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Hi,

I was wondering if there was an easy way to import EOL into Xtext so I can fake an editor?

I have a modeling tool that I made in Sirius and I am trying to figure out how to embed an editor into it for either OCL or EOL. After looking through this forum it seems that it is very complicated to reuse OCL using xtext so I was hoping it might be easier with EOL. I don't need an Xtend file for it to define any of the semantics because I have an EGL file that will handle that. All I'm after is to essential be able to write EVL in my Sirius editor.

I am new to Xtext. My experience with it is entirely based on the tutorial and the documentation that can be found here: https://www.eclipse.org/Xtext/documentation/index.html
Re: How to import EOL for syntax highlighting [message #1842038 is a reply to message #1842030] Tue, 08 June 2021 04:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

For OCL in graphics, you can emulate the OCL in Papyrus approach using the EmbeddedXtextEditor.

Regards

Ed Willink
Re: How to import EOL for syntax highlighting [message #1842042 is a reply to message #1842038] Tue, 08 June 2021 06:20 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think you are ignoring the main problem; what UX do you want to offer to your users? Presumably you are offering an embedded text editing capability within a graphic application. But is the text that the user edits in any way valid or is any resemblance to syntactic credibility purely coincidental? Allowing text entry is useful and Sirius surely has multi-line string editing, but as soon as you need semantics you start to need language tooling and that needs to integrate since presumably a name in the text needs to be spelled consistently wrt the declaration of that name elsewhere in the graphics so you need a conversion from your graphical model to one understood by the tooling.

The Eclipse OCL facilities are perhaps too-strong which places significant burdens on a re-use; for instance UML or Ecore outer metamodels are normalized by conversion to the Pivot representation, so you would need to map your outer model to Pivot. But once you have overcome the burdens the too-strong pays off with many re-useable facilities.

From my limited understanding, EOL facilities are perhaps too weak and lacking a Concrete Syntax model. This makes it easy to use but many things are missing.

Your original question contrasting EOL and OCL suggests you have some flexibility so I must suggest that you consider the better integration of Xbase.

However your final point is that need EVL, in which case OCL is not an option at all.

The EmbeddedXtextEditor in the OCL project was based on an EclipseLabs prototype. In principle it should work with any Xtext-defined language. I suspect that the EclipseLabs prototype has now forked a few times so you should find a version that already integrates with Sirius. So you are just left with the problem of converting the EVL grammar to Xtext form and integrating all the scope resolutions etc with your outer context.

(You will find that developing the embedded Xtext is much easier if you define a textual grammar for the graphics too, so that at least for testing you have a text-only Xtext regime. Your users may even like the interchangeable alternative of all-text rather than mixed text-and-graphics for some designs.)

Regards

Ed Willink
Re: How to import EOL for syntax highlighting [message #1842076 is a reply to message #1842042] Tue, 08 June 2021 14:22 Go to previous messageGo to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Hi Ed,

Quote:

I think you are ignoring the main problem; what UX do you want to offer to your users?

We want to offer a mix of textual and graphical editors. This portion of the editor will be within a property of a model element. So you assumed correct.

Quote:
But is the text that the user edits in any way valid or is any resemblance to syntactic credibility purely coincidental?

Our goal is to enable the user to run validation checks against the constraints that they want to implement. We are working within a deep metamodeling environment and our initial constraints for the tool were created in EVL hence our bias towards it. The flexibility comes in due to a lack of strong desire for one over the other so we are in a situation of implement both and see which one we like more. So we decided to start with EVL since we are more familiar with it and the EOL suite of languages.

Quote:

Allowing text entry is useful and Sirius surely has multi-line string editing, but as soon as you need semantics you start to need language tooling and that needs to integrate since presumably a name in the text needs to be spelled consistently wrt the declaration of that name elsewhere in the graphics so you need a conversion from your graphical model to one understood by the tooling

If I understand correctly, the conversion that you are talking about here is something that we are currently attempting to resolve using EGL because we are trying to transform what the user creates into another model and in the process check all of the constraints that are defined by the user. So there are multiple metamodels in play and we are using EGL to try to get them to all play nicely with each other.

Quote:

Your original question contrasting EOL and OCL suggests you have some flexibility so I must suggest that you consider the better integration of Xbase.

Have not looked into Xbase yet, will take a look at it now.

Quote:
The EmbeddedXtextEditor in the OCL project was based on an EclipseLabs prototype. In principle it should work with any Xtext-defined language. I suspect that the EclipseLabs prototype has now forked a few times so you should find a version that already integrates with Sirius. So you are just left with the problem of converting the EVL grammar to Xtext form and integrating all the scope resolutions etc with your outer context.

(You will find that developing the embedded Xtext is much easier if you define a textual grammar for the graphics too, so that at least for testing you have a text-only Xtext regime. Your users may even like the interchangeable alternative of all-text rather than mixed text-and-graphics for some designs.)

Can you post a link to the EmbeddedXtextEditor in the OCL project? I haven't been able to find it yet.
Also creating an all text variant of our tool is something that we are also looking into, however at this point we are still exploring the offerings in Eclipse to figure out what would be the least costly method for implementation.

Thomas
Re: How to import EOL for syntax highlighting [message #1842084 is a reply to message #1842076] Tue, 08 June 2021 18:03 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The third Google hit is

https://eclipse.googlesource.com/ocl/org.eclipse.ocl/+/master/examples/org.eclipse.ocl.examples.xtext.console/src/org/eclipse/ocl/examples/xtext/console/xtfo/EmbeddedXtextEditor.java

which is 3 commits out of date wrt the Eclipse OCL copy.

IMHO Xtext is the way to go for almost any T2M challenge. It uses metamodels sensibly so you are well on the way to sharing with Sirius. Just be aware that the graphics handles references simply as lines, whereas in text you need name references and so may need some extra constructs to handle qualified names.

Regards

Ed Willink
Previous Topic:Integrate ocl in xtext grammar or grab all the characters until any language rule appears
Next Topic:Trying to generate DSL files using Java
Goto Forum:
  


Current Time: Fri Apr 19 22:00:16 GMT 2024

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

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

Back to the top