Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using EMF.Edit with a JFace tree viewer(Unable to display my EObject as tree root)
Using EMF.Edit with a JFace tree viewer [message #999178] Fri, 11 January 2013 14:15 Go to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
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 14:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Using EMF.Edit with a JFace tree viewer [message #999206 is a reply to message #999185] Fri, 11 January 2013 15:01 Go to previous messageGo to next message
Laurent Le Moux is currently offline Laurent Le MouxFriend
Messages: 184
Registered: September 2011
Senior Member
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.
2- Do I have to systematically declare references with containment=true ? I don't understand well this concept... 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 ?

Many thanks for your quick answer.
Re: Using EMF.Edit with a JFace tree viewer [message #999212 is a reply to message #999206] Fri, 11 January 2013 15:08 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:No source code is available for type java.util.regex.Pattern
Next Topic:[CDO] multiple merge between branches
Goto Forum:
  


Current Time: Thu Apr 25 21:27:22 GMT 2024

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

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

Back to the top