|
Re: How to communicate between various views/models [message #498225 is a reply to message #498223] |
Mon, 16 November 2009 01:01 |
Eclipse User |
|
|
|
Originally posted by: wangqs_eclipse.yahoo.com
This is a multi-part message in MIME format.
--------------000906030201050005080105
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
For Q1 I'd suggest Observe patter. E.g. register your view to the model
as a listener. Trigger an event for the model changes. View can then
receive the event and determine if the event shall cause a refresh of
the view.
For Q2, you can write a test plugin and run it as plug-in unit test
which will run the test in the plugin environment. You can read the
article at
http://www.eclipse.org/articles/article.php?file=Article-PDE JUnitAntAutomation/index.html
Q.S. Wang
Ewan wrote:
> Hello,
>
> I have really searched through a lot of documentation before posting so
> any help would be greatly appreciated.
>
> There are two problems that I would like to solve
>
> 1) I have created some views in a plugin. However, in all of the
> examples I can find on the web all of the sample view have a mock data
> model within the actual view. In my instance I have a model that I would
> like to share between various views/preferences page. For example - I
> have a preferences page that I would like to bring up and allow the user
> to change preferences. Once preferences have been changed the view would
> change some element of its presentation.
>
> My questions is - what is the eclipse best practice for sharing a single
> data store/model between a number of views?
>
> Is the best practice to go to the workbench and look up other views by
> id? This seems a bit nasty as you have the view ids spread throughout
> the code. I really dont want to use singletons either (IoC fanatic). I
> have looked at the spring OSGI integration and using spring to inject
> beans into views. However, it looks massively complex and a bit bleeding
> edge at the moment and unfortunately I can not justify using it for this
> simple requirement I have.
>
> 2) Second question related to the first. Looking at a lot of the eclipse
> code it is completely impossible to test/run individual views outside of
> an eclipse runtime container. When developing with swing/outside of
> eclipse I prefer to make each view/panel independently runnable. This
> would be achieved by having a main in each panel which would create a
> frame, create any mocks that the panel is dependent on, create a frame
> and add. Is there any way to do this with SWT views that usually run
> within eclipse. I generally find this very difficult as all of the
> panels are heavily dependent on the runtime and too much is required to
> be mocked out.
>
> Any help on either of the questions would be appreciated.
>
> Cheers
--
http://www.myeclipsedev.com/
--------------000906030201050005080105
Content-Type: text/x-vcard; charset=utf-8;
name="wangqs_eclipse.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="wangqs_eclipse.vcf"
YmVnaW46dmNhcmQNCmVtYWlsO2ludGVybmV0Ondhbmdxc19lY2xpcHNlQHlh aG9vLmNvbQ0K
dXJsOmh0dHA6Ly93d3cubXllY2xpcHNlZGV2LmNvbQ0KdmVyc2lvbjoyLjEN CmVuZDp2Y2Fy
ZA0KDQo=
--------------000906030201050005080105--
|
|
|
|
|
Re: How to communicate between various views/models [message #501187 is a reply to message #500213] |
Tue, 01 December 2009 13:25 |
|
If you dont like Singletons (I also dont like them because they will be raped so often as simple access mechanism) you could use Services. This is a very independent and convinient way to access your Model.
Look for Eclipse RCP services, if you have more questions or need more details, just ask.
Greetz
Thomas
|
|
|
|
Powered by
FUDForum. Page generated in 0.03012 seconds