|
Re: TreeViewer expansion [message #504930 is a reply to message #502010] |
Wed, 23 December 2009 15:06 |
Eclipse User |
|
|
|
Originally posted by: eclipse.ahoegger.ch
Hope it helps
viewer.setExpandedState(selectedNode,!viewer.getExpandedStat e(selectedNode))
BR Andreas
Craig Noah wrote:
> I have a TreeViewer that currently expands and collapses only when a
> user clicks on the plus sign. We want to expand the level when the user
> clicks on the label text. I have created an action that extends Action
> and implements IDoubleClickListener. The doubleClick(DoubleClickEvent
> event) method is:
>
> TreeViewer viewer = (TreeViewer) event.getViewer();
> ISelection selection = event.getSelection();
> viewer.expandToLevel (selection, 1);
> viewer.refresh();
>
> I have tried all 4 versions of the viewer.refresh():
> viewer.refresh()
> viewer.refresh (false)
> viewer.refresh (selection)
> viewer.refresh (selection, false)
>
> None of them have worked for me. Depending on the refresh call used,
> either nothing happens, or the deep version of the element gets selected.
>
> What I mean by "deep version" is this: we have a tree similar to the
> following structure:
>
>
> + - Test Data
> | |
> | + - data
> | |
> | + - Category 1
> | + - Category 2
> | + - Category 3
> |
> + - C:\
> |
> + - app_home
> |
> + - common
> + - test
> |
> + - data
> |
> + - Category 1
> + - Category 2
> + - Category 3
>
>
>
> The "Test Data" element is a shortcut (link, pointer) to the "test"
> element within the C:\ tree. Start with the top two elements
> collapsed. Expand the "Test Data" element, then double-click on the
> data element. The data element inside the C:\app_home tree gets
> selected and all the parent elements are expanded to show this element.
> This is the "deep selection" or "deep version" that I get with the call
> to viewer.refresh().
>
> The Package Explorer in Eclipse correctly expands and contracts a
> package to show or hide the package elements when I double-click on the
> package name. I want that behavior in my TreeViewer. Any ideas how to
> make that happen?
>
> Sincerely,
> Craig
|
|
|
Powered by
FUDForum. Page generated in 0.04168 seconds