lookup confusing me
Peter Cheung <[email protected]> Thu, 14 Sep 2017 16:39:22 +0000
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <MEXPR01MB0261C6F00C7675D86631D781B56F0@MEXPR01MB0261.ausprd01.prod.outlook.com> |
--_000_MEXPR01MB0261C6F00C7675D86631D781B56F0MEXPR01MB0261ausp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi
I have trouble with lookup, the below code only print out the current fi=
le instead of all opened files.
Lookup lookup =3D Utilities.actionsGlobalContext();
Collection<? extends DataObject> list =3D 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
--_000_MEXPR01MB0261C6F00C7675D86631D781B56F0MEXPR01MB0261ausp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=
n-bottom:0;} --></style>
</head>
<body dir=3D"ltr">
<div style=3D"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=3D"Apple-tab-span" style=3D"white-space:pre">Lookup lookup=
=3D Utilities.actionsGlobalContext();</span></div>
<div><br>
</div>
<div>Collection<? extends DataObject> list =3D lookup.lookupAll(DataO=
bject.class);</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"></span>for (D=
ataObject dataObject : list) {</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"></span>Module=
Lib.log(dataObject);</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"></span>}</div=
>
<div><br>
</div>
<div>If i use "<span style=3D"color: rgb(0, 0, 0); font-family: Calibr=
i, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant=
-caps: normal;">Lookup.getDefault().lookupAll", looupAll() even return=
s nothing. Please help</span></div>
<div><span style=3D"color: rgb(0, 0, 0); font-family: Calibri, Helvetica, s=
ans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal;"=
><br>
</span></div>
<div><span style=3D"color: rgb(0, 0, 0); font-family: Calibri, Helvetica, s=
ans-serif; font-size: 16px; font-style: normal; font-variant-caps: normal;"=
>Thanks</span></div>
<div>FromPeter</div>
<br>
</div>
</body>
</html>
--_000_MEXPR01MB0261C6F00C7675D86631D781B56F0MEXPR01MB0261ausp_--