Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » using absolute path
using absolute path [message #870357] Mon, 07 May 2012 18:43
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
Hi,

Currently I use a Namespace Scope Provider where I have modified it to combine it with importing files. Like:
protected List<ImportNormalizer> internalGetImportedNamespaceResolvers(final EObject context, boolean ignoreCase) {
		List<ImportNormalizer> importedNamespaceResolvers = Lists.newArrayList();
		SimpleAttributeResolver<EObject, String> importResolver = 
				SimpleAttributeResolver.newResolver(String.class, "importedNamespace");
		EList<EObject> eContents = context.eContents();
			 
		for (EObject child : eContents) {
			
			String value = importResolver.getValue(child);			
			if (value != null) {	
			if (child instanceof IncludeFile) {
					// check path to child..
					IPath pathToChild = new Path(value);
					value = pathToChild.lastSegment();
				}
				
				ImportNormalizer resolver = createImportedNamespaceResolver(value+"::*", ignoreCase);
				if (resolver != null)
					importedNamespaceResolvers.add(resolver);
			}
		}
		if (context instanceof Namespace) {
			
			ImportNormalizer resolver2 = createImportedNamespaceResolver(((Namespace)context).getName()+"::*", ignoreCase);
			if (resolver2 != null) {
				importedNamespaceResolvers.add(resolver2);
			}
		}				
		return importedNamespaceResolvers;
	}

As you can see if the importNamespace is used in the context of IncludeFile Container, I know that there is actually a path given.
Now if the file to include is located in the project it will work, because it is in the resourceset. In the code you see I just need to grab the filename and ignore the path. However this will not work if an absolute path is given where the file is located outside the project. Is there a possibility to reference to a file located outside the project? with an example if possible?

Regards,
Phil
Previous Topic:Copying folders
Next Topic:syntax validation not active when opening document
Goto Forum:
  


Current Time: Fri Apr 26 17:22:38 GMT 2024

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

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

Back to the top