Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Xtext Graphical View
Xtext Graphical View [message #1036534] Mon, 08 April 2013 14:01 Go to next message
d 627 is currently offline d 627Friend
Messages: 28
Registered: March 2013
Junior Member
Hi there.

This is my problem: I'm working with xtext and I have to create a GRAPHICAL REPRESENTATION of the projects creating with my own language, I mean, once my dsl is creating I'm able to use it creating a "X" project and the idea is to be able to see the rappresentation of that project.

I've been searching for a good example, and for possible solutions, but is like a dead road. I've seen some posts about EUGENIA, GMF, SPRAY... but in any of those they explain what to do. There is also a video in xtext home page with the generic graphic view example, but once and again there is no the explanation about how to create the conexion beetwen my dsl and the results that I can obtain.

What do you suggest, what can I do, do you know a good example.....


Thanks a lot.
Re: Xtext Graphical View [message #1036537 is a reply to message #1036534] Mon, 08 April 2013 14:07 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Daniel,

I'm not sure I completely understand the problem you are describing. Is it the case that you already have an Xtext-based language and you need to visualise/edit models that conform to this language using a graphical editor?

Cheers,
Dimitris
Re: Xtext Graphical View [message #1036538 is a reply to message #1036537] Mon, 08 April 2013 14:10 Go to previous messageGo to next message
d 627 is currently offline d 627Friend
Messages: 28
Registered: March 2013
Junior Member
Exactly Dimitris.

I have create my own language using xtext (working good), the next step is create a project using this languge (no problema with that), but at the end I have to create a graphic representation of this project (in order to see dependences, edge, classes), that allows the user to make some analisis based on the graph and not in the code.
Re: Xtext Graphical View [message #1036545 is a reply to message #1036538] Mon, 08 April 2013 14:19 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

You can try to annotate the Ecore metamodel produced from the Xtext grammar using the annotations provided by Eugenia [1] and then generate a GMF-based editor from it (don't go for the "Generate GMF Editor" option as you *only* want to generate the .diagram project). In your runtime workbench you should then be able to right-click on your models in the project explorer and select "Initialise XYZ diagram file".

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/eugenia-gmf-tutorial/
Re: Xtext Graphical View [message #1036564 is a reply to message #1036545] Mon, 08 April 2013 14:49 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Daniel,

I've tried this and it works fine. Please find a list of steps below:

1. Create a new Xtext project (keep all the defaults)
2. Launch GenerateMyDsl.mwe2
3. Annotate MyDsl.ecore (org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/MyDsl.ecore)
4. Right-click on MyDsl.ecore and select Eugenia->Generate GMF tool, graph and map models
5. Open MyDsl.genmodel, right-click on its root and select Generate Edit Code
6. Right-click on MyDsl.gmfmap and select Create generator model... (keep all the defaults)
7. Right-click on MyDsl.gmfgen and select Eugenia-> Synchronize GMFGen
8. Right-click on MyDsl.gmfgen and select Generate diagram code
9. Launch a new Eclipse instance
10. Create a new .mydsl file and add some valid contents to it
11. Right-click on the file in the project explorer and select Initialise mysdsl diagram file (you should now also be able to edit your .mydsl file through the GMF editor)

The complete code for the scenario above is available in https://dl.dropbox.com/u/5636547/org.xtext.example.mydsl.eugenia.zip

Cheers,
Dimitris
Re: Xtext Graphical View [message #1036675 is a reply to message #1036564] Mon, 08 April 2013 17:23 Go to previous messageGo to next message
d 627 is currently offline d 627Friend
Messages: 28
Registered: March 2013
Junior Member
Thanks a lot Dimitris, you are very helpfull. I'm trying to follow the steps you wrote, but until now when I generate the GMF tool, graph and map models I've got an error . In the error log appears: !ENTRY org.eclipse.ui 2 2 2013-04-08 17:59:45.370
!MESSAGE Invalid property category path: ValidationPropertiesPage (bundle: org.eclipse.wst.xml.ui, propertyPage: org.eclipse.wst.xml.ui.propertyPage.project.validation)

!ENTRY org.eclipse.epsilon.common.dt 4 0 2013-04-08 18:05:41.507
!MESSAGE Method 'getContainmentReferences' not found (bundleresource://566.fwk142345952/transformations/ECore2GMF.eol@189:38.
!STACK 0

I've been looking for the solution in other forums, but nothing 'till now.
Re: Xtext Graphical View [message #1036699 is a reply to message #1036675] Mon, 08 April 2013 17:54 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Daniel,

By the sound of it, I suspect that you may have forgotten to annotate one of your EClasses as @gmf.diagram

Cheers,
Dimitris
Re: Xtext Graphical View [message #1036711 is a reply to message #1036699] Mon, 08 April 2013 18:11 Go to previous messageGo to next message
d 627 is currently offline d 627Friend
Messages: 28
Registered: March 2013
Junior Member
Dimitris so sorry for disturbing you so much, but is it possible to send a private mail?

[Updated on: Mon, 15 April 2013 20:18]

Report message to a moderator

Re: Xtext Graphical View [message #1036712 is a reply to message #1036711] Mon, 08 April 2013 18:15 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Daniel,

No problem. Please feel free to email me at epsilon.devs@gmail.com and send me a copy of your .ecore so that I can have a quick look.

Cheers,
Dimitris
Re: Xtext Graphical View [message #1037262 is a reply to message #1036534] Tue, 09 April 2013 10:55 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Well this is pretty amazing.
Converting the Xtext Domainmodel Example into a graphical view was quite easy, I have to say.

But, one problem that I had:
Whatever I tried, the context menu was only correct if I chose the file extension "domainmodel" (same name as the package). "dmodel" did not work, i.e. no option to generate a diagram from the .dmodel file context menu.

Where should I look to be able to change that?
Re: Xtext Graphical View [message #1037270 is a reply to message #1037262] Tue, 09 April 2013 11:08 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Claudio,

I suspect that the extension of the domain model files is somehow controlled by Xtext but I'm afraid my knowledge of Xtext is quite limited to be able to help with this. If you do find out (people in the Xtext forum may be able to help) it'd be great if you could post the answer here for completeness.

Cheers,
Dimitris
Re: Xtext Graphical View [message #1037280 is a reply to message #1037270] Tue, 09 April 2013 11:22 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Hello,

thanks for the quick response, I'll try to figure it out and will be sure to share.
One question on the Epsilon part of that, though - which part of the model does define the extension the diagram is applied to? My thinking being that what I am looking for is bound to be somewhere in the Ecore model itself, as basically everything is created from that.
Re: Xtext Graphical View [message #1037306 is a reply to message #1037280] Tue, 09 April 2013 11:56 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Claudio,

Thanks! The diagram extension is defined through the diagram.extension detail of the gmf.diagram annotation [1].

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/eugenia-gmf-tutorial/
Re: Xtext Graphical View [message #1037315 is a reply to message #1037306] Tue, 09 April 2013 12:08 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Hello,

sorry, I probably haven't expressed myself properly.
I was wondering where the file extension for files from which a diagram can be created is specified, "domainmodel" in this specific case.
It is likely an extension added to the context menu, applied to a specific file extension, as the menu entry "Initialize [...] diagram" (see picture) only appears in .domainmodel files. I believe if I can find out where that menu entry is registered I can figure out how to work with different extensions.


Edit:
Nevermind, I found it, it's in the popup menu extension of the diagram. Now to find out _why_ it's specified as *.domainmodel there.

Edit2:
Doesn't matter, just editing the nameFilter to *.dmodel does the trick.
Trivial solutions to annoying problems are nice.
It is, however, a little bit of a nuisance that I have to change this all the time when I generate the diagram code anew.

[Updated on: Tue, 09 April 2013 12:40]

Report message to a moderator

Re: Xtext Graphical View [message #1037930 is a reply to message #1037315] Wed, 10 April 2013 07:31 Go to previous messageGo to next message
Mårten Carlzon is currently offline Mårten CarlzonFriend
Messages: 60
Registered: March 2013
Location: Sweden
Member

Hi

I jump in here if that's ok Smile

Dimitris, I tried to follow your steps but when I tried to generate the tool, graph, map thingies I got the following error message:
Method 'getContainmentReferences' not found (bundleresource://614.fwk1639539799/transformations/ECore2GMF.eol@189:38)

and when I run your zip folder i get the following errors when I try to make the mydsl_diagram file
"Premature end of file." and "java.lang.NullPointerException errors" so I end up with an empty diagram file I cant do much with.

So I don't seem to have much luck with making diagram files at the moment Smile

But I was wondering what I should look at in your code to see the interaction between XText and GMF? I am working at the moment in Graphiti and I have an XText grammar and a Graphiti diagram plugin and I am looking at merging them and even though your code is using GMF I thought it could be a good help.

Am I on the right track if I think the connection is in the plugin.xml from your org.xtext.example.mydsl.diagram package and the files in your org.xtext.example.mydsl.myDsl.provider package?
Re: Xtext Graphical View [message #1037944 is a reply to message #1037930] Wed, 10 April 2013 07:51 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Oh dear, I wrote up such a nice post and the forum ate it. Rude.
-

Anyway, I hope you don't mind if I answer to the best of my knowledge.
I'm by no means an expert on either Xtext or GMF-based tools, so take what I say with a grain of salt, but I gathered at least some knowledge during the last weeks.

As you probably know, Xtext relies on the EMF, i.e. creates an Ecore model for every grammar to then work with its nodes.
Eugenia (in this case, but other GMF tools too, as far as I know) also uses that model, but takes it in another direction to create a graphical view for it.
So I think the connection between Xtext and Eugenia is more or less only indirect via the Ecore model.

As for your error, I'll take a guess and say it's caused by an erroneous annotation.
Re: Xtext Graphical View [message #1037978 is a reply to message #1037944] Wed, 10 April 2013 08:45 Go to previous messageGo to next message
Mårten Carlzon is currently offline Mårten CarlzonFriend
Messages: 60
Registered: March 2013
Location: Sweden
Member

Feeling responsible for eating your post so... sorry.
(I blame that I am new to forums find it easier to continue in an existing thread then beginning a new one Smile)

-

Have no problem with you answering my question, it explains a lot of the structure so I don't mind.
And now I know a bit more what to look for so thanks for the reply, and if I get more questions I will start a new thread Smile
Re: Xtext Graphical View [message #1041225 is a reply to message #1036564] Sun, 14 April 2013 20:43 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi,

it worked fine but when i create element from .mydsl file my eclipse give me

Conflicting handlers for org.eclipse.ui.edit.text.contentAssist.proposals:
{ActionHandler(org.eclipse.ui.texteditor.ContentAssistAction@3aa0b6d7)} vs
{org.eclipse.xtext.ui.editor.handler.ContentAssistHandler@264af45e} error.

But anyway it works. U know why this error have been occured ?

Regards,
Re: Xtext Graphical View [message #1041646 is a reply to message #1041225] Mon, 15 April 2013 11:14 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
This was a bug [1] in Xtext 2.3.1.
It has been fixed in the recent release, 2.4.0.

--
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=390173
Re: Xtext Graphical View [message #1041684 is a reply to message #1041646] Mon, 15 April 2013 12:12 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Thanks now it fixed Smile

And i want to ask u,

u know how to make embedded xtex in GMF like on properties view

or right click on content of diagram ?

Regards

[Updated on: Mon, 15 April 2013 12:14]

Report message to a moderator

Re: Xtext Graphical View [message #1041951 is a reply to message #1041684] Mon, 15 April 2013 20:18 Go to previous messageGo to next message
d 627 is currently offline d 627Friend
Messages: 28
Registered: March 2013
Junior Member
Ok I've been having all the possible problems to reproduce this example. I just follow all the steps that Dimitris wrote but for some reason, even when diagram package is creating correctly, when I launch the new Eclipse Application I don't see the option for initialize the diagram file.
I've been looking for all the possible explanation but nothing until now.

[Updated on: Tue, 16 April 2013 12:11]

Report message to a moderator

Re: Xtext Graphical View [message #1041972 is a reply to message #1041951] Mon, 15 April 2013 20:52 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Daniel,

The file extension for the "Initialize XYZ Diagram" menu item is specified through an extension to the "org.eclipse.ui.popupMenus" extension point in plugin.xml of your .diagram project. To change it, you need to change the value of its nameFilter attribute.

Cheers,
Dimitris
Re: Xtext Graphical View [message #1042421 is a reply to message #1041972] Tue, 16 April 2013 12:11 Go to previous messageGo to next message
d 627 is currently offline d 627Friend
Messages: 28
Registered: March 2013
Junior Member
Once again thanks a lot Dimitris, that was the solution for my problem. Now finally I can begin with my homework.
Re: Xtext Graphical View [message #1053039 is a reply to message #1042421] Thu, 02 May 2013 07:37 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi all

I use this steps and my senchronization work perfect but when i generate my first

diagram from xtext program i always get error (error log attached as a error.txt file)

(But only first iteration i get this error on second or later iteration i dont get this error.)

and there is another problem is i can't create diagram file. I must create xtext program file and then i must genereate diagram file. So i want to ask u how can i create diagram file independently from xtext resource ?

first part of error ;

!ENTRY org.eclipse.osgi 2 0 2013-04-21 01:42:55.171
!MESSAGE The activator org.eclipse.gmf.examples.runtime.diagram.decorator.DecoratorPlugin for bundle org.eclipse.gmf.examples.runtime.diagram.decorator is invalid
!STACK 0
org.osgi.framework.BundleException: The activator org.eclipse.gmf.examples.runtime.diagram.decorator.DecoratorPlugin for bundle org.eclipse.gmf.examples.runtime.diagram.decorator is invalid
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:172)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:236)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1212)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.gmf.runtime.common.core.service.Service$ProviderDescriptor.getProvider(Service.java:158)
	at org.eclipse.gmf.runtime.diagram.ui.internal.services.decorator.DecoratorService$ProviderDescriptor.provides(DecoratorService.java:72)
	at org.eclipse.gmf.runtime.common.core.service.Service.safeProvides(Service.java:859)
	at org.eclipse.gmf.runtime.common.core.service.ExecutionStrategy.getUncachedProviders(ExecutionStrategy.java:254)
	at org.eclipse.gmf.runtime.common.core.service.Service.getProviders(Service.java:537)
	at org.eclipse.gmf.runtime.common.core.service.ExecutionStrategy$4.execute(ExecutionStrategy.java:178)
	at org.eclipse.gmf.runtime.common.core.service.Service.execute(Service.java:651)
	at org.eclipse.gmf.runtime.diagram.ui.internal.services.decorator.DecoratorService.createDecorators(DecoratorService.java:121)
	at org.eclipse.gmf.runtime.diagram.ui.editpolicies.DecorationEditPolicy.refresh(DecorationEditPolicy.java:184)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart$3.run(GraphicalEditPart.java:858)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.refresh(GraphicalEditPart.java:851)
	at org.eclipse.gef.editparts.AbstractEditPart.addNotify(AbstractEditPart.java:253)
	at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotify(AbstractGraphicalEditPart.java:223)
	at org.eclipse.gef.editparts.AbstractEditPart.addChild(AbstractEditPart.java:212)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.addChild(GraphicalEditPart.java:1319)
	at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(AbstractEditPart.java:781)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.handleNotificationEvent(GraphicalEditPart.java:1464)
	at org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.notifyChanged(GraphicalEditPart.java:1438)
	at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.fireNotification(DiagramEventBroker.java:504)
	at org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker.resourceSetChanged(DiagramEventBroker.java:399)
	at org.eclipse.gmf.runtime.diagram.ui.DiagramEventBrokerThreadSafe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:73)
	at org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory$DiagramEditingDomain.postcommit(DiagramEditingDomainFactory.java:214)
	at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.deactivate(TransactionalEditingDomainImpl.java:543)
	at org.eclipse.emf.transaction.impl.TransactionImpl.close(TransactionImpl.java:712)
	at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:474)
	at org.eclipse.emf.workspa
.
.
.
.


But only one i get this error on second or later iteration i dont get this error.

Anyone can help me to solve this eror ?

Regards
  • Attachment: error.txt
    (Size: 82.37KB, Downloaded 285 times)

[Updated on: Thu, 02 May 2013 10:16]

Report message to a moderator

Re: Xtext Graphical View [message #1053155 is a reply to message #1053039] Thu, 02 May 2013 18:18 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi,

Please have a look at the Overview tab of org.eclipse.gmf.examples.runtime.diagram.decorator's plugin.xml and make sure that it points to a valid Activator.

Cheers,
Dimitris
Re: Xtext Graphical View [message #1053218 is a reply to message #1053155] Fri, 03 May 2013 08:08 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi,

Thanks for answer.

i look org.eclipse.gmf.examples.runtime.diagram.decorator's plugin.xml and i see ;

Bundle-Activator: org.eclipse.gmf.examples.runtime.diagram.decorator.DecoratorPlugin

is it true ? dont know How can I be sure

Regards
Re: Xtext Graphical View [message #1053736 is a reply to message #1053155] Tue, 07 May 2013 12:35 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi,

problem fixed, when i get update and recreate project. But now i have another problem

too I make new project (with synchronization steps) and then i write epsilon evl for

model validation it works perfect. But gmf error occured on diagram and xtext file

(separately) and evl quick fixed dont run on xtext file. Because of this i want error

and warnings dont occure on xtext file. How can i done this ? Anyone can help me ?

Just i want to write aperate error and warning for xtext file and gmf diagram

(sample scenario on attached picture.)

Regards

Re: Xtext Graphical View [message #1838385 is a reply to message #1053736] Tue, 23 February 2021 21:01 Go to previous messageGo to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi all,


Old thread, but seems to be very helpful. I only had one question. The steps suggested by Dimitris are only to provide a graphical representation of the textual model? If so, what else needs to be done to be able to edit both the textual and graphical model and synchronize the changes?

Thank you!
Re: Xtext Graphical View [message #1838432 is a reply to message #1838385] Wed, 24 February 2021 18:55 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

For completeness, this has been answered in https://www.eclipse.org/forums/index.php?t=msg&th=1107075&goto=1838412&#msg_1838412
Re: Xtext Graphical View [message #1844162 is a reply to message #1036564] Fri, 03 September 2021 17:46 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hello! I know, Eugenia is outdated but I've already written myself into it(bc a kolleagues' similar project used it) and I simply need a graphical view of my xtext model which has to be able to change live slightly (coloring the nodes to show status and showing a counter would be enough). I simply want to finish that project as quickly as possible, no need for anything fancy. I tried that steps from the beginning of the thread and I have two issues here: first when generating edit code, numerous classes would be needed in the .provider package which arent existing( classes that would be generated with an GMF editor I think), and second when creating a generator model a "All references are unique in EMF due to the current code generation" error appears which I cant deal with. In case you dont see a chance to go on with Eugenia, which software would you recommend considering my explained tasks? Thank you in advance!
Re: Xtext Graphical View [message #1844164 is a reply to message #1844162] Fri, 03 September 2021 18:47 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Christoph,

Does this help? https://www.eclipse.org/epsilon/doc/articles/picto-xtext/

Best,
Dimitris
Re: Xtext Graphical View [message #1844172 is a reply to message #1036564] Sat, 04 September 2021 11:03 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Thank you, that looks quite good and that I can use it in the same runtime as the xtext editor is great. But before I start I need to be sure of some things:
The graphical view is needed to monitor the flow of a recipe (with parallel steps, I guess thats possible to view?), so I would therefore need to
1) update the view every other second ( I guess by triggering"getRenderingMetadata" more often so not only when the editor is saved or opened) and
2) beeing able to get color and an Integer from the xtext generator (NOT from the xtext editor but code behind) I guess it would be sufficient if the .egl file could call for it from the generator).
Do you think that tasks are somehow doable? Or do I need to look for some other software? Thanks for the help!

P.S. I tried the Picto example from Epsilon Git repo and in the Picto View there is just the tree visible, with a premature end of file message, so the Graphical view is missing, any suggestions?

[Updated on: Sat, 04 September 2021 11:38]

Report message to a moderator

Re: Xtext Graphical View [message #1844176 is a reply to message #1844172] Sat, 04 September 2021 18:03 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Christoph,

Re #1, in your implementation of getRenderingMetadata you can add custom parameters to the EGX/EGL template using metadata.getParameters().add(...)

Re #2, to refresh your view programmatically you need to get hold of the PictoView (see [1]), and then call pictoView.render(pictoView.getEditor()); periodically.

I've tried the example again with the latest interim version of Epsilon and it works fine for me. Could you please provide a screencast that demonstrates the issue you're encountering?

Best,
Dimitris

[1] https://www.eclipse.org/forums/index.php/t/101546/
Re: Xtext Graphical View [message #1844211 is a reply to message #1844176] Mon, 06 September 2021 12:19 Go to previous messageGo to next message
Tomas Wall is currently offline Tomas WallFriend
Messages: 53
Registered: April 2021
Member
Hi all,

Very interesting thread indeed. My question here is a bit different. So you make this work starting from a DSL defined in Xtext. What if this DSL is defined through Ecore? My first impression is that it would work the same way being that Xtext and Ecore use EMF as a common data layer.
Moreover, if I make a change in the graphical editor (GMF let's say) , when I save it, will the model (in an exceed editor lets say) be updated?
Re: Xtext Graphical View [message #1844217 is a reply to message #1844176] Mon, 06 September 2021 13:36 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hello Dimitris,
you are very helpful, I think I found my graphical tool :)
To get the example code running I added a screencast. Before the screencast started I simply imported the projects, run generate xtext artifacts and added 2 empty packages due to errors named "xtend-gen" each to the projects .ide and .ui. As I said, just the tree of picto is visible.
Thanks for the help!
Re: Xtext Graphical View [message #1844220 is a reply to message #1844217] Mon, 06 September 2021 15:10 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Christoph,

Hmmm... interesting. Could you please try to reproduce the example in https://www.eclipse.org/epsilon/doc/picto/ (which doesn't use Xtext) and let me know if it works for you?

Best,
Dimitris
Re: Xtext Graphical View [message #1844221 is a reply to message #1844220] Mon, 06 September 2021 15:13 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Tomas,

Picto works out of the box with the built-in EMF tree-based editor and with Exeed, but not with GMF-based editors I'm afraid. To implement support for GMF-based editors you can use the org.eclipse.epsilon.picto.pictoSource extension point (see https://www.eclipse.org/epsilon/doc/picto/#extending-picto)

Best,
Dimitris
Re: Xtext Graphical View [message #1844225 is a reply to message #1844220] Mon, 06 September 2021 16:43 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hi Dimitris,
unfortunately not, maybe you have a look at this screenshot.
I also tried the xtext-picto example with another laptop, same result...
nonetheless will I now start with my own picto integration - Is there a handy way to create the .picto project to get all necessary plugin dependencies and other stuff like in the example project?
Thank you very much for the help!
Chris
  • Attachment: ss.PNG
    (Size: 120.11KB, Downloaded 72 times)

[Updated on: Mon, 06 September 2021 17:08]

Report message to a moderator

Re: Xtext Graphical View [message #1844227 is a reply to message #1844225] Mon, 06 September 2021 17:05 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Please try closing the editor, registering socialnetwork.ecore and opening the editor again.

Best,
Dimitris
Re: Xtext Graphical View [message #1844228 is a reply to message #1844227] Mon, 06 September 2021 17:21 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
That helped somewhat, it now looks like this
Re: Xtext Graphical View [message #1844229 is a reply to message #1844228] Mon, 06 September 2021 18:00 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

What about the rest of the views in the tree? Do they render ok?
Re: Xtext Graphical View [message #1844231 is a reply to message #1844229] Mon, 06 September 2021 20:00 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
oh I overlooked them^^ No unfortunately same like with xtext-picto project.
Could a software be missing?
I guess I will nonetheless start with my own project - Is there a handy way to create the .picto project to get all necessary plugin dependencies and other stuff like in the example project?
  • Attachment: sss.PNG
    (Size: 107.09KB, Downloaded 73 times)

[Updated on: Mon, 06 September 2021 20:02]

Report message to a moderator

Re: Xtext Graphical View [message #1844232 is a reply to message #1844231] Mon, 06 September 2021 20:38 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Could you please double-check that Graphviz is installed correctly? https://www.eclipse.org/epsilon/doc/picto/#troubleshooting

> I guess I will nonetheless start with my own project - Is there a handy way to create the .picto project to get all necessary plugin dependencies and other stuff like in the example project?

Not that I'm aware of. You'll need to create the .picto plugin project manually and then add the required dependencies to it.

Best,
Dimitris
Re: Xtext Graphical View [message #1844303 is a reply to message #1844176] Wed, 08 September 2021 14:03 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hello Dimitris,
thank you very much reinstalling Graphviz did it for me, my project already looking quite good!
I have another question:
I dont know where to call pictoView.render(pictoView.getEditor()). Since xtext is a framework(IoC) its difficult to "enter" the control flow.

Thank you very much again, your help is extremely valuable!

[Updated on: Wed, 08 September 2021 14:07]

Report message to a moderator

Re: Xtext Graphical View [message #1844309 is a reply to message #1844303] Wed, 08 September 2021 14:50 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Christoph,

It's good to hear that after reinstalling Graphviz you've managed to make good progress with Picto!

> I dont know where to call pictoView.render(pictoView.getEditor()). Since xtext is a framework(IoC) its difficult to "enter" the control flow.

This seems to be more of an Xtext question so my suggestion would be to post a message to https://www.eclipse.org/forums/index.php/f/27/

Best,
Dimitris
Re: Xtext Graphical View [message #1844310 is a reply to message #1844309] Wed, 08 September 2021 15:44 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Solved
Thank you, I think I found a workaround (by simply starting a new thread via getRenderingMetadata() itself to render until I want it to stop).
Nonentheless, there is also a Picto question concerning this topic:
I would use
PictoView pview= (PictoView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.epsilon.picto.PictoView");
pview.render(view.getEditor()); 

to refresh my PictoView as suggested in the Post you recommended, but I get the error that "the return value of "org.eclipse.ui.IWorkbench.getActiveWorkbenchWindow()" is null". Have I made a mistake in calling the view? And I hope I am right that calling view.render() would again call getRenderingMetadata()?
Thanks again!

[Updated on: Thu, 09 September 2021 18:45]

Report message to a moderator

Re: Xtext Graphical View [message #1844498 is a reply to message #1844310] Wed, 15 September 2021 09:02 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

> "the return value of "org.eclipse.ui.IWorkbench.getActiveWorkbenchWindow()" is null"

It's hard to guess what might be going wrong here from the error message alone. If you haven't solved this already, could you please put together a minimal example I can use to reproduce this?

Best,
Dimitris
Re: Xtext Graphical View [message #1844767 is a reply to message #1844498] Fri, 24 September 2021 13:39 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hello Dimitris, thank you for all the help, my project works great! I have a small questions about the .egl Template in Picto: How can I convert a String into a Integer there? Havent found much Documentation about that language
Greetings Christoph
Re: Xtext Graphical View [message #1844768 is a reply to message #1844767] Fri, 24 September 2021 13:46 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Christoph,

I'm very pleased to hear that Picto works well for your project!

Regarding your question, "1".asInteger() should do the trick (see https://www.eclipse.org/epsilon/doc/eol/ for more built-in methods)

Best,
Dimitris
Re: Xtext Graphical View [message #1847189 is a reply to message #1844768] Mon, 18 October 2021 16:36 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hello Dimitris, apparently the IntegerConversion worked, thank you for that! I am now trying to install my project via Maven/Tycho and have again a problem with the picto view. Similar to a previous question of mine, the picto view is again just blank and I wonder if Graphviz could again be the problem.. Can you explain how picto gets aware of Graphviz? Maybe it has to be added as dependency or classpath or similar, thank you!!!
Re: Xtext Graphical View [message #1847200 is a reply to message #1847189] Tue, 19 October 2021 08:51 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Christoph,

Picto expects Graphviz to be installed in the machine at the operating system level and uses a shell command to run it.

Best,
Dimitris
Re: Xtext Graphical View [message #1847205 is a reply to message #1847200] Tue, 19 October 2021 10:14 Go to previous messageGo to next message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
Hello Dimitris!
I figured out another error and now know it cant be Graphviz at the moment - I get simply " /asdslmodel.egx" in my Picto View, so I think the product doesnt know how to deal with that kind of file. Do you know which feature of the update site http://download.eclipse.org/epsilon/updates/2.3/ contains that information? I might need to add it as a dependency.
Or more general, do you know of any example projects or talks about using picto in a maven /tycho build?
Re: Xtext Graphical View [message #1847206 is a reply to message #1847205] Tue, 19 October 2021 10:52 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Picto has built-in support for EGL/EGX so my guess is that the path of your EGX file cannot be resolved for some reason.

Thanks,
Dimitris
Re: Xtext Graphical View [message #1847216 is a reply to message #1847206] Tue, 19 October 2021 14:27 Go to previous message
Christoph Binder is currently offline Christoph BinderFriend
Messages: 13
Registered: September 2021
Junior Member
You were right thank you!
Previous Topic:P2: Building on Epsilon Components
Next Topic:ETL Transformations: Types Not Found
Goto Forum:
  


Current Time: Fri Mar 29 07:39:14 GMT 2024

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

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

Back to the top