CheckboxTreeViewer - correct CellEditor and Checkbox only at root elements? [message #23875] |
Fri, 24 July 2009 06:50  |
Eclipse User |
|
|
|
Hi everyone,
I am confused about the API of a CheckboxTreeViewer (Galileo Release).
The Javadoc for setCellEditors says:
"Since 3.3, an alternative API is available, see ViewerColumn.setEditingSupport(EditingSupport) for a more flexible way of editing values in a column viewer."
But the class TreeColumn doesn't seem to have the API mentioned.
Also the snippet in [1] refers to a TableViewer, not to a TreeViewer.
So what is the correct way of using cell editors here?
Still using setCellEditors, setColumnProperties, and setCellModifier?
And I am wondering if it is possible to have checkboxes only for root elements?
Right now, all elements in the tree have a checkbox attached.
Best regards
Patrick
[1] http://wiki.eclipse.org/JFaceSnippets#Snippet034CellEditorPe rRowNewAPI
|
|
|
Re: CheckboxTreeViewer - correct CellEditor and Checkbox only at root elements? [message #23994 is a reply to message #23875] |
Fri, 24 July 2009 10:44   |
Eclipse User |
|
|
|
Hi again,
A follow-up question about checkboxes - I am not sure how to handle them:
If I use a cell editor to modify some data and call viewer.refresh(), all the checkbox states are gone, i.e. all items are unchecked again.
The workaround I see here is to manually iterate over all items again and set the checkbox state for each item.
Furthermore, after a refresh the entire tree is collapsed again.
Is there a trick how I can easily restore the state (collapsed/expanded items and the checkbox state) after a refresh?
Best regards
Patrick
On 24-07-2009 12:50, Patrick Könemann wrote:
> Hi everyone,
>
> I am confused about the API of a CheckboxTreeViewer (Galileo Release).
> The Javadoc for setCellEditors says:
> "Since 3.3, an alternative API is available, see
> ViewerColumn.setEditingSupport(EditingSupport) for a more flexible way
> of editing values in a column viewer."
>
> But the class TreeColumn doesn't seem to have the API mentioned.
> Also the snippet in [1] refers to a TableViewer, not to a TreeViewer.
> So what is the correct way of using cell editors here?
> Still using setCellEditors, setColumnProperties, and setCellModifier?
>
>
> And I am wondering if it is possible to have checkboxes only for root
> elements?
> Right now, all elements in the tree have a checkbox attached.
>
>
> Best regards
> Patrick
>
>
> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet034CellEditorPe rRowNewAPI
|
|
|
|
|
Re: CheckboxTreeViewer - correct CellEditor and Checkbox only at root elements? [message #372841 is a reply to message #23994] |
Wed, 29 July 2009 07:11  |
Eclipse User |
|
|
|
Strange... I don't know what happened, but I cannot reproduce that behavior.
Now a refresh doesn't destroy the state of the tree any more :-D
Patrick
On 24-07-2009 16:44, Patrick Könemann wrote:
> Hi again,
>
> A follow-up question about checkboxes - I am not sure how to handle them:
> If I use a cell editor to modify some data and call viewer.refresh(),
> all the checkbox states are gone, i.e. all items are unchecked again.
> The workaround I see here is to manually iterate over all items again
> and set the checkbox state for each item.
>
> Furthermore, after a refresh the entire tree is collapsed again.
> Is there a trick how I can easily restore the state (collapsed/expanded
> items and the checkbox state) after a refresh?
>
> Best regards
> Patrick
|
|
|
Powered by
FUDForum. Page generated in 0.07010 seconds