[ANN] LogTailerPlugin v0.05


I have uploaded a new version of the LogTailerPlugin. This version addresses
a number of issues people posted about as well as start the
highlighting/filtering implementation.

http://www.intellij.org/twiki/bin/view/Main/LogTailerPlugin


Also, please send thanks to Paul Mutton (http://www.jibble.org) for
JLogTailer upon which this is based

NOTE: If you get any NPEs during startup (especially if you used an older
version), just remove the <logtailerplugin/> section of your project's IWS
file.

In v0.05

Log File and Add Evaluated Log File into a single option. If
no formatting is applied, the straight filename is used. THIS DIALOG IS A
WIP!

  • Addded a realtime display of the evaluated filename name

  • Fixed various NPEs

  • Fixed issues with resetting log displays (like when exiting cfg panel)

  • Fixed issues with Removing tailed files

  • Fixed issues with initial display when adding files


TODO (for v0.06)
=================

  • Enable Highlighting rules (RegExp based). Code is implemented, cfg is just

not surfaced

  • Enabled Line Filtering rules (RegExp based). Code is implemented, cfg is

just not surfaced


M

29 comments
Comment actions Permalink


Hello Mark,

I have a little suggestion to make regarding the ability to clear the logs.
Maybe the option to clear the logs should be displayed when clicking with
the left button only, not with both buttons.
Especially when you will implement the clickable/linkable stacktrace.
I often happen to (right)click on the log, inside the toolwindow, and the
"clear log" pops up, I think it's a bit annoying.

Guillaume


0
Comment actions Permalink

I have a little suggestion to make regarding the ability to clear the
logs. Maybe the option to clear the logs should be displayed when clicking
with the left button only, not with both buttons.


hahaha, I can not believe I forgot the right button check...

Especially when you will implement the clickable/linkable stacktrace.
I often happen to (right)click on the log, inside the toolwindow, and the
"clear log" pops up, I think it's a bit annoying.


Shall I just make it an Action in the toolbar then?

M

0
Comment actions Permalink

Shall I just make it an Action in the toolbar then?


Yep, Mark, maybe it's a better place !
Let's put it in the toolbar.

Guillaume


0
Comment actions Permalink

Especially when you will implement the clickable/linkable stacktrace.


For some hints on how to implement that clickable/linkable stacktrace, you
might have a look at the LOG4J Monitor plugin, I think it already does this.
There are other plugins that do that too, but I can't name another one.

Guillaume


0
Comment actions Permalink

Guillaume Laforge wrote:

>> > Especially when you will implement the clickable/linkable stacktrace.


For some hints on how to implement that clickable/linkable stacktrace, you
might have a look at the LOG4J Monitor plugin, I think it already does
this. There are other plugins that do that too, but I can't name another
one.


I did look at one, but it just paste's it's content into the normal message
toolwindow...

I will go look at the log4j one.. It's more an issue of the regex used to
identify a src line, find it in the path and link it... Not too much work
and will be cool once it does work :)

M

0
Comment actions Permalink

I did look at one, but it just paste's it's content into the normal

message

toolwindow...


Yep, I knew about that, but it's using the internal Idea's stuffs. :(

I will go look at the log4j one.. It's more an issue of the regex used to
identify a src line, find it in the path and link it...


It must be something like
^.at .(..java:.)$
(before at, I think it's a tabulation)

>Not too much work

and will be cool once it does work :)


Honestly, that's one of the numerous things that make me love Idea, because
you can (quite) easily do some amzing stuff that simplify your life as a
developper :)


0
Comment actions Permalink

>> I will go look at the log4j one.. It's more an issue of the regex used to
>> identify a src line, find it in the path and link it...


It must be something like
^.at .(..java:.)$
(before at, I think it's a tabulation)



Will give that a shot. The Log4J plugin gave me what I needed to chop the
matched line up (extract package, filename, line no) and hyperlinking that
inthe window is quite simple.. Will give it a go tonight

Honestly, that's one of the numerous things that make me love Idea,
because you can (quite) easily do some amzing stuff that simplify your
life as a developper :)


nod.. I actually have a personal plugin (no yet released) that integrates
(via the bugcli addon) with BugZilla... I would also love to see a Jira
integration.. Mike you listening?

M

0
Comment actions Permalink

