I have 2 simple languages. One defines tables with fields, and in the other one i define which tables and fields are being used like this :
Language A:
model hello1-1.0.0 {
table newTable {
field field1
field field11
}
table newTable2 {
field field2
}
}
Language B:
model2 hello2-1.0.0 !
import hello1-1.0.0
used-tables {
newUsedTable is using hello1-1.0.0.newTable {
//what works :
hello1-1.0.0.newTable.field1
//What i want :
field1
}
}
How can I remove the hierarchy from the name when i am using a certain table's fields? i have implemented a ScopeProvider, when i use the eclipse runtime and do a Ctrl+Space i get the right name (field1) but once i select it, it gives me an error with : "Could not resolve reference."
In the grammar i have defined the reference like :
UsedField:
referenced=[model::Field|FIELD_FQN];
FIELD_FQN:
CTXT_FQN'.'ID'.'ID;
I have tried to remove the FIELD_FQN and leave just the reference, i have also tried to just put ID instead of it, and it still can not find the reference.
I have tried to implement a ValueConverter for the terminal, but it still does not work.
I have also tried to implement a qualifiedNameProvider with teh following code :
List<INode> nodes = NodeModelUtils.findNodesForFeature(((UsedField)obj).getReferenced(), MyDslPackage.Literals.FIELD__NAME);
return QualifiedName.create(nodes.get(0).getText());
// return QualifiedName.create((((UsedField)obj).getReferenced().getName());
and the list of nodes is empty.
I have attached a zip with the code.