use of org.fest.swing.edt.GuiTask in project android by JetBrains.
the class ThemeEditorTableCellWriter method startCellEditing.
/** {@inheritDoc} */
@Override
public void startCellEditing(@NotNull final JTable table, final int row, final int column) {
final JTableLocation location = location();
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
scrollToCell(table, row, column, location);
}
});
Rectangle cellBounds = location.cellBounds(table, row, column);
robot.click(table, cellBounds.getLocation());
}
use of org.fest.swing.edt.GuiTask in project android by JetBrains.
the class IdeFrameFixture method requestFocusIfLost.
/**
* Gets the focus back to Android Studio if it was lost
*/
public void requestFocusIfLost() {
KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
Wait.seconds(1).expecting("a component to have the focus").until(() -> {
// keep asking until it is. This problem has appeared at least when not using a window manager when running tests.
if (keyboardFocusManager.getFocusOwner() == null) {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
target().requestFocus();
}
});
return false;
}
return true;
});
}
use of org.fest.swing.edt.GuiTask in project android by JetBrains.
the class IdeFrameFixture method getSourceFolderRelativePaths.
/**
* Returns a list of system independent paths
*/
@NotNull
public Collection<String> getSourceFolderRelativePaths(@NotNull String moduleName, @NotNull JpsModuleSourceRootType<?> sourceType) {
Set<String> paths = Sets.newHashSet();
Module module = getModule(moduleName);
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
try {
for (ContentEntry contentEntry : rootModel.getContentEntries()) {
for (SourceFolder folder : contentEntry.getSourceFolders()) {
JpsModuleSourceRootType<?> rootType = folder.getRootType();
if (rootType.equals(sourceType)) {
String path = urlToPath(folder.getUrl());
String relativePath = getRelativePath(myProjectPath, new File(toSystemDependentName(path)));
paths.add(PathUtil.toSystemIndependentName(relativePath));
}
}
}
} finally {
rootModel.dispose();
}
}
});
return paths;
}
use of org.fest.swing.edt.GuiTask in project android by JetBrains.
the class SelectPathFixture method clickOK.
@NotNull
public IdeFrameFixture clickOK() {
JButton button = GuiTests.waitUntilShowingAndEnabled(myRobot, myDialog, Matchers.byText(JButton.class, "OK"));
// Click the "OK" button pragmatically to eliminate the flakiness due to a possible click miss.
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
button.doClick();
}
});
Wait.seconds(5).expecting("dialog to disappear").until(() -> !target().isShowing());
return myIdeFrameFixture;
}
use of org.fest.swing.edt.GuiTask in project android by JetBrains.
the class SelectSdkDialogFixture method setJdkPath.
@NotNull
public SelectSdkDialogFixture setJdkPath(@NotNull final File path) {
final JLabel label = robot().finder().find(target(), JLabelMatcher.withText("Select Java JDK:").andShowing());
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
Component textField = label.getLabelFor();
assertThat(textField).isInstanceOf(JTextField.class);
((JTextField) textField).setText(path.getPath());
}
});
return this;
}
Aggregations