Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » find elements by type and by name
find elements by type and by name [message #1603922] Fri, 06 February 2015 14:01 Go to next message
vincent lorenzo is currently offline vincent lorenzoFriend
Messages: 82
Registered: June 2010
Location: Paris Saclay, France
Member
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 Go to previous message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1162
Registered: July 2009
Location: Canada
Senior Member

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
Previous Topic:Classifier.getInheritedMembers() method vs UML inheritance semantics
Next Topic: Problem to load Rose model
Goto Forum:
  


Current Time: Wed Jan 17 05:42:48 GMT 2018

Powered by FUDForum. Page generated in 0.01841 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software