use of org.fest.swing.edt.GuiTask in project intellij-community by JetBrains.
the class ProjectViewFixture method selectAndroidPane.
@NotNull
public PaneFixture selectAndroidPane() {
activate();
final ProjectView projectView = ProjectView.getInstance(myProject);
pause(new Condition("Project view is initialized") {
@Override
public boolean test() {
//noinspection ConstantConditions
return field("isInitialized").ofType(boolean.class).in(projectView).get();
}
}, SHORT_TIMEOUT);
final String id = "AndroidView";
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
projectView.changeView(id);
}
});
return new PaneFixture(projectView.getProjectViewPaneById(id));
}
use of org.fest.swing.edt.GuiTask in project intellij-community by JetBrains.
the class ProjectViewFixture method selectProjectPane.
@NotNull
public PaneFixture selectProjectPane() {
activate();
final ProjectView projectView = ProjectView.getInstance(myProject);
pause(new Condition("Project view is initialized") {
@Override
public boolean test() {
//noinspection ConstantConditions
return field("isInitialized").ofType(boolean.class).in(projectView).get();
}
}, SHORT_TIMEOUT);
final String id = "ProjectPane";
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
projectView.changeView(id);
}
});
return new PaneFixture(projectView.getProjectViewPaneById(id));
}
use of org.fest.swing.edt.GuiTask in project intellij-community by JetBrains.
the class RenameRefactoringDialogFixture method setNewName.
@NotNull
public RenameRefactoringDialogFixture setNewName(@NotNull final String newName) {
final EditorTextField field = robot().finder().findByType(target(), EditorTextField.class);
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(field, true);
});
}
});
// to make sure we don't append to existing item on Linux
robot().pressAndReleaseKey(KeyEvent.VK_BACK_SPACE);
robot().enterText(newName);
return this;
}
use of org.fest.swing.edt.GuiTask in project intellij-community by JetBrains.
the class RunConfigurationsDialogFixture method click.
private void click(final JBList popupList, String text) {
JListFixture popupFixture = new JListFixture(robot(), popupList);
popupFixture.replaceCellReader(new MakeStepsCellReader());
final int index = popupFixture.item(text).index();
// For some reason calling popupFixture.click(...) doesn't work, but this does:
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
popupList.setSelectedIndex(index);
}
});
robot().pressAndReleaseKey(KeyEvent.VK_ENTER);
}
use of org.fest.swing.edt.GuiTask in project intellij-community by JetBrains.
the class EditorFixture method open.
/**
* Opens up a different file. This will run through the "Open File..." dialog to
* find and select the given file.
*
* @param file the file to open
* @param tab which tab to open initially, if there are multiple editors
*/
public EditorFixture open(@NotNull final VirtualFile file, @NotNull final Tab tab) {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
// TODO: Use UI to navigate to the file instead
Project project = myFrame.getProject();
FileEditorManager manager = FileEditorManager.getInstance(project);
if (tab == Tab.EDITOR) {
manager.openTextEditor(new OpenFileDescriptor(project, file), true);
} else {
manager.openFile(file, true);
}
}
});
pause(new Condition("File " + quote(file.getPath()) + " to be opened") {
@Override
public boolean test() {
//noinspection ConstantConditions
return execute(new GuiQuery<Boolean>() {
@Override
protected Boolean executeInEDT() throws Throwable {
FileEditor[] editors = FileEditorManager.getInstance(myFrame.getProject()).getEditors(file);
if (editors.length == 0)
return false;
return editors[0].getComponent().isShowing();
}
});
}
}, SHORT_TIMEOUT);
// TODO: Maybe find a better way to keep Documents in sync with their VirtualFiles.
invokeActionViaKeystroke("Synchronize");
return this;
}
Aggregations