Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Delete
Delete [message #1736501] Wed, 29 June 2016 20:44 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Please delete

[Updated on: Thu, 30 June 2016 01:01]

Report message to a moderator

Re: Model element sort in a tree [message #1736525 is a reply to message #1736501] Thu, 30 June 2016 08:12 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think that you are mistaken in thinking that EMF is doing anything
very clever or helpful.

EMF collections are all lists, so what you see is 'chronological'
addition order.

In the case of your example for which you provide no models, I suspect
that typeA/typeB/typeC are in different child features that are shown
in, I think, metamodel feature order, ie. inheritance+chronological
order wrt the metamodel edit session..

If the order is important to you, you should make it part of your
design, rather than relying on accidental EMF functionality.

For graphics, the order is often irrelevant, so you might prefer to
define your collections as not-ordered, deferring imposition of order
until some save / transformation activity benefits from repeatability.

Regards

Ed Willink

On 29/06/2016 21:44, Alex Kravets wrote:
> I have EMF model that roughly looks like this:
>
> root
> --- typeA.1
> --- typeA.2
> --- typeB.1
> --- typeC.1
> --- typeC.2
> --- typeC.3
>
> if I were to add another element of typeA.3, it would be positioned
> between typeA.2 and typeB.1 - this is out of the box behavior that EMF
> generated editor offers and it's correct. How is the correct order
> kept when I am adding new element?
>
> The reason I am asking is that I am writing a Graphiti editor that
> graphically represents my model differently. Right now when I add new
> element typeA.3, as in the example above, it would be positioned below
> typeC.3, which is not correct ordering of the elements (according to
> EMF model). I can add comparator to the List that is used by Graphiti
> to layout the components, but I rather if possible reuse mechanism by
> which TreeViewer in EMF keeps elements sorted correctly.
>
> Thanks,
> Alex
Re: Model element sort in a tree [message #1736613 is a reply to message #1736525] Thu, 30 June 2016 14:59 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Thanks Ed,

I deleted the post because I realized that I was relying on Graphiti's List to display children whereas I should've been using EMF's List that has correct order and using that to display graphical parts. So this issue had to do with my particular case and not with EMF.
Previous Topic:Invalid thread access while updating UI
Next Topic:Managing dependencies between EMF resources.
Goto Forum:
  


Current Time: Fri Apr 26 01:26:16 GMT 2024

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

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

Back to the top