Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Getting TreeViewer object from a CTabItem
Getting TreeViewer object from a CTabItem [message #537026] Tue, 01 June 2010 01:30 Go to next message
Chris is currently offline Chris
Messages: 2
Registered: June 2010
Junior Member
Hi all,

I have a TreeViewer that's added inside a CTabFolder here.


private void addTree(CTabItem tab) {

TreeViewer viewer = new TreeViewer(tab.getParent(), SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);

tab.setControl(viewer.getControl());
}

There are a few CTabFolder objects created, and I'd like to get the TreeViewer object that's currently active underneath that CTabFolder. Any idea how I could get this? Thank you in advance..

Re: Getting TreeViewer object from a CTabItem [message #537731 is a reply to message #537026] Thu, 03 June 2010 09:40 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2149
Registered: July 2009
Senior Member
Hi,

You could get the TreeViewer's underlying Tree control by iterating through
the CTabFolder's children (getChildren()) recursively looking for a child
with instanceof Tree. To map this Tree to its TreeViewer I think you would
need to set up a mapping in advance (eg.- treeInstance.setData(someKey,
treeViewer) at creation time). Alternatively, if each CTabFolder only has
one TreeViewer then you could just do this setData(someKey, treeViewer) on
the CTabFolder instead.

HTH,
Grant


"Chris" <christian_nugraha81@yahoo.com.sg> wrote in message
news:hu25te$cpo$1@build.eclipse.org...
> Hi all,
>
> I have a TreeViewer that's added inside a CTabFolder here.
>
>
> private void addTree(CTabItem tab) {
>
> TreeViewer viewer = new TreeViewer(tab.getParent(), SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);
>
> tab.setControl(viewer.getControl());
> }
>
> There are a few CTabFolder objects created, and I'd like to get the
TreeViewer object that's currently active underneath that CTabFolder. Any
idea how I could get this? Thank you in advance..
>
>
Re: Getting TreeViewer object from a CTabItem [message #543963 is a reply to message #537731] Thu, 01 July 2010 04:29 Go to previous message
Chris is currently offline Chris
Messages: 2
Registered: June 2010
Junior Member
Hi Grant,

Sorry for the late reply. Just got a chance to look into this again. Thanks a lot for the suggestion. Managed to get the TreeViewer selected now. =)

Cheers,

-Chris-
Previous Topic:Changing labels in TreeViewer on node expansion/collapse
Next Topic:getColumnImage implementation problem
Goto Forum:
  


Current Time: Mon Sep 01 07:24:48 EDT 2014

Powered by FUDForum. Page generated in 0.05111 seconds