Skip to main content



      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 08:47 Go to next message
Eclipse UserFriend
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 11:14 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 11:15:31 EDT 2025

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

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

Back to the top