Re: Lookups and positions
Steven Yi <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CANtcCs5nO7Mq1zwFLUk7gN3Vo1AkgwScXT-XT7qeYvDepFdT1Q@mail.gmail.com> |
I tried the Github project but it did not build/run for me
out-of-the-box. (I think it depended upon a RELEASE version of the NB
libs or something like that.) However, for ordered lookup, I've used
code like this before:
FileObject files[] = FileUtil.getConfigFile(
folder).getChildren();
List<FileObject> orderedFiles = FileUtil.getOrder(
Arrays.asList(files), true);
This uses a lower-level approach to get the FileObjects for the
folder, then uses the getOrder() method to order the files. From
there, my code is doing lazy loading, so it may not be appropriate for
what you are doing, but in the end a call to:
FileUtil.getConfigObject(fo)
is used to get an instance of the class.
One thing I'm not sure about: does lookupAll() provide any guarantees
on ordering? Javadocs
(http://bits.netbeans.org/8.1/javadoc/org-openide-util-lookup/) don't
seem to imply any ordering. I also seem to remember running into
ordering many years ago and switched to using the above kind of code,
but I don't remember exactly the details.
Hope that helps!
steven
On Mon, Mar 28, 2016 at 2:51 PM, Javier Ortiz <[email protected]> wrote:
> There you go: https://github.com/javydreamercsw/lookupissue.git