Hey, Mark, one more suggestion that I've just thought about!
When clicking "plus" and choosing a new log file to view, would it be
possible to remember the folder in which we just chosen the file, in order
to be in the same folder the next time we wanna add a new log file ?

Guillaume


0
Comment actions Permalink

It must be something like
^.at .(..java:.)$
(before at, I think it's a tabulation)


BTW it ended up being .at\s.(.\.java\:.)

M

0
Comment actions Permalink

Are wildcards allowed in the expression? For example, we name our log files
with yyyyMMdd_Hms_S.log. I would like to be able to trail all files created
today. For instance, %yyyyMMdd%_**_.log

"Mark Lussier" <mlussier@intabulas.com> wrote in message
news:asjiel$nbf$1@is.intellij.net...
>

I have uploaded a new version of the LogTailerPlugin. This version

addresses

a number of issues people posted about as well as start the
highlighting/filtering implementation.

>

http://www.intellij.org/twiki/bin/view/Main/LogTailerPlugin

>
>

Also, please send thanks to Paul Mutton (http://www.jibble.org) for
JLogTailer upon which this is based

>

NOTE: If you get any NPEs during startup (especially if you used an older
version), just remove the <logtailerplugin/> section of your project's IWS
file.

>

In v0.05

>

Log File and Add Evaluated Log File into a single option. If
no formatting is applied, the straight filename is used. THIS DIALOG IS A
WIP!

>

  • Addded a realtime display of the evaluated filename name

>

  • Fixed various NPEs

>

  • Fixed issues with resetting log displays (like when exiting cfg panel)

>

  • Fixed issues with Removing tailed files

>

  • Fixed issues with initial display when adding files

>

TODO (for v0.06)
=================

>

  • Enable Highlighting rules (RegExp based). Code is implemented, cfg is

just

not surfaced

>

  • Enabled Line Filtering rules (RegExp based). Code is implemented, cfg is

just not surfaced

>
>

M



0
Comment actions Permalink

Also, a suggestion/feature request: Allow for xml logs to be displayed as
html with the selection of a xsl.

"Brad Lane" <lanebr@ncs.com> wrote in message
news:aso51u$59b$1@is.intellij.net...

Are wildcards allowed in the expression? For example, we name our log

files

with yyyyMMdd_Hms_S.log. I would like to be able to trail all files

created

today. For instance, %yyyyMMdd%_**_.log

>

"Mark Lussier" <mlussier@intabulas.com> wrote in message
news:asjiel$nbf$1@is.intellij.net...
>

I have uploaded a new version of the LogTailerPlugin. This version

addresses

a number of issues people posted about as well as start the
highlighting/filtering implementation.

>

http://www.intellij.org/twiki/bin/view/Main/LogTailerPlugin

>
>

Also, please send thanks to Paul Mutton (http://www.jibble.org) for
JLogTailer upon which this is based

>

NOTE: If you get any NPEs during startup (especially if you used an

older

version), just remove the <logtailerplugin/> section of your project's

IWS

file.

>

In v0.05

>

Add

Log File and Add Evaluated Log File into a single option. If
no formatting is applied, the straight filename is used. THIS DIALOG IS

A

WIP!

>

  • Addded a realtime display of the evaluated filename name

>

  • Fixed various NPEs

>

  • Fixed issues with resetting log displays (like when exiting cfg panel)

>

  • Fixed issues with Removing tailed files

>

  • Fixed issues with initial display when adding files

>

TODO (for v0.06)
=================

>

  • Enable Highlighting rules (RegExp based). Code is implemented, cfg is

just

not surfaced

>

  • Enabled Line Filtering rules (RegExp based). Code is implemented, cfg

is

just not surfaced

>
>

M

>
>


0
Comment actions Permalink

Are wildcards allowed in the expression? For example, we name our log
files with yyyyMMdd_Hms_S.log. I would like to be able to trail all files
created today. For instance, %yyyyMMdd%_**_.log


Not yet.. Right now the expression evaluation is SimpleDateFormat only.. I
am working on somthing like what your asking for. Few more days

M

0
Comment actions Permalink

Also, a suggestion/feature request: Allow for xml logs to be displayed as
html with the selection of a xsl.


Maybe someday. Right now I just grab the new bytes and append them to the
display, and re-rendering the whole butter might be a bit slow..

But the release I just am testing is JEditPane base now (has stacktrace
linking to source working) so I would not be all that hard :)

M

0
Comment actions Permalink

Forgot to mention: great plugin! keep it up.

"Mark Lussier" <mark@ironhide.com> wrote in message
news:aso6u4$889$1@is.intellij.net...
>

Are wildcards allowed in the expression? For example, we name our log
files with yyyyMMdd_Hms_S.log. I would like to be able to trail all

files

created today. For instance, %yyyyMMdd%_**_.log

>

Not yet.. Right now the expression evaluation is SimpleDateFormat only..

I

am working on somthing like what your asking for. Few more days

>

M

>


0
Comment actions Permalink

Mark,

Why not to use IDEA's editor instead of JEditPane (we actually use it in run
console)?

--
Best regards,
Mike Aizatsky.
-


JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

Mike Aizatsky wrote:

Mark,

Why not to use IDEA's editor instead of JEditPane (we actually use it in
run console)?


