Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Accessing ESelectionService From a Dialog
Accessing ESelectionService From a Dialog [message #1752921] Mon, 30 January 2017 17:37 Go to next message
Gabe Colburn is currently offline Gabe ColburnFriend
Messages: 17
Registered: December 2012
Junior Member
In my application I've created reusable Parts, that require access to the ESelectionService. When I use the Eclipse 4 framework to activate and show the parts the selection service is injected as expected.

The design issue I'm trying to figure out is if I embed a part (say Part 2) within a dialog (which gets launched from another part (say Part 1), what is the best method to get the selection service to the embedded part since it is not injected?

To make this more clear:
Part 1 Displayed Using E4 Framework-> User selects a button displaying Dialog 1 -> Part 2 is embedded in Dialog 1 by manually calling createControls.

It doesn't feel correct to pass the injected ESelectionService in Part 1 as a parameter to Dialog 1, and then set as a parameter in Part 2, which was embedded in Dialog 1.

I'm trying to allow Part 2 to be used as either a standalone Part, that has the ESelectionService automatically injected, or to be embedded in other Parts/Dialogs via createControls.

I'd would appreciate any thoughts on how to go about this without passing the ESelectionService through a hierarchy of Parts/Dialogs when I embed a Part within another Part or Dialog.

Thanks!
Re: Accessing ESelectionService From a Dialog [message #1752985 is a reply to message #1752921] Tue, 31 January 2017 17:08 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 655
Registered: January 2012
Senior Member

It's pretty rare to have a dialog either participate in the selection or provide a selection.

But you can create and populate your own IEclipseContext, either from scratch (EclipseContextFactory and then explicitly set the needed values) or create a child context from some other known context (e.g., the parent window's context via IEclipseContext#createChild()).

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:Application damaged on Mac OS X
Next Topic:Why is CompatibilityPart eating my PartInitException ?
Goto Forum:
  


Current Time: Tue Sep 26 11:11:22 GMT 2017

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

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