Reveal children of non-model nodes in EMF editor [message #421862] |
Fri, 15 August 2008 06:49 |
Marc Moser Messages: 66 Registered: July 2009 |
Member |
|
|
Hi,
I could use TreeViewer.reveal(...) to reveal any node in the EMF
editor, as long as all nodes had corresponding model elements. Now I
introduced some "grouping nodes" in the Editor to improve readability
and revealing of nodes doesn't work anymore if the node to be revealed
is "below" some grouping node.
As an example, let's consider the following: 3 classes A, B and C, and
A has children of type B as well as children of type C (two
containment features). Without customization, the editor would look
somehow like this:
Element A1
Element B1
Element B2
Element C1
Element C2
After some small customization, it looks like this:
Element A1
All B-Elements
Element B1
Element B2
All C-Elements
Element C1
Element C2
In both cases, the editor works fine. I can add and remove children at
the correct place (the grouping nodes) and there don't seem to be any
problems (I followed the code samples from the EMF Book first
edition). However, in the second case, if e.g. everything is collapsed
and I use TreeViewer.reveal(..) to reveal Element B1, the outcome
would incorrectly look like this:
Element A1
All B-Elements
All C-Elements
Does anyone have an idea what could be the problem and how I could fix
it?
Many thanks,
Best,
Marc
|
|
|
Re: Reveal children of non-model nodes in EMF editor [message #421867 is a reply to message #421862] |
Fri, 15 August 2008 11:01 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Marc,
Comments below.
Marc Moser wrote:
> Hi,
>
> I could use TreeViewer.reveal(...) to reveal any node in the EMF
> editor, as long as all nodes had corresponding model elements. Now I
> introduced some "grouping nodes" in the Editor to improve readability
> and revealing of nodes doesn't work anymore if the node to be revealed
> is "below" some grouping node.
>
Very view things rely on having the proper implementation of getParent
in the item providers, but revealing a node in the tree does. It has to
be able to figure out the right path the root so that Eclipse will know
the right path of things to expand in order to reach that node...
> As an example, let's consider the following: 3 classes A, B and C, and
> A has children of type B as well as children of type C (two
> containment features). Without customization, the editor would look
> somehow like this:
>
> Element A1
> Element B1
> Element B2
> Element C1
> Element C2
>
> After some small customization, it looks like this:
>
> Element A1
> All B-Elements
> Element B1
> Element B2
> All C-Elements
> Element C1
> Element C2
>
> In both cases, the editor works fine. I can add and remove children at
> the correct place (the grouping nodes) and there don't seem to be any
> problems (I followed the code samples from the EMF Book first
> edition). However, in the second case, if e.g. everything is collapsed
> and I use TreeViewer.reveal(..) to reveal Element B1, the outcome
> would incorrectly look like this:
>
> Element A1
> All B-Elements
> All C-Elements
>
So does getParent for B1 return "All B-Elements"?
> Does anyone have an idea what could be the problem and how I could fix
> it?
>
> Many thanks,
> Best,
> Marc
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03680 seconds