Re: lookup confusing me

Oliver Rettig <[email protected]> Fri, 15 Sep 2017 00:02:29 +0200
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Organization ORAT
Message-ID <5825628.tQbuQpGDCP@l560>
> The more interesting question is how to get a list of all opend files? In
> some of my apps I have implemented my own global lookup/cache to keep them.
> But maybe there is a more intelligent way.

Maybe you can get a list of all of your open TopComponents and than you can 
ask each TopComponent lookup for your DataObject.

> best regards
> Oliver
> 
> > Hi
> > 
> >    I have trouble with lookup, the below code only print out the current
> > 
> > file instead of all opened files. Lookup lookup =
> > Utilities.actionsGlobalContext();
> > 
> > Collection<? extends DataObject> list =
> > lookup.lookupAll(DataObject.class);
> > for (DataObject dataObject : list) {
> > ModuleLib.log(dataObject);
> > }
> > 
> > If i use "Lookup.getDefault().lookupAll", looupAll() even returns nothing.
> > Please help
> > 
> > Thanks
> > FromPeter