CommandProcessor Question
Hello,
Then i use CommandCommander, does it popup ProgressMonitor window authomatical if CommandAction is long process time?
If no, it will be very nice to have such via OpenAPI. Some plugins may have some long task and be happy if IDEA monitorig those tasks by ProgressMonitor popup window.
I search trought Tutorial and find follow:
http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html#monitors
So, i think that follow may be provided throught CommandProcessor. For long task may used method:
Thanks!
Please sign in to leave a comment.
Hmm... At least this should not be possible because showing a progress
window needs the main activity to be performed in non-swing thread (while
executeCommand() is only possible inside swing thread).
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Alexey Efimov" <aefimov@spklabs.com> wrote in message
news:17686282.1065519119393.JavaMail.itn@is.intellij.net...
>
authomatical if CommandAction is long process time?
>
have some long task and be happy if IDEA monitorig those tasks by
ProgressMonitor popup window.
>
>
http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html#monitors
>
long task may used method:
>
Exactly,
Then you execute CommandProcessor.executeCommand(Runnable runnable, ...) you
should be create new thread directly or using SwingUtilities. In any case -
new thread is created and executed.
While this thread is working main thread may run another one thread and
lookup for activity in it. The thread lines look like:
mainThread
-> CommandProcessor.executeCommand(Runnable runnable, ...)
->runnable.run()
if (runnable instanceof CommandLongTask) {
-> ProcessMonitor thread
->run()
-> while (runnable.isAlive()) {sleep(sometimeout);
((CommandLongTask)runnable).getCurrentIndex() ...}
}
Is it wrong?
Thanks!
"Valentin Kipiatkov (JetBrains)" <valentin@intellij.com> wrote in message
news:bmh6g8$uij$1@is.intellij.net...
>
I think you misunderstand the main idea of CommandProcessor. Its main pupose
is to granulate changes made by user to enable proper undo behaviour. If
your command doesn't do any changes then you usually do not need
CommandProcessor.executeCommand(). Activities that can be performed in
separate thread with progress shown usually do not perform any changes
(anyway changing documents or PSI is not allowed outside UI thread).
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Alexey Efimov" <aefimov@spklabs.com> wrote in message
news:bmh766$8sq$1@is.intellij.net...
>
you
case -
>
>
>
(while
>
>
Thanks a lot!
So, CommandProcessor need for monitoring changes while some action performed?
Does my thought are right?
1. Is it can be used for redo/undo without aditional code. If i need to track changes i just do it throught CommandProcessor.
2. Command is some action, which will be registered authomatical in changes list.
Can i use follow expertise to resolve redo/undo for my own editor implementation for binary files?
Can i use some API to progress monitoring by progres bar window like when "Open Project" etc?
Thank you!
performed?
track changes i just do it throught CommandProcessor.
changes list.
Yes.
implementation for binary files?
You can use UndoManager.undoableActionPerformed().
"Open Project" etc?
Unfortunately this dialog is not in the open API yet.
--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"
"Alexey Efimov" <aefimov@spklabs.com> wrote in message
news:16996203.1066658987790.JavaMail.itn@is.intellij.net...
>
performed?
track changes i just do it throught CommandProcessor.
changes list.
>
implementation for binary files?
>
"Open Project" etc?
>