Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » absolute windows path of an URI
absolute windows path of an URI [message #1162436] Wed, 30 October 2013 11:21 Go to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
in my generator.xtend, the doGenerate is called with 2 arguments: resource and fsa

If I want to know which DSL file my doGenerate is currently processing
resource.URI will return platform:/resource/myproject/src/abc.mydsl

How can I convert this information to an absolute windows path?
C:\kepler-work\runtime-EclipseXtext\myproject\src\abc.mydsl

Is there something like
resource.URI.absoluteWindowsPath
Re: absolute windows path of an URI [message #1173815 is a reply to message #1162436] Wed, 06 November 2013 19:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13493
Registered: July 2009
Senior Member
HI,

hi. do you call the generator from ui only? if there is a workspace and this workspace is backed by a file system
ResourcesPlugin.getWorkspace().getRoot().getFile(new org.eclipse.core.runtime.Path(resource.getURI().toPlatformString(true))).getLocation().toPortableString()






Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: absolute windows path of an URI [message #1174709 is a reply to message #1173815] Thu, 07 November 2013 09:12 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
Hi Christian,

thank you for your suggestion.

I'm not sure what you mean with "UI only".
For the moment in time, I use the "launch runtime" to experiment with my DSL.
So I have an eclipse environment and a workspace as well.

I added your line into my Generator XTEND,
but got a lot of red marks which will not go away when I press "Organise Imports".

Looks like it will take some time to resolve this issue (as I mentioned earlier, a total newbie on Eclipse, Java, ...).
Re: absolute windows path of an URI [message #1174734 is a reply to message #1174709] Thu, 07 November 2013 09:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13493
Registered: July 2009
Senior Member
Hi,

you need eclipse core runtime/resources as dep.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: absolute windows path of an URI [message #1174781 is a reply to message #1174734] Thu, 07 November 2013 10:03 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
Thank you for the hint, Dietrich
Previous Topic:Replace object after linking
Next Topic:[Xtext/Xtend] Issue when calling xtext generator from a context menu
Goto Forum:
  


Current Time: Thu Jul 09 09:50:00 GMT 2020

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

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

Back to the top