Hi, i have problem with scope. I must to filter references in projects becasue i have ref to all that i need and some no name references. I try with SimpleRoleScope and Filtering.
Exactly is probelm how to implements scopes for my project, i see explanation on jb site but when i code like there, mps is filtering all ref and i want only this no name to filter. I send you my implemetation .
You get the "no name" entries in the completion menu, because you have nodes with no name in the SystemModel.domainModel collection. To filter these out from the scope, add a FilteringScope around the Scope that you are currently creating and in the isExcluded() method test for "node.name.isEmpty()".
Sorry for interrupiton, if you can to help me with this its very important to me that is my project for my studies and i dont have idea how to implement correct.
Thanks for answer, i understand that but i dont know how to create this anonymous subclass, i send you my implementation and if i am on track told me where is my errors.
return new FilteringScope(SimpleRoleScope.forNamedElements(referenceNode.ancestor<concept = SystemModel>, link/SystemModel : domainModel/)) { @Override public boolean isExcluded(node<StateRef> refNode) { refNode.name.isEmpty(); } };
Yes, you are on the right track. What exactly is the problem? Can you share your scope resolution code?
Exactly is probelm how to implements scopes for my project, i see explanation on jb site but when i code like there, mps is filtering all ref and i want only this no name to filter. I send you my implemetation .
You get the "no name" entries in the completion menu, because you have nodes with no name in the SystemModel.domainModel collection. To filter these out from the scope, add a FilteringScope around the Scope that you are currently creating and in the isExcluded() method test for "node.name.isEmpty()".
Vaclav
Thanks for your answers, I haven`t idea how to implements that. I send you my implementation and if you can to fix my errors.
link {stateRef}
referent set handler <none>
scope (referenceNode, contextNode, containmentLink, position, linkTarget)->Scope {
SimpleRoleScope.forNamedElements(referenceNode.ancestor<concept = SystemModel>, link/SystemModel : domainModel/);
FilteringScope myfilter = myfilter.isExcluded(referenceNode.name.isEmpty());
}
<no presentation (deprecated)>
Sorry for interrupiton, if you can to help me with this its very important to me that is my project for my studies and i dont have idea how to implement correct.
You need to create an anonymous subclass of FilteringScope and implement the isExcluded method in that anonymous subclass as Vaclav says.
Thanks for answer, i understand that but i dont know how to create this anonymous subclass, i send you my implementation and if i am on track told me where is my errors.
return new FilteringScope(SimpleRoleScope.forNamedElements(referenceNode.ancestor<concept = SystemModel>, link/SystemModel : domainModel/)) {
@Override
public boolean isExcluded(node<StateRef> refNode) {
refNode.name.isEmpty();
}
};
This looks almost correct to me, I would only do two small changes:
What result do you get with this code?
Thanks for answer, result is that filter everything in scope. I trying to solve and if you have any idea how to solve i am glad to see that.