Tell me how :)

M

0
Comment actions Permalink

Why not to use IDEA's editor instead of JEditPane (we actually use it in
run console)?



so after a quick javadoc look, so I create a document, then create and
editor (both the the Editor Factory).. How do I do things like, scroll to
the end of the document, etc..

M

0
Comment actions Permalink

I am using logfiles which are using file rotation. When tailing on the current log file (e.g. "log.txt"), it seems the plugin sticks to that file, i.e. after the file is renamed to "log.txt.1" for example a new file "log.txt" is created, the plugin won't get any new input until IDEA is restarted.

If this is the case, would it be possible to either automatically detect this or at least have the option to "reinitialize" all log files as a workaround?

Michael

0
Comment actions Permalink

Get various editor models to control the editor.

SelectionModel getSelectionModel();
MarkupModel getMarkupModel();
FoldingModel getFoldingModel();
ScrollingModel getScrollingModel();
CaretModel getCaretModel();

should provide everything you might need.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Mark Lussier" <mark@ironhide.com> wrote in message
news:asoers$kjq$1@is.intellij.net...
>

Why not to use IDEA's editor instead of JEditPane (we actually use it in
run console)?

>
>

so after a quick javadoc look, so I create a document, then create and
editor (both the the Editor Factory).. How do I do things like, scroll to
the end of the document, etc..

>

M

>


0
Comment actions Permalink

Maxim Shafirov wrote:

Get various editor models to control the editor.

SelectionModel getSelectionModel();
MarkupModel getMarkupModel();
FoldingModel getFoldingModel();
ScrollingModel getScrollingModel();
CaretModel getCaretModel();


I spent a few minutes trolling javadoc lastnight and got most most of it
working.. What I have trouble with is

can I use createEditor() and set it readonly? using a createViewer() works
but tosses endless assert failures to stdout

Also does this editor need anything special to reimplement the hyperlinking
of files in a stacktrace back into the editor? Or do I just use the same
code I had to insert html href's and dealing with the linking in hyperlink
listeners

M

0
Comment actions Permalink

Michael Descher wrote:

I am using logfiles which are using file rotation. When tailing on the
current log file (e.g. "log.txt"), it seems the plugin sticks to that
file, i.e. after the file is renamed to "log.txt.1" for example a new file
"log.txt" is created, the plugin won't get any new input until IDEA is
restarted.



Yeah I see what you mean.. Yeah I keep a File() instances hanging around and
react to the filesize changing...

If this is the case, would it be possible to either automatically detect
this or at least have the option to "reinitialize" all log files as a
workaround?


I have a clear log action that I did change last night to rebuild the log
completly (dumps the File() ref)...

I will be posting it as soon as the shift over to using IDEAs editors for
the log tailing is complete (most likely tomorrow)

M

0
Comment actions Permalink

can I use createEditor() and set it readonly? using a createViewer() works
but tosses endless assert failures to stdout

Yes, createViewer() is exactly right way to get readonly editor. As to
assert failed messages would you please post a sample so I could manage what
goes wrong.

Also does this editor need anything special to reimplement the

hyperlinking

of files in a stacktrace back into the editor? Or do I just use the same
code I had to insert html href's and dealing with the linking in hyperlink
listeners


