Changing model for a TableViewer in a View [message #333490] |
Mon, 15 December 2008 15:52 |
Eclipse User |
|
|
|
Originally posted by: sean.mitchwood.com
Hi All..
I'm working on an RCP app that has a view which lists items in a
TableViewer.
The view is backed by a model which is provided as a service by OSGi
declarative services, and so typically it may or may not available.
My problem is that when the model turns up in my ServiceTracker, and I
call setInput(model) and then refresh() on the TableViewer, my View does
not refresh itself.
In the ContentProvider I can see that inputChanged() is being called,
but not getElements().
I'm not sure if I've approached this the right way, but it's certainly
not working as I expected.
Anyone have any insight on this problem?
Cheers,
Sean
|
|
|
|
Re: Changing model for a TableViewer in a View [message #333524 is a reply to message #333507] |
Tue, 16 December 2008 14:20 |
Eclipse User |
|
|
|
Originally posted by: sean.mitchwood.com
Francois Fernandes wrote:
> did you call the setInput(model) and refresh on the SWT Event thread
> using Display.asyncExec? Maybe this could solve the problem...
Thanks, I did, still no luck, although it did get me past the thread
access exception I didn't realise I was having. I hate how all these
exceptions are quietly hidden away... is there any way in the PDE to
make exceptions a little more noticeable?
Cheers,
Sean
|
|
|
|
Re: Changing model for a TableViewer in a View [message #333535 is a reply to message #333526] |
Wed, 17 December 2008 03:37 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Store the input object in Vector or ArrayList. Then set the vector/arraylist as input. Check for the instanceof of the input element in getElements method as in the following code. Make sure that the methods in label provider also checks for instanceof input element.
public Object[] getElements(Object inputElement) {
ArrayList<Object> objList = new ArrayList<Object>();
if (inputElement instanceof Vector) {
objList.addAll((Vector) inputElement);
}
return objList.toArray();
}
~Prasanna
|
|
|
Re: Changing model for a TableViewer in a View [message #333537 is a reply to message #333526] |
Wed, 17 December 2008 03:39 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Hi,
Store the input object in Vector or ArrayList. Then set the vector/arraylist as input. Check for the instanceof of the input element in getElements method as in the following code.
public Object[] getElements(Object inputElement) {
ArrayList<Object> objList = new ArrayList<Object>();
if (inputElement instanceof Vector) {
objList.addAll((Vector) inputElement);
}
return objList.toArray();
}
Make sure that the methods in label provider also checks for instanceof of the input element.
~Prasanna
|
|
|
Re: Changing model for a TableViewer in a View [message #333539 is a reply to message #333526] |
Wed, 17 December 2008 03:40 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Hi,
Store the input object in Vector or ArrayList. Then set the vector/arraylist as input. Check for the instanceof of the input element in getElements method as in the following code.
public Object[] getElements(Object inputElement) {
ArrayList<Object> objList = new ArrayList<Object>();
if (inputElement instanceof Vector) {
objList.addAll((Vector) inputElement);
}
return objList.toArray();
}
Make sure that the methods in label provider also checks for instanceof of the input element.
~Prasanna
|
|
|
Re: Changing model for a TableViewer in a View [message #333540 is a reply to message #333524] |
Wed, 17 December 2008 03:41 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Hi,
Store the input object in Vector or ArrayList. Then set the vector/arraylist as input. Check for the instanceof of the input element in getElements method as in the following code.
public Object[] getElements(Object inputElement) {
ArrayList<Object> objList = new ArrayList<Object>();
if (inputElement instanceof Vector) {
objList.addAll((Vector) inputElement);
}
return objList.toArray();
}
Make sure that the methods in label provider class also checks for instanceof of the input element before retrieveing the data.
~Prasanna
|
|
|
|
Re: Changing model for a TableViewer in a View [message #333582 is a reply to message #333546] |
Wed, 17 December 2008 21:31 |
Eclipse User |
|
|
|
Originally posted by: sean.mitchwood.com
Prasanna wrote:
> I am sorry for the repeated replies. I noticed that the server threw exception on replies, hence I tried posting the messages repeatedly.
Yeah man, no problem.
Thanks to all of you on this thread for your help... between your
various bits of advice I have it working now.
Arawak
|
|
|
|
Powered by
FUDForum. Page generated in 0.04295 seconds