Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Inserting into TableTree
Inserting into TableTree [message #447714] Thu, 16 December 2004 15:35 Go to next message
Andy Doddington is currently offline Andy DoddingtonFriend
Messages: 17
Registered: July 2009
Junior Member
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 #447755 is a reply to message #447714] Fri, 17 December 2004 14:20 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Please post a code example.

You should use TableTreeItem.setText() and TableTreeItem.setImage() OR you
should use the JFace TableTreeViewer. You should NEVER try to reference the
underlying TableItem using the ITEMID. The TableItem is created and
disposed as required by the TableTree. ITEMID is an internal implementation
detail that can change at any time It is not API.

"Andy Doddington" <andy@doddington.net> wrote in message
news:cps9v7$tt1$1@www.eclipse.org...
>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 10:19 Go to previous messageGo to next message
Liam Morley is currently offline Liam MorleyFriend
Messages: 47
Registered: July 2009
Member
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 18:07 Go to previous message
Andy Doddington is currently offline Andy DoddingtonFriend
Messages: 17
Registered: July 2009
Junior Member
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!
>>
Previous Topic:Embed the swt browser in a view
Next Topic:OLE - Word Basic object - CountBookmarks()
Goto Forum:
  


Current Time: Tue Apr 23 09:59:46 GMT 2024

Powered by FUDForum. Page generated in 0.03720 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top