ProgressManager#WithProgressAsync + CommandProcessor#executeCommand

I'm wrapping several commands into CommandProcessor#executeCommand for Undoability in one action. All inner commands runs in separeted AppllicationManager#InvokeLater.

  • Commands executed in Async thread doesn't respect outer #executeCommand, i.e. undo works for each command separately.
  • Also i can't put #executeCommand into async thread cuz i will get exception.
  • #WithProgressSync respects outer command, but dialog freezes cuz ui thread.
0
正式评论

Commands can only be executed in UI thread.

Have you tried to use the same non-null command name and groupId so that the commands could be merged automatically?

Sorry, I don't understand "dialog freezes cuz ui thread", more details or a thread dump could be helpful.

runProcessWithProgressSynchronously (Freezes)

Undo in one action

 

https://i.gyazo.com/b65cb245ce958f3ff71501aecdc77008.mp4 

Default:


"AWT-EventQueue-0 2016.3.4#IC-163.12024.16 IDEA, eap:false, os:Windows 10 10.0, java-version:Oracle Corporation 1.8.0_65-b17@2879"
prio=6 tid=0x18 nid=NA runnable


------------------------------------------------------------------------------------------
ProgressManager.getInstance().runProcessWithProgressSynchronously:

"AWT-EventQueue-0 2016.3.4#IC-163.12024.16 IDEA, eap:false, os:Windows 10 10.0, java-version:Oracle Corporation 1.8.0_65-b17@2879"
prio=6 tid=0x18 nid=NA waiting

"ApplicationImpl pooled thread 9@14747"
prio=4 tid=0x31 nid=NA runnable


------------------------------------------------------------------------------------------
InvokeLater:

"AWT-EventQueue-0 2016.3.4#IC-163.12024.16 IDEA, eap:false, os:Windows 10 10.0, java-version:Oracle Corporation 1.8.0_65-b17@2879"
prio=6 tid=0x18 nid=NA runnable



runProcessWithProgressAsynchronously (Not freezes, but broken undo)

Each action perform undo separately


https://i.gyazo.com/b2956eb1cf825178f03c36a2c82754bc.mp4 

Default:

"AWT-EventQueue-0 2016.3.4#IC-163.12024.16 IDEA, eap:false, os:Windows 10 10.0, java-version:Oracle Corporation 1.8.0_65-b17@2876"
prio=6 tid=0x18 nid=NA runnable

------------------------------------------------------------------------------------------
ProgressManager.getInstance().runProcessWithProgressSynchronously:

"AWT-EventQueue-0 2016.3.4#IC-163.12024.16 IDEA, eap:false, os:Windows 10 10.0, java-version:Oracle Corporation 1.8.0_65-b17@2876"
prio=6 tid=0x18 nid=NA waiting

"ApplicationImpl pooled thread 6@14367"
prio=4 tid=0x2e nid=NA runnable

------------------------------------------------------------------------------------------
InvokeLater:

"AWT-EventQueue-0 2016.3.4#IC-163.12024.16 IDEA, eap:false, os:Windows 10 10.0, java-version:Oracle Corporation 1.8.0_65-b17@2876"
prio=6 tid=0x18 nid=NA runnable

 

with highlight:



0

Sorry, I understand just about nothing in this message. What do all these thread names mean? Have you tried my suggestion from the previous comment?

 

0

Changes that modify files are not merged by the undo engine, I'm afraid. The only way to have 'atomic' undo is to make the changes inside one command.

0

请先登录再写评论。