Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to set working directory for import URIs
How to set working directory for import URIs [message #1061512] Sat, 01 June 2013 12:47 Go to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Hi all. Smile

I want to set the working directory for import URIs in my DSL to be the root of the project in which the resource which declares the import is contained. For example, if I have this directory structure:


If I have to import MySourceFile1.mydsl into MySourceFile2.mydsl, I don't want to specify this import as default:

import "../MyFolderB/MySourceFile1.mydsl"

but I want to specify it in this way:

import "MyFolderA/MyFolderB/MySourceFile1.mydsl"

How can I obtain this?

Thanks in advance,
Re: How to set working directory for import URIs [message #1062057 is a reply to message #1061512] Wed, 05 June 2013 15:14 Go to previous message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Hi Marco,

I did something similar. I created a subclass of ImportUriGlobalScopeProvider and overrode getImportedUris. Instead of just checking if each import was a valid URI relative to the resource at hand, I checked it appended to the project path:

    String projectName = resource.getURI().segment(1);
    Project project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    IPath projectPath = project.getLocation();
    IPath importPath = projectPath.append(importString);
Previous Topic:p2 update site broken ?
Next Topic:Organise imports in my DSL
Goto Forum:

Current Time: Mon Jun 25 18:07:55 GMT 2018

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

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

Back to the top