Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reference to files from plugins or projects
Reference to files from plugins or projects [message #1750170] Fri, 16 December 2016 16:39 Go to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
Hello together,

i wrote a grammar to reference EObjects from other .ecore-Files. This works fine if i copy the file directly besides the .mydsl-file.

eobject=[ecore::EClass|FQN]


What i want is to reference to eobjects from .ecore-files from other projects or plugins. How can i achieve this?

Thank you for your time.

Greetings,
Simon
Re: Reference to files from plugins or projects [message #1750171 is a reply to message #1750170] Fri, 16 December 2016 16:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
Simply put it on the classpath e.g. By turning your model project to a plugin project and add the library plugins to the dependencies in manifest

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference to files from plugins or projects [message #1750469 is a reply to message #1750171] Wed, 21 December 2016 11:26 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
Hello Christian, thx for the advice.

Sadly it doesent work. I converted the project that contains my dsl-file to a plugin project and added another plugin that conaints an .ecore-file to the plugin dependencys. no difference
Re: Reference to files from plugins or projects [message #1750479 is a reply to message #1750469] Wed, 21 December 2016 14:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
Does that other project have xtext Nature?
Can you share a complete reproducible example


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference to files from plugins or projects [message #1750482 is a reply to message #1750479] Wed, 21 December 2016 14:26 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
As always your Questions are right on point. With the added XText-Nature it works with a project thats in my workspace.

however i need to use an .ecore-file thats packed in an eclipse-plugin. how can i add xtext nature to a plugin? Or is there another way?
Re: Reference to files from plugins or projects [message #1750483 is a reply to message #1750482] Wed, 21 December 2016 14:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
Then you don't need. Simply add the dependency (and make sure it is really packaged (build.properties)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference to files from plugins or projects [message #1750526 is a reply to message #1750483] Thu, 22 December 2016 08:08 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
i can see the plugin that contains my .ecore-model under Plug-in Dependencies Entry and within the .ecore file. So i guess its packaged. (Selected under binary build, in Source build its unchecked). is that correct?
Re: Reference to files from plugins or projects [message #1750528 is a reply to message #1750526] Thu, 22 December 2016 09:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
that looks legit,
if you have a look at the plugin in the "plugin dependencies" in the package explorer of the test.mydsl containing plugin project,
is the ecore file visible?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference to files from plugins or projects [message #1750531 is a reply to message #1750528] Thu, 22 December 2016 09:39 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
yes it is, right next to my plugin.xml etc.

http://i.imgur.com/B2gVA2C.png

[Updated on: Thu, 22 December 2016 09:57]

Report message to a moderator

Re: Reference to files from plugins or projects [message #1750533 is a reply to message #1750531] Thu, 22 December 2016 10:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
the mydslfile needs to be inside a source folder afaik

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference to files from plugins or projects [message #1750534 is a reply to message #1750533] Thu, 22 December 2016 10:05 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
That did the trick! So many small things. Thx again Christian!
Re: Reference to files from plugins or projects [message #1750543 is a reply to message #1750534] Thu, 22 December 2016 11:41 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
One more Question: Why are the objects i get from the resource like this: platform:/resource/<project>/<path> and not platform:/plugin/<project>/<path> ? I get errors if i try to save it
Re: Reference to files from plugins or projects [message #1750544 is a reply to message #1750543] Thu, 22 December 2016 11:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
which references?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference to files from plugins or projects [message #1750545 is a reply to message #1750544] Thu, 22 December 2016 12:06 Go to previous messageGo to next message
Simon BBBBBBB is currently offline Simon BBBBBBBFriend
Messages: 63
Registered: March 2015
Member
from the Elements i get from the getScope-method.

i try to save the emf-model i get from the mydsl-editor into another emf-instance-model. and i always get the error Resource '/<project-name>' does not exist. Wich is true because the resource is a plugin and not a project that i have in my workspace.
Re: Reference to files from plugins or projects [message #1750547 is a reply to message #1750545] Thu, 22 December 2016 12:21 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14738
Registered: July 2009
Senior Member
sorry i have no idea on that.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Simple question about the lexer
Next Topic:How to set the Java compliance level of the generated genmodel
Goto Forum:
  


Current Time: Sat Dec 14 13:31:52 GMT 2024

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

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

Back to the top