Closed GoogleCodeExporter closed 8 years ago
Are you sure initKit is being called? Can you post sample code for me to
reproduce
the issue? Just one java class without dependencies please.
Original comment by ayman.al...@gmail.com
on 20 Jan 2009 at 6:52
Writing something similar in separate class was not very successful. I cannot
get
exception with very simple test code...
To me it suggest what the fact what few hundred over classes are initialize at
a same
time make a difference. Also in real application this is not happening all the
time,
maybe only 50-60%.
If DefaultSyntaxKit.initKit() will not be called I believe the stack-trace will
not
show first line. Everything will work fine, just without any syntax support.
I will still play with it in evening, and I will let you know if I find
something more.
Original comment by arek.str...@gmail.com
on 21 Jan 2009 at 2:55
Placing the setting of ContentType into invokeLater() somehow fixed the problem.
I have something like this now:
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
editor.setContentType("text/groovy");
editor.setText(s);
}
});
I also removed doLayout() as javadoc says clearly to not call it from user
code. I
don't see difference in behavior now with or without it (before using
invokeLater() I
believe if was freezing whole application sometimes - but maybe because I was
trying
so many things it was something else).
I believe you run (or it is run by swing) some initialization code inside
invokeLater(). When application starts, this code is scheduled to run later
(after
all swing classes are build etc.). When I set ContentType before calling
setText(),
your SyntaxView expect perfect situation when all was already initialized and
throws
ClassCastException.
This is not visible in simple one frame, one panel application as there is time
to do
it all. It is problem only in more complex applications.
I'm not sure if placing whole setting inside invokeLater() is a fix or it is
workaround, but I believe you should make users aware of this problem.
Original comment by arek.str...@gmail.com
on 22 Jan 2009 at 3:18
Actually you should use invokeLater to show the very first Swing window /
Frame.
Have a look at the SyntaxTester main method.
I will close the issue. Thanks for the report.
Original comment by ayman.al...@gmail.com
on 22 Jan 2009 at 6:21
Original issue reported on code.google.com by
arek.str...@gmail.com
on 20 Jan 2009 at 5:35