IDEA-161519 java.lang.IllegalStateException: The DialogWrapper can only be used in event dispatch...

This commit is contained in:
Dmitry Avdeev
2016-09-21 15:30:13 +03:00
parent c07b75ed2f
commit c2d7f4eb12
2 changed files with 17 additions and 16 deletions
@@ -19,7 +19,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.wm.impl.commands.FinalizableCommand;
import com.intellij.util.ui.EdtInvocationManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -45,19 +44,17 @@ public final class CommandProcessor implements Runnable {
* prevent focus handling of events which is caused by the commands to be executed.
*/
public final void execute(@NotNull List<FinalizableCommand> commandList, @NotNull Condition expired) {
EdtInvocationManager.getInstance().invokeLater(() -> {
synchronized (myLock) {
final boolean isBusy = myCommandCount > 0;
synchronized (myLock) {
final boolean isBusy = myCommandCount > 0;
final CommandGroup commandGroup = new CommandGroup(commandList, expired);
myCommandGroupList.add(commandGroup);
myCommandCount += commandList.size();
final CommandGroup commandGroup = new CommandGroup(commandList, expired);
myCommandGroupList.add(commandGroup);
myCommandCount += commandList.size();
if (!isBusy) {
run();
}
if (!isBusy) {
run();
}
});
}
}
public final void run() {
@@ -16,6 +16,7 @@
package com.intellij.openapi.wm.impl.commands;
import com.intellij.util.ui.EdtInvocationManager;
/**
* @author Vladimir Kondratyev
@@ -29,11 +30,14 @@ public final class InvokeLaterCmd extends FinalizableCommand{
}
public void run(){
try{
myRunnable.run();
}finally{
finish();
}
EdtInvocationManager.getInstance().invokeLater(() -> {
try {
myRunnable.run();
}
finally {
finish();
}
});
}
@Override