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
Member
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:

MyProject
->MyFolderA
  ->MyFolderB
    ->MySourceFile1.mydsl
  ->MyFolderC
    ->MySourceFile2.mydsl



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,
Marco
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
Member
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: Thu Mar 28 13:23:40 GMT 2024

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

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

Back to the top