Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Fragments / Imports / Part Descriptors (How do you work with parts contributed by other bundles )
Fragments / Imports / Part Descriptors [message #893906] Thu, 05 July 2012 22:24 Go to next message
Joseph Carroll is currently offline Joseph CarrollFriend
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

So I am still getting a feel for the e4 application model.

Where can I find information on using fragments and part descriptors?

After browsing the 4.2 Live Model, it seems as though everything is first defined as a Part Descriptor and then placed using a placeholder. Is this the recommended approach? (I am assuming a Part Descriptor is more of a template and a Part is a concrete item, correct?)

I am able to contribute model elements to the main application using fragments, however I cannot seem to use any of the model elements contributed by one fragment in another fragment. (Even if I list the bundle as a dependency) Is there a recommended approach to accomplishing this?

I have plenty of other questions regarding the e4 model (like how to use Container Data), but I would really rather not be "that guy" who just posts any question without really looking for an answer. But, I haven't come across a detailed source of information. Even Lars' documentation (as good as it may be) is still fairly shallow when it comes to robust implementations. Any clues on where to look?

Thanks,

JD
Re: Fragments / Imports / Part Descriptors [message #894040 is a reply to message #893906] Fri, 06 July 2012 13:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Am 06.07.12 00:24, schrieb Joseph Carroll:
> So I am still getting a feel for the e4 application model.
>
> Where can I find information on using fragments and part descriptors?
>

I guess there's not much out there besides Lars' book on e4.

> After browsing the 4.2 Live Model, it seems as though everything is
> first defined as a Part Descriptor and then placed using a placeholder.
> Is this the recommended approach? (I am assuming a Part Descriptor is
> more of a template and a Part is a concrete item, correct?)

You are right - You can compare them in 3.x with IViewDescriptor and
ViewPart. If your views are visible from the beginning (and won't be
closed at all) I would not use a descriptor but insert the Part-Instance
directly.

The placeholder stuff is only necessary if you are using multiple
perspectives and you want to show the same view instance in multiple of
them.

In the Eclipse IDE you see everything referenced as a Placeholder
because you can open any view in any perspective. If this is true for
your application as well then *yes* you have to use Placeholders in case
you don't want to share views there's not need for them.

> I am able to contribute model elements to the main application using
> fragments, however I cannot seem to use any of the model elements
> contributed by one fragment in another fragment. (Even if I list the
> bundle as a dependency) Is there a recommended approach to
> accomplishing this?

Yes you need to use the imports section to insert fake elements which
are then resolved when the workbench model is created. Please leave the
plugin-dependencies in place we are mergeing in the fragements by
sorting them through their dependencies!

>
> I have plenty of other questions regarding the e4 model (like how to use
> Container Data), but I would really rather not be "that guy" who just

Container data is used by the container of the element. Currently only
SashContainer evaluates its children content to find out the ratio used
by each of them.

> posts any question without really looking for an answer. But, I haven't
> come across a detailed source of information. Even Lars' documentation
> (as good as it may be) is still fairly shallow when it comes to robust
> implementations. Any clues on where to look?
>

None beside the code and asking questions. You could naturally start
documenting them in our wiki as well.

Tom
Re: Fragments / Imports / Part Descriptors [message #894080 is a reply to message #893906] Fri, 06 July 2012 14:47 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph CarrollFriend
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

Tom-

Thanks for the reply. However, I think I am still a little lost when it comes to the fragments. I created a sample e4 application and posted it to gitHub [1], if you send me an email with your user name I'll add you as a contributor (jdsalingerjr@gmail.com) and anyone else if they would like.

My application will have multiple perspectives (workflows?) and shared views between them. So the part descriptor approach would be necessary.

In the sample, a new perspective is contributed in the plugin com.sample.fragment.perspective, and I would like to assign the placeholders to the part descriptors created in com.sample.fragment.view. However, when I go to 'Find' the reference, nothing comes up, nor will the reference be displayed when I try to import a part descriptor reference.

If you could take a look (or anyone else) and let me know where I have gone awry that would be most appreciated. Then I would be happy to start putting together documentation about this for the wiki.

One final note I just thought of... Is it bad form (possible?) to have the model fragment in com.sample.fragment.perspective depend on the fragment in com.sample.fragment.view when the code/plugin dependencies are exactly oposite (i.e. com.sample.fragment.view.SomeClass has a dependency on com.sample.fragment.perspective.UtilClass)?

Thanks,

JD

[1] github.com/jd-carroll/e4-fragment-example
Re: Fragments / Imports / Part Descriptors [message #894106 is a reply to message #893906] Fri, 06 July 2012 16:29 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph CarrollFriend
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

GOT IT!!! Very Happy

Because I am a genius, I decided that I did not need to include the extension for org.eclipse.e4.workbench.model. By including that (for both plugins), everything comes up well. Reading the documentation again, it makes more sense.

If I create documentation for the wiki, where should I submit it?

Also, if someone could comment on the dependency thing that would be great.

Thanks,

JD

ps- the github project has been updated
Re: Fragments / Imports / Part Descriptors [message #894108 is a reply to message #894106] Fri, 06 July 2012 16:40 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph CarrollFriend
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

Well I spoke too soon...

I can see/import the part descriptors in the second fragment, but when I create a new placeholder I cannot 'Find' any reference to the imported part descriptors.

Any ideas?

(project updated in github)
Re: Fragments / Imports / Part Descriptors [message #894161 is a reply to message #893906] Sat, 07 July 2012 04:41 Go to previous messageGo to next message
Joseph Carroll is currently offline Joseph CarrollFriend
Messages: 174
Registered: May 2012
Location: Milwaukee, WI
Senior Member

[SOLVED]

bugs.eclipse.org/bugs/show_bug.cgi?id=384514
Re: Fragments / Imports / Part Descriptors [message #1176912 is a reply to message #894161] Fri, 08 November 2013 16:43 Go to previous message
Ozgur Cagdas is currently offline Ozgur CagdasFriend
Messages: 29
Registered: May 2013
Junior Member
Hey Joseph,

This seems like a really good fix. I've also hit the same brick wall but unfortunately your patch is not integrated yet.

If you are still in favour of pushing this change in, can you please have a look at the ticket because seems like Sopot's awaiting for you to sign the CLA?

Regards,

Ozgur.
Previous Topic:State of using a ProgressView + ProgressRegion in E4 app
Next Topic:workbench.xmi is not written in my e4 app
Goto Forum:
  


Current Time: Thu Dec 18 18:28:03 GMT 2014

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

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