Using EMF.Edit with a JFace tree viewer [message #999178] |
Fri, 11 January 2013 09:15  |
Eclipse User |
|
|
|
Hi all,
I try to display my EMF model elements in a JFace tree viewer using generated EMF and EMF.Edit packages.
Following tutorials, I believe I created all necessary objects (the tree viewer, adapter factories, content & label providers).
Connecting to CDO, I also retrieved my EObject element and set it as the tree viewer input.
But I can't get it displayed as the tree root when I launch my e4 RCP application.
Could anyone tell me what's wrong (see attached models and the tree viewer setup source) ?
Regards,
Laurent
|
|
|
Re: Using EMF.Edit with a JFace tree viewer [message #999185 is a reply to message #999178] |
Fri, 11 January 2013 09:30   |
Eclipse User |
|
|
|
Laurent,
None of Root's references are containment references so they won't be
shown as children in the tree, nor will they support child creation.
You can modify the GenFeature properties to display them as children,
but that still leaves the problem of how you create instances for the
Root to reference.
On 11/01/2013 3:15 PM, laurent Mising name wrote:
> Hi all,
>
> I try to display my EMF model elements in a JFace tree viewer using generated EMF and EMF.Edit packages.
>
> Following tutorials, I believe I created all necessary objects (the tree viewer, adapter factories, content & label providers).
> Connecting to CDO, I also retrieved my EObject element and set it as the tree viewer input.
>
> But I can't get it displayed as the tree root when I launch my e4 RCP application.
>
> Could anyone tell me what's wrong (see attached models and the tree viewer setup source) ?
>
> Regards,
>
> Laurent
|
|
|
|
Re: Using EMF.Edit with a JFace tree viewer [message #999212 is a reply to message #999206] |
Fri, 11 January 2013 10:08  |
Eclipse User |
|
|
|
Laurent,
Comments below.
On 11/01/2013 4:01 PM, laurent Mising name wrote:
> Hi Ed,
>
> I set containment to true for both references. Then I created the
> instances for the Root to reference in CDO (thanks to the CDO Sessions
> view...).
> Now it works.
> But could you please explain me two things ?
> 1- How comes that my Root element is not displayed ? Only both
> underlying Root references are shown.
That's just how JFace viewers work. They show the elements return by
the provider for that input. You can creating a new ItemProvider with
your "input" as it's only child and set that as the input...
> 2- Do I have to systematically declare references with
> containment=true ? I don't understand well this concept...
You'll need to understand it.
> In my case, does it mean that referencesServices and referencesApps
> should also have the containment property set to true to allow further
> service and application creation ?
You have to think about containment as physical nesting that induces a
tree, verses cross links that induce an arbitrary graph. So it's a
little like asking in HMTL, should I nest the content or create a link
to it? Obviously there are cases where you will want links.
>
> Many thanks for your quick answer.
|
|
|
Powered by
FUDForum. Page generated in 0.25565 seconds