Transaction boundary around the divers listeners

Is there any way to have a kind of transaction demarcation for any user
action -> beforeActionStarts(), afterActionFinished(). This could be used to
store different listeners information until afterActionFinished is called
where the custom operation would be performed with the guaranty that all
listeners have been called.
Example:
a) I want to listen to caret movement
b) Change in the document
c) Change in the psi tree
d) Change in the selected document

For typing in the editor for example I might get 1xa, 1xb 1xc. If now the
user performed a method rename I might get 1xa, nxb, nxc since it would
impact multiple files, multiple call sites,...! Now I don't know how to
identify the "boundary", the last event, of the current user action for me
to kick my processing. This is something very similar to the transaction
support in the VCS API. You have startTransaction and commitTransaction that
surrounds every other callbacks.
Very handy especially in such environment rich in listeners.

Jacques


1 comment
Comment actions Permalink

See CommandProcessor.addCommandListener(CommandListener).

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:ashjvs$c74$1@is.intellij.net...

Is there any way to have a kind of transaction demarcation for any user
action -> beforeActionStarts(), afterActionFinished(). This could be used

to

store different listeners information until afterActionFinished is called
where the custom operation would be performed with the guaranty that all
listeners have been called.
Example:
a) I want to listen to caret movement
b) Change in the document
c) Change in the psi tree
d) Change in the selected document

>

For typing in the editor for example I might get 1xa, 1xb 1xc. If now the
user performed a method rename I might get 1xa, nxb, nxc since it would
impact multiple files, multiple call sites,...! Now I don't know how to
identify the "boundary", the last event, of the current user action for me
to kick my processing. This is something very similar to the transaction
support in the VCS API. You have startTransaction and commitTransaction

that

surrounds every other callbacks.
Very handy especially in such environment rich in listeners.

>

Jacques

>
>


0

Please sign in to leave a comment.