fabioz/Pydev — pull request #124 by dannyyoo (2014-05-22 22:08:05+00:00)
Title: Bug 373: ModulesManager.getAllDirectModulesStartingWith misses edge case

This patch corrects Bug 373. The bug involves an edge case in
autocompletion searches. The search can prematurely cut off
completions when the module's name includes a "z" after the search
prefix. e.g. if there's a key called "fabioz" in the module manager,
a search with the prefix "fabio" will miss it.

The patch centralizes the ModulesKey set logic by replacing raw access
to the TreeMap with an encapsulated ModulesKeyCollection, which both
contains the set of ModulesKeys and some state to accelerate searches
for prefixes. Management of this in a central class allows
ModuleManager.getAllDirectModulesStartingWith() to be implemented
efficiently.

To get access to the TreeMap's search methods in recent versions of
Java, the patch eliminates the customized PyPublicTreeMap class in
favor of the standard library's TreeMap. PyPublicTreeMap appears to
make assumptions about the on-disk structures and tries to optimize
construction of the map based on the ordering on disk. However,
because the data is being loaded as part of TreeIO, the involved disk
I/O is more likely to have greater impact than the in-memory sort of
the standard library's TreeMap.

Other minor changes: this deprecates
ModulesManager.hasPartStartingWith() since searches should go through
the ModulesKeyCollection instead. It also removes the
ModuleManager.modulesKeysLock in favor of locking the modulesKeys
object directly.

Change-Id: I0c35e5a703cb4b06679e4168aa704e59f0f14ba3