Community
Participate
Working Groups
The method SelectionDialog.setInitialSeleciton doesn't work as aspected in all JDT subclasses. The elements passed to this method should be of the same type as the elements passed to setElements. We should never use Strings because they depend on the rendering. Passing Strings currently only works for special subclasses when using special open methods which aren't public. NOTES:
moved to 'active'
PRODUCT VERSION: 130
The selection dialogs got reworked after the code review and I think this problem got addressed. Claude pls confirm and dispose PR if possible.
yes, this got addressed. setInitialSelection() takes elements and not strings.
This bug claims to be fixed, but it isn't. The 'setInitialSelections()" method DOES take an array of Objects as an argument, however, it doesn't seem to do anything with them. When I try to pop up a selection dialog populated with package fragments, I call 'setInitialSelections()' passing in an array containing a single IPackageFragment. When I debug this call, it seems the failure happens when setSelection() is called on ElementListSelectionDialog. This method calls fFilteredList.setSelection(). This method does nothing when an array of one element is passed in because fFoldedCount is zero. Thus, the selection dialog pops up with nothing in the list, and an 'A' in the filter.
setInitialSelections() can only select elements which are 'visible', specified by the filter. I assume that you haven't called setFilter() prior to setInitialSelections(), therefore you get 'A' as a default filter. If your package fragment does not start with 'A', you'll end up with an empty list and you can't select anything. If my assumption is wrong, please post the few lines the way you use the dialog.
since there's no answer, I assume it's fine to be closed.