There's no hyperlink support embedded in generic editor. IDEA's Run
toolwindow does a hyperlink like coloring via editor markup model and
listens to EditorMouseEvent in order to handle clicks.


0
Comment actions Permalink

Maxim Shafirov wrote:

Yes, createViewer() is exactly right way to get readonly editor. As to
assert failed messages would you please post a sample so I could manage
what goes wrong.


My code is

_document.insertString( _document.getTextLength(), str);

and then to scroll to bottom

_editor.getCaretModel().moveToOffset( _document.getTextLength() );




Here is the stacktrace.. I assume the answer lies in the last line, but I do
not know the answer


java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:71)
at
com.intellij.openapi.application.a.e.assertReadAccessAllowed(e.java:70)
at com.intellij.openapi.editor.d.p.getLineStartOffset(p.java:71)
at com.intellij.openapi.editor.d.s.logicalPositionToXY(s.java:436)
at com.intellij.openapi.editor.a.a.c.b(c.java:64)
at com.intellij.openapi.command.a.p.a(p.java:204)
at com.intellij.openapi.command.a.p.e(p.java:49)
at com.intellij.openapi.command.a.p.f(p.java:215)
at com.intellij.openapi.command.a.i.caretPositionChanged(i.java:5)
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.util.EventUtil$1.invoke(EventUtil.java:0)
at $Proxy5.caretPositionChanged(Unknown Source)
at com.intellij.openapi.editor.d.n.moveToLogicalPosition(n.java:118)
at com.intellij.openapi.editor.d.n.moveToOffset(n.java:12)
at
org.jibble.logtailer.AutoScrollTextArea.scrollToBottom(AutoScrollTextArea.java:49)
at
org.jibble.logtailer.AutoScrollTextArea.append(AutoScrollTextArea.java:63)
at
com.intabulas.intellij.plugin.logtailer.LogTailerPanel.appendLine(LogTailerPanel.java:205)
at
com.intabulas.intellij.plugin.logtailer.LogTailerPanel$1.run(LogTailerPanel.java:249)
at java.lang.Thread.run(Thread.java:536)
ERROR - plication.impl.ApplicationImpl - Assertion failed: Write
access is allowed inside write-action only (see
com.intellij.openapi.application.Application.runWriteAction())



There's no hyperlink support embedded in generic editor. IDEA's Run
toolwindow does a hyperlink like coloring via editor markup model and
listens to EditorMouseEvent in order to handle clicks.



Okay, I can port to that

M



0
Comment actions Permalink

These actions should be performed under ReadAction concept. Please start
from com.intellij.openapi.application.Application javadoc.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Mark Lussier" <mark@ironhide.com> wrote in message
news:asqhho$12q$1@is.intellij.net...

Maxim Shafirov wrote:

>

Yes, createViewer() is exactly right way to get readonly editor. As to
assert failed messages would you please post a sample so I could manage
what goes wrong.

>

My code is

>

_document.insertString( _document.getTextLength(), str);

>

and then to scroll to bottom

>

_editor.getCaretModel().moveToOffset( _document.getTextLength() );

>
>
>
>

Here is the stacktrace.. I assume the answer lies in the last line, but I

do

not know the answer

>
>

java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:71)
at
com.intellij.openapi.application.a.e.assertReadAccessAllowed(e.java:70)
at com.intellij.openapi.editor.d.p.getLineStartOffset(p.java:71)
at com.intellij.openapi.editor.d.s.logicalPositionToXY(s.java:436)
at com.intellij.openapi.editor.a.a.c.b(c.java:64)
at com.intellij.openapi.command.a.p.a(p.java:204)
at com.intellij.openapi.command.a.p.e(p.java:49)
at com.intellij.openapi.command.a.p.f(p.java:215)
at com.intellij.openapi.command.a.i.caretPositionChanged(i.java:5)
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
at

>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.util.EventUtil$1.invoke(EventUtil.java:0)
at $Proxy5.caretPositionChanged(Unknown Source)
at

com.intellij.openapi.editor.d.n.moveToLogicalPosition(n.java:118)

at com.intellij.openapi.editor.d.n.moveToOffset(n.java:12)
at

>
org.jibble.logtailer.AutoScrollTextArea.scrollToBottom(AutoScrollTextArea.ja
va:49)

at
org.jibble.logtailer.AutoScrollTextArea.append(AutoScrollTextArea.java:63)
at

