|
Re: Unable to link cross-referenced entities across grammars [message #646806 is a reply to message #646805] |
Fri, 31 December 2010 12:56 |
|
Hi,
This has nothing todo with importiung or not importing the ecore. it is how Elements are referenced in Xtext / how the Scopting is done. Your Department has no Name Attribute and thereby no QualifiedName and is not exported to global scope.
Bind a IQualifiedNameProvider to give your Departments a name.
/*
* generated by Xtext
*/
package org.xtext.example.departmentdsl;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.xtext.example.departmentdsl.scoping.DepartmentQNP;
/**
* Use this class to register components to be used at runtime / without the Equinox extension registry.
*/
public class DepartmentDslRuntimeModule extends org.xtext.example.departmentdsl.AbstractDepartmentDslRuntimeModule {
@Override
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return DepartmentQNP.class;
}
}
package org.xtext.example.departmentdsl.scoping;
import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider;
import department.Department;
public class DepartmentQNP extends DefaultDeclarativeQualifiedNameProvider {
public String qualifiedName(Department department) {
return department.getDescription().getName();
}
}
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.04778 seconds