Applying MVC with the DI framework [message #1696522] |
Wed, 27 May 2015 01:14 |
Eclipse User |
|
|
|
Hi
This is a beginner RCP question and perhaps I have given it a misleading title from not knowing enough about RCP.
Having started on a RCP client, I am having difficulty understanding how to fit the communications between the UI components and the controlling logic to MVC principles.
Currently in my UI a user clicks on a button in a Part, which instantiates a class that performs some logic and returns data .......ugh . The Part then uses IEventBroker to send this to another Part for display. This works but does not fit MVC principles.
I want to move the logic that acts on the button click and generates the data to a singleton Controller class, but it seems to me this will obviously be outside the DI framework and so does not have access to IEventBroker.
One solution seems to be to have the Activator inject IEclipseContext into the singleton Controller class and then that class can get IEventBroker.
However, this seems to require the Activator to set a Logger class in IEclipseContext, which is not API and flagged as discouraged access.
The above seems to me a simple and common Use Case of RCP. What is Best Practice?
Thank you very much!
|
|
|
Powered by
FUDForum. Page generated in 0.06873 seconds