>
com.intabulas.intellij.plugin.logtailer.LogTailerPanel.appendLine(LogTailerP
anel.java:205)

at

>
com.intabulas.intellij.plugin.logtailer.LogTailerPanel$1.run(LogTailerPanel.
java:249)

at java.lang.Thread.run(Thread.java:536)
ERROR - plication.impl.ApplicationImpl - Assertion failed:

Write

access is allowed inside write-action only (see
com.intellij.openapi.application.Application.runWriteAction())

>
>
>
>

There's no hyperlink support embedded in generic editor. IDEA's Run
toolwindow does a hyperlink like coloring via editor markup model and
listens to EditorMouseEvent in order to handle clicks.

>
>

Okay, I can port to that

>

M

>
>
>



0
Comment actions Permalink

Maxim Shafirov wrote:

These actions should be performed under ReadAction concept. Please start
from com.intellij.openapi.application.Application javadoc.



So I did wrap the code in a runable and feed it through runWriteAction, but
I still get the throwable error (the assertion obviously disappears)

M




--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Mark Lussier" <mark@ironhide.com> wrote in message
news:asqhho$12q$1@is.intellij.net...

>> Maxim Shafirov wrote:
>>
>> > Yes, createViewer() is exactly right way to get readonly editor. As to
>> > assert failed messages would you please post a sample so I could manage
>> > what goes wrong.
>>
>> My code is
>>
>> _document.insertString( _document.getTextLength(), str);
>>
>> and then to scroll to bottom
>>
>> _editor.getCaretModel().moveToOffset( _document.getTextLength() );
>>
>>
>>
>>
>> Here is the stacktrace.. I assume the answer lies in the last line, but I

do

>> not know the answer
>>
>>
>> java.lang.Throwable
>> at com.intellij.openapi.diagnostic.Logger.error(Logger.java:71)
>> at
>> com.intellij.openapi.application.a.e.assertReadAccessAllowed(e.java:70)
>> at com.intellij.openapi.editor.d.p.getLineStartOffset(p.java:71)
>> at
>> com.intellij.openapi.editor.d.s.logicalPositionToXY(s.java:436)
>> at com.intellij.openapi.editor.a.a.c.b(c.java:64) at
>> com.intellij.openapi.command.a.p.a(p.java:204) at
>> com.intellij.openapi.command.a.p.e(p.java:49) at
>> com.intellij.openapi.command.a.p.f(p.java:215) at
>> com.intellij.openapi.command.a.i.caretPositionChanged(i.java:5)
>> at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
>> at
>>

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl

.java:25)

>> at java.lang.reflect.Method.invoke(Method.java:324)
>> at com.intellij.util.EventUtil$1.invoke(EventUtil.java:0)
>> at $Proxy5.caretPositionChanged(Unknown Source)
>> at

com.intellij.openapi.editor.d.n.moveToLogicalPosition(n.java:118)

>> at com.intellij.openapi.editor.d.n.moveToOffset(n.java:12)
>> at
>>

org.jibble.logtailer.AutoScrollTextArea.scrollToBottom(AutoScrollTextArea.ja

va:49)

>> at
>>
org.jibble.logtailer.AutoScrollTextArea.append(AutoScrollTextArea.java:63)
>> at
>>

com.intabulas.intellij.plugin.logtailer.LogTailerPanel.appendLine(LogTailerP

anel.java:205)

>> at
>>

com.intabulas.intellij.plugin.logtailer.LogTailerPanel$1.run(LogTailerPanel.

java:249)

>> at java.lang.Thread.run(Thread.java:536)
>> ERROR - plication.impl.ApplicationImpl - Assertion failed:

Write

>> access is allowed inside write-action only (see
>> com.intellij.openapi.application.Application.runWriteAction())
>>
>>
>>
>>
>> > There's no hyperlink support embedded in generic editor. IDEA's Run
>> > toolwindow does a hyperlink like coloring via editor markup model and
>> > listens to EditorMouseEvent in order to handle clicks.
>>
>>
>> Okay, I can port to that
>>
>> M
>>
>>
>>

0
Comment actions Permalink

As it mentioned in doc\openapi\readwriteactions.html WriteActions can only
be carried out in Swing thread.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Mark Lussier" <mark@ironhide.com> wrote in message
news:asqu93$pfq$1@is.intellij.net...

