Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using a File located in workspace during Validation process
Using a File located in workspace during Validation process [message #1060591] Mon, 27 May 2013 08:17 Go to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hello

I have a little question I couldn't solve so far.
I'm using ETL and EVL to perform a transformation on my generated model from Xtext. I use them as standalone through a call in the validation process from the embedded Eclipse workspace.

In order to work, both ETL and EVL needs to be provided a "File" instance of a file located on a folder of the "Xtext Eclipse".

I use the "platform:" URI code to access file from the embedded Eclipse workspace.
How can I create a File instance of a file in my xtext.base folder, without having to provide the full path to the file ?

I know the issue might sound Epsilon-related rather then Xtext-related, but the problem is just about loading a file, from Xtext validation process, so I thought here would be a better place to get some help.

Thanks for your help.

Best reguards,

Christophe

[Updated on: Mon, 27 May 2013 08:23]

Report message to a moderator

Re: Using a File located in workspace during Validation process [message #1061662 is a reply to message #1060591] Mon, 03 June 2013 12:25 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
That's really uncommon for me to have nearly a hundred thousand views on a topic, and not a single answer ...

Am I doing something wrong ? Is my question particularly stupid or not clear ? No answer at all is disappointing for a forum made to provide help.

Re: Using a File located in workspace during Valisation process [message #1061678 is a reply to message #1060591] Mon, 03 June 2013 13:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Christophe,

I think the problem is it's a confusing questions. More comments below.

On 27/05/2013 10:17 AM, Christophe g wrote:
> Hello
>
> I have a little question I couldn't solve so far.
> I'm using ETL and EVL to perform a transformation on my generated
> model from Xtext. I use them as standalone through a call in the
> validation process from the embedded Eclipse workspace.
Standalone alone is often interpreted to mean, "not running as an
Eclipse application", so not sure what you mean here...
>
> In order to work, both ETL and EVL needs to be provided a "File"
> instance of a file located on a folder of the "Xtext Eclipse".
Like java.io.File rather than an IFile?
>
> I use the "platform:" URI code to access file from the embedded
> Eclipse workspace.
So you mean platform:/resource? Does this answer help?
http://wiki.eclipse.org/EMF-FAQ#How_do_I_map_between_an_EMF_Resource_and_an_Eclipse_IFile.3F
> How can I create a File instance of a file in my xtext.base folder,
> without having to provide the full path to the file ?
What exactly do you have? The path in the workspace? So is your
question how to get a file: URI from an IFile?
>
> I know the issue might sound Epsilon-related rather then
> Xtext-related, but the problem is just about loading a file, from
> Xtext validation process, so I thought here would be a better place to
> get some help.
Is the file actually in the workspace? Don't you know it's path in the
workspace?
>
> Thanks for your help.
>
> Best reguards,
>
> Christophe


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using a File located in workspace during Valisation process [message #1061692 is a reply to message #1061678] Mon, 03 June 2013 13:59 Go to previous messageGo to next message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Thanks for your answer. I'll try to explain again my situation :

I'm using two different Eclipse plugins : Xtext and Epsilon. I use the "ETL" part of Epsilon to perform a transformation from two different meta models. I use the Epsilon plugin as a standalone, meaning that I call it from some java code in the Xtext plugin, in the validation process.
So I have a "regular" Xtext plugin, which create a second Eclipse specific to my language when I launch it, and the Epsilon part of it is called inside as standalone.

The ETL transformation uses 3 things as input :
_ my current model, it's the Eobject representation of the the current file in my own language.
_ a target model
_ a file, written in the Epsilon Transformation Language.

My problem is with this file.
It must be loaded as an "java.io.File". The file itself is located in a package I added in the "xtext.base" folder. I know both it's relative path and absolute path.

I use "platform:/resource" to access the file corresponding to my models, so in the workspace corresponding to my own language.

From the link in your answer, I assume that I should be able my transformation file through using an "platform:/base". Unfortunately I can't try right now, I'll let you know if it works or not.

I hope things are at least more clear.
Thanks again for your help.

Christophe

[Updated on: Mon, 03 June 2013 14:03]

Report message to a moderator

Re: Using a File located in workspace during Valisation process [message #1061954 is a reply to message #1061692] Wed, 05 June 2013 06:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Christophe,

Comments below.

On 03/06/2013 3:59 PM, Christophe g wrote:
> Thanks for your answer. I'll try to explain again my situation :
>
> I'm using two different Eclipse plugins : Xtext and Epsilon. I use the
> "ETL" part of Epsilon to perform a transformation form two different
> meta model. I use the Epsilon plugin as a standalone, meaning that I
> call it from some java code in the Xtext plugin, in the validation
> process.
So best not call that stand alone...
> So I have a "regular" Xtext plugin, which create a second Eclipse
> specific to my language when I launch it, and the Epsilon part of it
> is called inside as standalone.
So you're simply using Epsilon as part of your Eclipse application
that's primarily focused around Xtext...
>
> The ETL transformation uses 3 things as input : _ my current model,
> it's the Eobject representation of the the current file in my own
> language. _ a target model
> _ a file, written in the Epsilon Transformation Language.
So literally their API requires java.io.File? Most EMF-based
technologies support URIs which are more general than file paths...
>
> My problem is with this file. It must be loaded as an "java.io.File".
> The file itself is located in a package I added in the "xtext.base"
> folder. I know both it's relative path and absolute path.
> I use "platform:/resource" to access the file corresponding to my
> models, so in the workspace corresponding to my own language.
> From the link in your answer, I assume that I should be able my
> transformation file through using an "platform:/base". Unfortunately I
> can't try right now, I'll let you know if it works or not.
IFile has getLocation and getLocationURI that you can use to get the
physical location (it's possible for it not to even be in a file in the
file system, but it typically is).
>
> I hope things are at least more clear.
> Thanks again for your help.
>
> Christophe
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using a File located in workspace during Valisation process [message #1062538 is a reply to message #1061954] Sat, 08 June 2013 13:40 Go to previous message
Christophe g is currently offline Christophe gFriend
Messages: 14
Registered: March 2013
Junior Member
Hello

I could finally solve my problem by using another way of calling my etl file.

IT's also possible to call it not via a java.io.File but via a URI.
Thanks to the ink you provided on your first answer, I've learn the platform:plugin and it works perfectly.

Thank for your help.
Previous Topic:problem with using enums as optional elements
Next Topic:editng xtext framework
Goto Forum:
  


Current Time: Wed Apr 24 22:31:35 GMT 2024

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

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

Back to the top