Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dtp-dev] BZ150592: Unable to Sort Generic Folders on DSE (API Proposal)

Hi all...

It's taken a bit of digging to figure this sorting bug out (BZ150592:
Unable to Sort Generic Folders on DSE) and I appreciate Anthos' patience.

Here's what I found out from the Eclipse Platform folks about the 3.2
Navigator famework's sorting mechanism:

"The sorting algorithm checks for the source of a given element; if the
source of two elements is the same, then the contributing extension gets to
order them
(extension A contributes a, a', a'', ... then A's sorter is used to sort
them), and uses the relative priority of the contributing extensions of two
elements
if they originated from different extensions (so extension A adds a,
extension B adds b, then a and b are sorted based on the order of the
priorities of A and
B). If the priorities match, then the elements are sorted alphabetically by
their labels.

If the elements were viewer.add()ed to the tree, then the framework has no
notion of source (it doesn't know what extension added them), so the
"source"
is determined from the possibleChildren expressions, taking the highest
priority extension it finds that declares it might have contributed an
element like the current one."

Since we anticipate many different contributions to the DSE in the form of
navigator content extensions, and we want those contributions to be
consistently sorted when presented in the DSE, we need a slightly different
solution to this problem.

What I propose is this... We override the default sorter in the DSE (which
extends the CommonNavigator) to use our own custom sorter. We'll call it:

      org.eclipse.datatools.connectivity.ui.dse.DSESorter.java

This sorter will use the label provider for the view, which gets its labels
from the various content extensions to the navigator. The sorter will use
the ICU code to get a locale-specific collator and sort the entries
appropriately.

I have tested this locally and it is a simple solution to this problem.

Does anyone see any issues with sorting everything in the DSE consistently?
The only issue I can possibly see is where someone wants to override the
sort order to do something other than a basic alphabetical sort. This
simple solution to override the default sorter will not allow that sort of
custom sorting to occur.

Thanks in advance!
--Fitz

Brian Fitzpatrick
Senior Software Engineer
Sybase, Inc./DTP Connectivity Committer



Back to the top