Community
Participate
Working Groups
I tried to convert the package explorer to the new JFaca API and stumbled over the following issues: I need a method to find out the tree pathes for a given element. I can implement this by iterating over all pathes, but a method like getTreePathsFor(Object element) would be helpful. More ciritical is the following behaviour: most clients (especially actions) don't assume that an element appears twice in a selection even when sent out by a tree viewer (imagine a delete action simply iterating over all elements. That action will fail when it deletes the element the second time since it appeared twice in the list). The the tree selection implementation I did for the package explorer solved the problem as follows: the tree paths reflected all elements. However the elements accessable via the structured selection only contained an element once. This ensure that no clients of the tree are broken. Can we add this behaviour to the current tree selection implementation ? I will provide a patch for this ;-)
Sure, I agree we should do this. If you can provide a patch, even better. Thanks for trying to convert the package explorer!
Boris, attached a patch against JFace [I20060117-0800] to add the requested functionality. I did some first testing and so far it looks good. The only improvement I would like to see is the following: when I create a new type in a package and the package is rendered twice in the tree then it is random in which packge the new type is selected. The reason for this is that at the end the wizard calls setSelection on the viewer simply providing a structured selection (the wizard doesn't know about how (in a tree or table) a viewer renders elements. So it can't create a TreeSelection). What I would like to see happening is that the CU is selected in the package that was selected when activating the action. The bahaviour currently exists in the package explorer as well. I didn't fix this in the past since it required overriding even more internal code. Do you think this is possible ?
Created attachment 33209 [details] The patch
Patch released >20060118. Re comment #2: Do you think the tree viewer, upon setSelection(), should look at the existing selection and try to select the element occurrence that is nearest to it, rather than the first one it finds? I'm leaving this bug open for now until we have reached consensus regarding this issue.
Boris, thanks for releasing the patch. > Re comment #2: Do you think the tree viewer, upon setSelection(), should look > at the existing selection and try to select the element occurrence that is > nearest to it, rather than the first one it finds? Yes.
The remaining issue is now tracked by bug 125708. Closing this one as fixed.
[I20060214-0800] Verfied that the patch was applied by looking at the code in the imported JFace plug-in. We should have a test for this. Filed bug 127923.