Maxim Shafirov wrote:

>

These actions should be performed under ReadAction concept. Please start
from com.intellij.openapi.application.Application javadoc.

>
>

So I did wrap the code in a runable and feed it through runWriteAction,

but

I still get the throwable error (the assertion obviously disappears)

>

M

>
>
>
>

>

--

>

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"

>
>

"Mark Lussier" <mark@ironhide.com> wrote in message
news:asqhho$12q$1@is.intellij.net...

>> Maxim Shafirov wrote:
>>
>> > Yes, createViewer() is exactly right way to get readonly editor. As

to

>> > assert failed messages would you please post a sample so I could

manage

>> > what goes wrong.
>>
>> My code is
>>
>> _document.insertString( _document.getTextLength(), str);
>>
>> and then to scroll to bottom
>>
>> _editor.getCaretModel().moveToOffset( _document.getTextLength() );
>>
>>
>>
>>
>> Here is the stacktrace.. I assume the answer lies in the last line, but

I

do

>> not know the answer
>>
>>
>> java.lang.Throwable
>> at com.intellij.openapi.diagnostic.Logger.error(Logger.java:71)
>> at
>> com.intellij.openapi.application.a.e.assertReadAccessAllowed(e.java:70)
>> at

com.intellij.openapi.editor.d.p.getLineStartOffset(p.java:71)

>> at
>> com.intellij.openapi.editor.d.s.logicalPositionToXY(s.java:436)
>> at com.intellij.openapi.editor.a.a.c.b(c.java:64) at
>> com.intellij.openapi.command.a.p.a(p.java:204) at
>> com.intellij.openapi.command.a.p.e(p.java:49) at
>> com.intellij.openapi.command.a.p.f(p.java:215) at
>> com.intellij.openapi.command.a.i.caretPositionChanged(i.java:5)
>> at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
>> at
>>
>

>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl

.java:25)

>> at java.lang.reflect.Method.invoke(Method.java:324)
>> at com.intellij.util.EventUtil$1.invoke(EventUtil.java:0)
>> at $Proxy5.caretPositionChanged(Unknown Source)
>> at

com.intellij.openapi.editor.d.n.moveToLogicalPosition(n.java:118)

>> at com.intellij.openapi.editor.d.n.moveToOffset(n.java:12)
>> at
>>
>

>
org.jibble.logtailer.AutoScrollTextArea.scrollToBottom(AutoScrollTextArea.ja

va:49)

>> at
>>
org.jibble.logtailer.AutoScrollTextArea.append(AutoScrollTextArea.java:63)
>> at
>>
>

>
com.intabulas.intellij.plugin.logtailer.LogTailerPanel.appendLine(LogTailerP

anel.java:205)

>> at
>>
>

>
com.intabulas.intellij.plugin.logtailer.LogTailerPanel$1.run(LogTailerPanel.

java:249)

>> at java.lang.Thread.run(Thread.java:536)
>> ERROR - plication.impl.ApplicationImpl - Assertion failed:

Write

>> access is allowed inside write-action only (see
>> com.intellij.openapi.application.Application.runWriteAction())
>>
>>
>>
>>
>> > There's no hyperlink support embedded in generic editor. IDEA's Run
>> > toolwindow does a hyperlink like coloring via editor markup model and
>> > listens to EditorMouseEvent in order to handle clicks.
>>
>>
>> Okay, I can port to that
>>
>> M
>>
>>
>>

>


0
Comment actions Permalink

Maxim Shafirov wrote:

As it mentioned in doc\openapi\readwriteactions.html WriteActions can only
be carried out in Swing thread.



So now I am totally confused :) If I create a runnable and pass it into
runWriteAction.. which is how I interpret "Write action can be called only
from the Swing thread using runWriteAction method" from the doc..

So am I just slow today?

M


--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Mark Lussier" <mark@ironhide.com> wrote in message
news:asqu93$pfq$1@is.intellij.net...

>> Maxim Shafirov wrote:
>>
>> > These actions should be performed under ReadAction concept. Please
>> > start from com.intellij.openapi.application.Application javadoc.
>>
>>
>> So I did wrap the code in a runable and feed it through runWriteAction,

but

