Re: Netbeans antlr

Peter Cheung <[email protected]> Sun, 17 Sep 2017 16:52:22 +0000
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <ME1PR01MB02602806B7C64473F5A0EE73B5620@ME1PR01MB0260.ausprd01.prod.outlook.com>
--_000_ME1PR01MB02602806B7C64473F5A0EE73B5620ME1PR01MB0260ausp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Thanks Dmitry
________________________________
From: Dmitry Avtonomov <[email protected]>
Sent: Sunday, September 17, 2017 10:21 AM
To: [email protected]
Subject: [platform-dev] Re: Netbeans antlr

Iterate through all open TopComponents, checking their actual type, then ge=
tting the value needed should work and be the simples maybe?

Set<TopComponent> tops =3D TopComponent.Registry.getOpened();
for (TopComponent top : tops) {
  if (top instanceof YourTopComponent) {
    YourTopComponent ytc =3D (YourTopComponent)top;
    String value =3D ytc.callFancyMethod();
  }
}

http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/window=
s/doc-files/api.html#find

Best,
Dmitry

On Sat, Sep 16, 2017 at 1:59 PM, Peter Cheung <[email protected]<mailto=
:[email protected]>> wrote:
Hi All
    Is it a good design for my netbeans antlr plugin?
http://peter.quantr.hk/?p=3D2475

   I need to save a string/file that belong to editor, every editor store i=
t 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 crea=
te a static hashmap to store all these values?

Thanks
from Peter



--_000_ME1PR01MB02602806B7C64473F5A0EE73B5620ME1PR01MB0260ausp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
</head>
<body>
<style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=
n-bottom:0;} --></style>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Thanks Dmitry</div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Dmitry Avtonomov &lt;=
[email protected]&gt;<br>
<b>Sent:</b> Sunday, September 17, 2017 10:21 AM<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> [platform-dev] Re: Netbeans antlr</font>
<div>&nbsp;</div>
</div>
<div>
<div dir=3D"ltr">
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">Iterate through all open TopComponents, checking their actual type, then=
 getting the value needed should work and be the simples maybe?<br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f"><br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">Set&lt;TopComponent&gt; tops =3D TopComponent.Registry.getOpened();</div=
>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">for (TopComponent top : tops) {</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">&nbsp; if (top instanceof YourTopComponent) {</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">&nbsp;&nbsp;&nbsp; YourTopComponent ytc =3D (YourTopComponent)top;</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">&nbsp;&nbsp;&nbsp; String value =3D ytc.callFancyMethod();<br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">&nbsp; }<br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">}<br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f"><br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f"><a href=3D"http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/=
openide/windows/doc-files/api.html#find">http://bits.netbeans.org/dev/javad=
oc/org-openide-windows/org/openide/windows/doc-files/api.html#find</a><br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f"><br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">Best, <br>
</div>
<div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-seri=
f">Dmitry<br>
</div>
</div>
<div class=3D"gmail_extra"><br>
<div class=3D"gmail_quote">On Sat, Sep 16, 2017 at 1:59 PM, Peter Cheung <s=
pan dir=3D"ltr">
&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">mcheung63@ho=
tmail.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #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">
&nbsp; &nbsp; 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>&nbsp; &nbsp;I 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>
</div>
</body>
</html>

--_000_ME1PR01MB02602806B7C64473F5A0EE73B5620ME1PR01MB0260ausp_--