find elements by type and by name [message #1603922] |
Fri, 06 February 2015 14:01 |
|
Hello everybody,
I'm working on a textual editor with completion to edit UML Reference, so I need to find all possible NamedElement whose the name starts with the string typed by the user (beginning of the name or qualified name) and matching the type of the edited EReference.
I would like to avoid to cross all the model and the associated resource to find them.
Do you have some ideas?
FYI, In Papyrus, we already have such methods, with the classes
org.eclipse.papyrus.uml.tools.utils.NameResolutionUtils and
org.eclipse.papyrus.uml.tools.utils.NameResolutionHelper
but the first one don't have cache, it crosses the model each time and the second one has a cache, but it is build on the first call, and never updated.
Regards,
/Vincent Lorenzo
|
|
|
Re: find elements by type and by name [message #1603934 is a reply to message #1603922] |
Fri, 06 February 2015 14:14 |
|
Hi, Vincent,
Papyrus has a model indexing facility that could be useful for such a
purpose. Have a look at the WorkspaceModelIndex class in the
oep.infra.emf plug-in. Currently it is used to build an index of
decorator models (externalized profile applications), cross-referencing
the user-model packages to which they apply profiles. Another use case
such as indexing names would be useful to further exercise this index.
HTH,
Christian
On 2015-02-06 14:01:03 +0000, vincent lorenzo said:
> Hello everybody, I'm working on a textual editor with completion
> to edit UML Reference, so I need to find all possible NamedElement
> whose the name starts with the string typed by the user (beginning of
> the name or qualified name) and matching the type of the edited
> EReference.
>
> I would like to avoid to cross all the model and the associated
> resource to find them.
> Do you have some ideas?
> FYI, In Papyrus, we already have such methods, with the classes
> org.eclipse.papyrus.uml.tools.utils.NameResolutionUtils and
> org.eclipse.papyrus.uml.tools.utils.NameResolutionHelper
>
> but the first one don't have cache, it crosses the model each time and
> the second one has a cache, but it is build on the first call, and
> never updated.
>
> Regards, /Vincent Lorenzo
|
|
|
Powered by
FUDForum. Page generated in 0.03241 seconds