>> I still get the throwable error (the assertion obviously disappears)
>>
>> M
>>
>>
>>
>>
>> >
>> > --
>> >
>> > Best regards,
>> > Maxim Shafirov
>> > JetBrains, Inc / IntelliJ Software
>> > http://www.intellij.com
>> > "Develop with pleasure!"
>> >
>> >
>> > "Mark Lussier" <mark@ironhide.com> wrote in message
>> > news:asqhho$12q$1@is.intellij.net...
>> >> Maxim Shafirov wrote:
>> >>
>> >> > Yes, createViewer() is exactly right way to get readonly editor. As

to

>> >> > assert failed messages would you please post a sample so I could

manage

>> >> > what goes wrong.
>> >>
>> >> My code is
>> >>
>> >> _document.insertString( _document.getTextLength(), str);
>> >>
>> >> and then to scroll to bottom
>> >>
>> >> _editor.getCaretModel().moveToOffset( _document.getTextLength() );
>> >>
>> >>
>> >>
>> >>
>> >> Here is the stacktrace.. I assume the answer lies in the last line,
>> >> but

I

>> > do
>> >> not know the answer
>> >>
>> >>
>> >> java.lang.Throwable
>> >> at
>> >> com.intellij.openapi.diagnostic.Logger.error(Logger.java:71)
>> >> at
>> >>
com.intellij.openapi.application.a.e.assertReadAccessAllowed(e.java:70)
>> >> at

com.intellij.openapi.editor.d.p.getLineStartOffset(p.java:71)

>> >> at
>> >>
com.intellij.openapi.editor.d.s.logicalPositionToXY(s.java:436)
>> >> at com.intellij.openapi.editor.a.a.c.b(c.java:64) at
>> >> com.intellij.openapi.command.a.p.a(p.java:204) at
>> >> com.intellij.openapi.command.a.p.e(p.java:49) at
>> >> com.intellij.openapi.command.a.p.f(p.java:215) at
>> >>
com.intellij.openapi.command.a.i.caretPositionChanged(i.java:5)
>> >> at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown
>> >> Source) at
>> >>
>> >
>>

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
>> > .java:25)
>> >> at java.lang.reflect.Method.invoke(Method.java:324)
>> >> at com.intellij.util.EventUtil$1.invoke(EventUtil.java:0)
>> >> at $Proxy5.caretPositionChanged(Unknown Source)
>> >> at
>> > com.intellij.openapi.editor.d.n.moveToLogicalPosition(n.java:118)
>> >> at com.intellij.openapi.editor.d.n.moveToOffset(n.java:12)
>> >> at
>> >>
>> >
>>

org.jibble.logtailer.AutoScrollTextArea.scrollToBottom(AutoScrollTextArea.ja
>> > va:49)
>> >> at
>> >>
>>
org.jibble.logtailer.AutoScrollTextArea.append(AutoScrollTextArea.java:63)
>> >> at
>> >>
>> >
>>

com.intabulas.intellij.plugin.logtailer.LogTailerPanel.appendLine(LogTailerP
>> > anel.java:205)
>> >> at
>> >>
>> >
>>

com.intabulas.intellij.plugin.logtailer.LogTailerPanel$1.run(LogTailerPanel.
>> > java:249)
>> >> at java.lang.Thread.run(Thread.java:536)
>> >> ERROR - plication.impl.ApplicationImpl - Assertion failed:
>> > Write
>> >> access is allowed inside write-action only (see
>> >> com.intellij.openapi.application.Application.runWriteAction())
>> >>
>> >>
>> >>
>> >>
>> >> > There's no hyperlink support embedded in generic editor. IDEA's Run
>> >> > toolwindow does a hyperlink like coloring via editor markup model
>> >> > and listens to EditorMouseEvent in order to handle clicks.
>> >>
>> >>
>> >> Okay, I can port to that
>> >>
>> >> M
>> >>
>> >>
>> >>
>>

0
Comment actions Permalink

As it mentioned in doc\openapi\readwriteactions.html WriteActions can only
be carried out in Swing thread.


Okay so wrap the runWriteAction in say an invokeLater.. That seems to work..

M

0
Comment actions Permalink

Mark,

Write actions are permitted in swing thread only in order not to allow a
deadlock in the program.

--
Best regards,
Mike Aizatsky.
-


JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


0

Please sign in to leave a comment.