Re: Netbeans antlr
Dmitry Avtonomov <[email protected]> Sat, 16 Sep 2017 22:21:24 -0400
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <CAMMjtf-WDstVD-f9JF6SebUSUjkifH6X30cE_qT6vCXjpiwv4g@mail.gmail.com> |
--001a1146927e96f9850559594935
Content-Type: text/plain; charset="UTF-8"
Iterate through all open TopComponents, checking their actual type, then
getting the value needed should work and be the simples maybe?
Set<TopComponent> tops = TopComponent.Registry.getOpened();
for (TopComponent top : tops) {
if (top instanceof YourTopComponent) {
YourTopComponent ytc = (YourTopComponent)top;
String value = ytc.callFancyMethod();
}
}
http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/doc-files/api.html#find
Best,
Dmitry
On Sat, Sep 16, 2017 at 1:59 PM, Peter Cheung <[email protected]> wrote:
> Hi All
> Is it a good design for my netbeans antlr plugin?
> http://peter.quantr.hk/?p=2475
>
> I need to save a string/file that belong to editor, every editor store
> it own value (different values for different editor. And retrieve the
> values in other topcomponent. What is the best way to do that? Should I
> just create a static hashmap to store all these values?
>
> Thanks
> from Peter
>
>
--001a1146927e96f9850559594935
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,he=
lvetica,sans-serif">Iterate through all open TopComponents, checking their =
actual type, then getting the value needed should work and be the simples m=
aybe?<br></div><div class=3D"gmail_default" style=3D"font-family:arial,helv=
etica,sans-serif"><br></div><div class=3D"gmail_default" style=3D"font-fami=
ly:arial,helvetica,sans-serif">Set<TopComponent> tops =3D TopComponen=
t.Registry.getOpened();</div><div class=3D"gmail_default" style=3D"font-fam=
ily:arial,helvetica,sans-serif">for (TopComponent top : tops) {</div><div c=
lass=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif">=C2=
=A0 if (top instanceof YourTopComponent) {</div><div class=3D"gmail_default=
" style=3D"font-family:arial,helvetica,sans-serif">=C2=A0=C2=A0=C2=A0 YourT=
opComponent ytc =3D (YourTopComponent)top;</div><div class=3D"gmail_default=
" style=3D"font-family:arial,helvetica,sans-serif">=C2=A0=C2=A0=C2=A0 Strin=
g value =3D ytc.callFancyMethod();<br></div><div class=3D"gmail_default" st=
yle=3D"font-family:arial,helvetica,sans-serif">=C2=A0 }<br></div><div class=
=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif">}<br></=
div><div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-=
serif"><br></div><div class=3D"gmail_default" style=3D"font-family:arial,he=
lvetica,sans-serif"><a href=3D"http://bits.netbeans.org/dev/javadoc/org-ope=
nide-windows/org/openide/windows/doc-files/api.html#find">http://bits.netbe=
ans.org/dev/javadoc/org-openide-windows/org/openide/windows/doc-files/api.h=
tml#find</a><br></div><div class=3D"gmail_default" style=3D"font-family:ari=
al,helvetica,sans-serif"><br></div><div class=3D"gmail_default" style=3D"fo=
nt-family:arial,helvetica,sans-serif">Best, <br></div><div class=3D"gmail_d=
efault" style=3D"font-family:arial,helvetica,sans-serif">Dmitry<br></div></=
div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Sat, Sep 1=
6, 2017 at 1:59 PM, Peter Cheung <span dir=3D"ltr"><<a href=3D"mailto:mc=
[email protected]" target=3D"_blank">[email protected]</a>></span>=
wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr">
<div style=3D"font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color=
:rgb(0,0,0)">
<span style=3D"color:rgb(34,34,34);font-family:Arial,Helvetica,sans-serif;f=
ont-size:13px;font-style:normal;font-variant-caps:normal">Hi All
<div style=3D"color:rgb(34,34,34);font-family:Arial,Helvetica,sans-serif;fo=
nt-size:13px;font-style:normal;font-variant-caps:normal">
=C2=A0 =C2=A0 Is it a good design for my netbeans antlr plugin?
<div><a href=3D"http://peter.quantr.hk/?p=3D2475" style=3D"text-decoration:=
none;color:rgb(102,17,204)" target=3D"_blank">http://peter.quantr.hk/?p=3D2=
475</a><br>
</div>
<div><br>
</div>
<div>=C2=A0 =C2=A0I need to save a string/file that belong to editor, every=
editor store it own value (different values for different editor. And retr=
ieve the values in other topcomponent. What is the best way to do that? Sho=
uld I just create a static hashmap to store
all these values?</div>
<div><br>
</div>
<div>Thanks</div>
<div>from Peter</div>
</div>
</span><br>
</div>
</div>
</blockquote></div><br></div>
--001a1146927e96f9850559594935--