Inserting into TableTree [message #447714] |
Thu, 16 December 2004 10:35  |
Eclipse User |
|
|
|
I am trying to insert 'child' content into a TableTree and have tried a
number of approaches, but with limited success.
My first attempt was to modify the underlying model and to cause these
changes to be visible from my ContentProvider. However, this did not have
any affect and I was unable to force the view to update in any way.
My second approach (which is in addition to the first) is to create a new
TableTreeItem, which then implicitly refers to the new content (i.e. I
don't explicitly fill in the 'data' member of the new item), although this
seems to get filled in subsequently by the framework.
My problem is twofold: first it doesn't work (see later); second, it
requires me to access the ITEMID data value within the TreeItem which
refers to the TableTreeItem (which I need to instantiate the new
TableTreeItem).
wrt the 'not working' issue: it works the FIRST time I try it and the
content looks fine when I expand the parent tree node which contains my
newly created children. However, all subsequent operations appear to
create a TableTreeItem but then fail to connect the item through to the
underlying data model.
Any suggestions would be most appreciated!
|
|
|
|
Re: Inserting into TableTree [message #447861 is a reply to message #447714] |
Mon, 20 December 2004 05:19   |
Eclipse User |
|
|
|
I was going to suggest editing the underlying model, but you say you've
already tried that. Did you call viewer.refresh after adding an object?
Try calling viewer.refresh(parent) where parent is the new parent of the
object you're inserting (eg, ContentProvider.getChildren(parent) returns
something different than it did before). If this isn't working, I'd
focus on debugging why- using a JFace viewer while editing the SWT
control can get pretty buggy.
Andy Doddington wrote:
> I am trying to insert 'child' content into a TableTree and have tried a
> number of approaches, but with limited success.
>
> My first attempt was to modify the underlying model and to cause these
> changes to be visible from my ContentProvider. However, this did not
> have any affect and I was unable to force the view to update in any way.
>
> My second approach (which is in addition to the first) is to create a
> new TableTreeItem, which then implicitly refers to the new content (i.e.
> I don't explicitly fill in the 'data' member of the new item), although
> this seems to get filled in subsequently by the framework.
>
> My problem is twofold: first it doesn't work (see later); second, it
> requires me to access the ITEMID data value within the TreeItem which
> refers to the TableTreeItem (which I need to instantiate the new
> TableTreeItem).
>
> wrt the 'not working' issue: it works the FIRST time I try it and the
> content looks fine when I expand the parent tree node which contains my
> newly created children. However, all subsequent operations appear to
> create a TableTreeItem but then fail to connect the item through to the
> underlying data model.
>
> Any suggestions would be most appreciated!
>
--
Liam Morley
Computer Science Undergraduate
Worcester Polytechnic Institute
|
|
|
Re: Inserting into TableTree [message #447875 is a reply to message #447861] |
Mon, 20 December 2004 13:07  |
Eclipse User |
|
|
|
AD wrote:
Many thanks for your help (Veronika too) - it turns out it was a bug in my
code, whereby I wasn't updating then entire model tree hierarchy
correctly. I have fixed this and it now seems to be working.
Thanks once again - it's support like this that keeps the whole thing
flowing!
Cheers!
Liam Morley wrote:
> I was going to suggest editing the underlying model, but you say you've
> already tried that. Did you call viewer.refresh after adding an object?
> Try calling viewer.refresh(parent) where parent is the new parent of the
> object you're inserting (eg, ContentProvider.getChildren(parent) returns
> something different than it did before). If this isn't working, I'd
> focus on debugging why- using a JFace viewer while editing the SWT
> control can get pretty buggy.
> Andy Doddington wrote:
>> I am trying to insert 'child' content into a TableTree and have tried a
>> number of approaches, but with limited success.
>>
>> My first attempt was to modify the underlying model and to cause these
>> changes to be visible from my ContentProvider. However, this did not
>> have any affect and I was unable to force the view to update in any way.
>>
>> My second approach (which is in addition to the first) is to create a
>> new TableTreeItem, which then implicitly refers to the new content (i.e.
>> I don't explicitly fill in the 'data' member of the new item), although
>> this seems to get filled in subsequently by the framework.
>>
>> My problem is twofold: first it doesn't work (see later); second, it
>> requires me to access the ITEMID data value within the TreeItem which
>> refers to the TableTreeItem (which I need to instantiate the new
>> TableTreeItem).
>>
>> wrt the 'not working' issue: it works the FIRST time I try it and the
>> content looks fine when I expand the parent tree node which contains my
>> newly created children. However, all subsequent operations appear to
>> create a TableTreeItem but then fail to connect the item through to the
>> underlying data model.
>>
>> Any suggestions would be most appreciated!
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03479 seconds