GUI-67 Can't record actions in mocha run tool window

Fix access allowed only from AWT
This commit is contained in:
Maxim.Kolmakov
2018-01-12 16:38:14 +01:00
parent 473018708d
commit fcfdb4b83e
2 changed files with 14 additions and 2 deletions
@@ -73,7 +73,7 @@ public class EditorFixture {
public final Robot robot;
private final IdeFrameFixture myFrame;
private final EditorTabsFixture tabs;
private final Editor myEditor;
private Editor myEditor;
/**
* Constructs a new editor fixture, tied to the given project
@@ -210,6 +210,11 @@ public class EditorFixture {
return myEditor;
}
public void setEditor(Editor editor) {
myEditor = editor;
}
/**
* Returns the contents of the current file, or null if there is no
* file open. The caret position is indicated by {@code ^}, and
@@ -12,6 +12,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vfs.VirtualFile;
import org.fest.swing.core.Robot;
import org.fest.swing.edt.GuiActionRunner;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.edt.GuiTask;
import org.fest.swing.timing.Condition;
@@ -38,8 +39,14 @@ public class FileEditorFixture extends EditorFixture {
private final IdeFrameFixture myFrame;
public FileEditorFixture(Robot robot, IdeFrameFixture frame) {
super(robot, FileEditorManager.getInstance(frame.getProject()).getSelectedTextEditor());
super(robot, null);
myManager = FileEditorManager.getInstance(frame.getProject());
execute(new GuiTask() {
@Override
protected void executeInEDT() {
FileEditorFixture.this.setEditor(myManager.getSelectedTextEditor());
}
});
myFrame = frame;
}