Re: lookup confusing me
Geertjan Wielenga <[email protected]> Thu, 14 Sep 2017 18:44:24 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-5B0E269F-FEB3-47C3-AE16-070942DD750F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable leanpub.com/nbp4beginners Gj Sent from my iPhone > On 14 Sep 2017, at 18:39, Peter Cheung <[email protected]> wrote: >=20 > Hi > I have trouble with lookup, the below code only print out the current f= ile instead of all opened files. > Lookup lookup =3D Utilities.actionsGlobalContext(); >=20 > Collection<? extends DataObject> list =3D lookup.lookupAll(DataObject.clas= s); > for (DataObject dataObject : list) { > ModuleLib.log(dataObject); > } >=20 > If i use "Lookup.getDefault().lookupAll", looupAll() even returns nothing.= Please help >=20 > Thanks > FromPeter >=20 --Apple-Mail-5B0E269F-FEB3-47C3-AE16-070942DD750F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit <html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><a href="http://leanpub.com/nbp4beginners">leanpub.com/nbp4beginners</a></div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Gj<br><br>Sent from my iPhone</div><div><br>On 14 Sep 2017, at 18:39, Peter Cheung <<a href="mailto:[email protected]">[email protected]</a>> wrote:<br><br></div><blockquote type="cite"><div> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> <div>Hi</div> <div> I have trouble with lookup, the below code only print out the current file instead of all opened files.</div> <div><span class="Apple-tab-span" style="white-space:pre">Lookup lookup = Utilities.actionsGlobalContext();</span></div> <div><br> </div> <div>Collection<? extends DataObject> list = lookup.lookupAll(DataObject.class);</div> <div><span class="Apple-tab-span" style="white-space:pre"></span>for (DataObject dataObject : list) {</div> <div><span class="Apple-tab-span" style="white-space:pre"></span>ModuleLib.log(dataObject);</div> <div><span class="Apple-tab-span" style="white-space:pre"></span>}</div> <div><br> </div> <div>If i use "<span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal;">Lookup.getDefault().lookupAll", looupAll() even returns nothing. Please help</span></div> <div><span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal;"><br> </span></div> <div><span style="color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal;">Thanks</span></div> <div>FromPeter</div> <br> </div> </div></blockquote></body></html> --Apple-Mail-5B0E269F-FEB3-47C3-AE16-070942DD750F--