Action, View and common programming style [message #453488] |
Mon, 31 July 2006 19:52 |
Eclipse User |
|
|
|
Originally posted by: dittmar.steiner.web.de
Hi,
i have a View with a ContentProvider holding the model.
And i have a declared Action that has no direct reference to the View or ContentProvider.
The following solution works fine for standalone Views, but somehow i don't like it.
Is it common style to retrieve the View, cast it to the concrete type and access some custom method to add an object to the model?
<snippet>
// create a model object
Extension extension = new Extension("sip", "12345", "<secret>");
// retrieve the standalone reference
IViewPart view = window.getActivePage().findView(ExtensionView.ID);
if (view != null) {
if (view instanceof ExtensionView) {
// cast to the concrete type
ExtensionView extensionView = (ExtensionView)view;
// add the new model object to the view through a _custom_ method
extensionView.addExtension(extension); // view will call it's ContentProvider
}
}
<end snippet>
i have know idea how to get a reference to the ContentProvider instance...
Thanks in advance
Dittmar
--
Quidquid latine dictum sit, altum sonatur.
- Whatever is said in Latin sounds profound.
|
|
|
Powered by
FUDForum. Page generated in 0.04261 seconds