Home » Eclipse Projects » JFace » Re: create TreeItem in TreeViewer
Re: create TreeItem in TreeViewer [message #15140] |
Wed, 17 June 2009 10:56  |
Eclipse User |
|
|
|
Hi,
The question is why you think you need to access the TreeItem. The
general rule is that you should not directly access SWT-Stuff who are
controlled by a viewer.
You found out yourself why TreeViewer is not creating all TreeItems when
started => It takes a lot of time.
So if you give us some background informations we can probably show you
how to solve this.
We should move this thread to the JFace newsgroup by the way (I
corrected the header already so that your reply should go to
jface-newsgroup)
Tom
kai guo schrieb:
> Hello Everyone,
>
> I have a TreeViewer in my application, it has more than 5 levels.
> I need to access TreeItem after TreeViewer.setInput(input) called. my
> problem is, only the TreeItem of first level was created, when I call
> TreeViewer.setInput(input), other TreeItem was just created on click of
> it's parent.
>
> I then try to call TreeViewer.expandAll() and then
> TreeViewer.clopseAll(), all TreeItem was created, but it take a long
> time (3 second) to update the GUI, because the TreeViewer contains too
> much information.
>
> does someone have a idea, either create all TreeItem after setInput or
> maybe it's also possible to update GUI in background.
>
>
>
>
|
|
|
Re: create TreeItem in TreeViewer [message #15173 is a reply to message #15140] |
Wed, 17 June 2009 11:31   |
Eclipse User |
|
|
|
Hi Tom,
thanks for your replay.
in my application I have a treeviewer and a tableviewer, treeviewer shows
nodes from a xml files, it has many levels. tableviewer contains error
information about node in xml file. what I want to do is, wenn I click a
row in tableviewer, the assoccated node in xml should be selected in
treeviewer. I try to find the TreeItem and select it, but it was not
created at this time.
may be there is another way to select this TreeItem.
regard kai
Tom Schindl wrote:
> Hi,
> The question is why you think you need to access the TreeItem. The
> general rule is that you should not directly access SWT-Stuff who are
> controlled by a viewer.
> You found out yourself why TreeViewer is not creating all TreeItems when
> started => It takes a lot of time.
> So if you give us some background informations we can probably show you
> how to solve this.
> We should move this thread to the JFace newsgroup by the way (I
> corrected the header already so that your reply should go to
> jface-newsgroup)
> Tom
> kai guo schrieb:
>> Hello Everyone,
>>
>> I have a TreeViewer in my application, it has more than 5 levels.
>> I need to access TreeItem after TreeViewer.setInput(input) called. my
>> problem is, only the TreeItem of first level was created, when I call
>> TreeViewer.setInput(input), other TreeItem was just created on click of
>> it's parent.
>>
>> I then try to call TreeViewer.expandAll() and then
>> TreeViewer.clopseAll(), all TreeItem was created, but it take a long
>> time (3 second) to update the GUI, because the TreeViewer contains too
>> much information.
>>
>> does someone have a idea, either create all TreeItem after setInput or
>> maybe it's also possible to update GUI in background.
>>
>>
>>
>>
|
|
|
Re: create TreeItem in TreeViewer [message #15205 is a reply to message #15173] |
Wed, 17 June 2009 11:54   |
Eclipse User |
|
|
|
But your TableViewer and TreeViewer have the same domain object hence
you can:
1. Create a TreePath from the object if you have well designed
bidirectional relationships
2. Make the TreeViewer expand the TreePath
3. Set the selection using new TreeSelection()
Maybe 3 isn't necessary because the viewer does this by default but I'm
not sure about this at the moment.
Tom
kai guo schrieb:
> Hi Tom,
> thanks for your replay.
>
> in my application I have a treeviewer and a tableviewer, treeviewer
> shows nodes from a xml files, it has many levels. tableviewer contains
> error information about node in xml file. what I want to do is, wenn I
> click a row in tableviewer, the assoccated node in xml should be
> selected in treeviewer. I try to find the TreeItem and select it, but it
> was not created at this time.
>
> may be there is another way to select this TreeItem.
>
> regard kai
>
>
>
>
> Tom Schindl wrote:
>
>> Hi,
>
>> The question is why you think you need to access the TreeItem. The
>> general rule is that you should not directly access SWT-Stuff who are
>> controlled by a viewer.
>
>> You found out yourself why TreeViewer is not creating all TreeItems when
>> started => It takes a lot of time.
>
>> So if you give us some background informations we can probably show you
>> how to solve this.
>
>> We should move this thread to the JFace newsgroup by the way (I
>> corrected the header already so that your reply should go to
>> jface-newsgroup)
>
>> Tom
>
>> kai guo schrieb:
>>> Hello Everyone,
>>>
>>> I have a TreeViewer in my application, it has more than 5 levels.
>>> I need to access TreeItem after TreeViewer.setInput(input) called. my
>>> problem is, only the TreeItem of first level was created, when I call
>>> TreeViewer.setInput(input), other TreeItem was just created on click of
>>> it's parent.
>>>
>>> I then try to call TreeViewer.expandAll() and then
>>> TreeViewer.clopseAll(), all TreeItem was created, but it take a long
>>> time (3 second) to update the GUI, because the TreeViewer contains too
>>> much information.
>>>
>>> does someone have a idea, either create all TreeItem after setInput or
>>> maybe it's also possible to update GUI in background.
>>>
>>>
>>>
>>>
>
>
|
|
|
Re: create TreeItem in TreeViewer [message #15340 is a reply to message #15205] |
Thu, 18 June 2009 10:17  |
Eclipse User |
|
|
|
thanks Tom
it works now.
I just find the data what I need, and then use TreeViewer.setSelection(new
StructuredSelection(data)) to select the node in TreeViewer
kind regard
kai
Tom Schindl wrote:
> But your TableViewer and TreeViewer have the same domain object hence
> you can:
> 1. Create a TreePath from the object if you have well designed
> bidirectional relationships
> 2. Make the TreeViewer expand the TreePath
> 3. Set the selection using new TreeSelection()
> Maybe 3 isn't necessary because the viewer does this by default but I'm
> not sure about this at the moment.
> Tom
> kai guo schrieb:
>> Hi Tom,
>> thanks for your replay.
>>
>> in my application I have a treeviewer and a tableviewer, treeviewer
>> shows nodes from a xml files, it has many levels. tableviewer contains
>> error information about node in xml file. what I want to do is, wenn I
>> click a row in tableviewer, the assoccated node in xml should be
>> selected in treeviewer. I try to find the TreeItem and select it, but it
>> was not created at this time.
>>
>> may be there is another way to select this TreeItem.
>>
>> regard kai
>>
>>
>>
>>
>> Tom Schindl wrote:
>>
>>> Hi,
>>
>>> The question is why you think you need to access the TreeItem. The
>>> general rule is that you should not directly access SWT-Stuff who are
>>> controlled by a viewer.
>>
>>> You found out yourself why TreeViewer is not creating all TreeItems when
>>> started => It takes a lot of time.
>>
>>> So if you give us some background informations we can probably show you
>>> how to solve this.
>>
>>> We should move this thread to the JFace newsgroup by the way (I
>>> corrected the header already so that your reply should go to
>>> jface-newsgroup)
>>
>>> Tom
>>
>>> kai guo schrieb:
>>>> Hello Everyone,
>>>>
>>>> I have a TreeViewer in my application, it has more than 5 levels.
>>>> I need to access TreeItem after TreeViewer.setInput(input) called. my
>>>> problem is, only the TreeItem of first level was created, when I call
>>>> TreeViewer.setInput(input), other TreeItem was just created on click of
>>>> it's parent.
>>>>
>>>> I then try to call TreeViewer.expandAll() and then
>>>> TreeViewer.clopseAll(), all TreeItem was created, but it take a long
>>>> time (3 second) to update the GUI, because the TreeViewer contains too
>>>> much information.
>>>>
>>>> does someone have a idea, either create all TreeItem after setInput or
>>>> maybe it's also possible to update GUI in background.
>>>>
>>>>
>>>>
>>>>
>>
>>
|
|
|
Goto Forum:
Current Time: Mon Jul 14 10:24:27 EDT 2025
Powered by FUDForum. Page generated in 0.41181 seconds
|