using absolute path [message #870357] |
Mon, 07 May 2012 18:43 |
Phil R 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
|
|
|
Powered by
FUDForum. Page generated in 0.02865 seconds