use of org.fest.swing.edt.GuiQuery in project intellij-community by JetBrains.
the class ComboBoxActionFixture method click.
private void click() {
final JButtonFixture comboBoxButtonFixture = new JButtonFixture(myRobot, myTarget);
Pause.pause(new Condition("Wait until comboBoxButton is enabled") {
@Override
public boolean test() {
//noinspection ConstantConditions
return execute(new GuiQuery<Boolean>() {
@Override
protected Boolean executeInEDT() throws Throwable {
return comboBoxButtonFixture.target().isEnabled();
}
});
}
}, GuiTestUtil.SHORT_TIMEOUT);
comboBoxButtonFixture.click();
}
use of org.fest.swing.edt.GuiQuery in project intellij-community by JetBrains.
the class FileFixture method waitForCodeAnalysisHighlightCount.
@NotNull
public FileFixture waitForCodeAnalysisHighlightCount(@NotNull final HighlightSeverity severity, final int expected) {
final Document document = getNotNullDocument();
pause(new Condition("Waiting for code analysis " + severity + " count to reach " + expected) {
@Override
public boolean test() {
Collection<HighlightInfo> highlightInfos = execute(new GuiQuery<Collection<HighlightInfo>>() {
@Override
protected Collection<HighlightInfo> executeInEDT() throws Throwable {
CommonProcessors.CollectProcessor<HighlightInfo> processor = new CommonProcessors.CollectProcessor<HighlightInfo>();
DaemonCodeAnalyzerEx.processHighlights(document, myProject, severity, 0, document.getTextLength(), processor);
return processor.getResults();
}
});
assertNotNull(highlightInfos);
return highlightInfos.size() == expected;
}
}, SHORT_TIMEOUT);
return this;
}
use of org.fest.swing.edt.GuiQuery in project intellij-community by JetBrains.
the class FileFixture method requireOpenAndSelected.
@NotNull
public FileFixture requireOpenAndSelected() {
requireVirtualFile();
pause(new Condition("File " + quote(myPath.getPath()) + " to be opened") {
@Override
public boolean test() {
//noinspection ConstantConditions
return execute(new GuiQuery<Boolean>() {
@Override
protected Boolean executeInEDT() throws Throwable {
return isOpenAndSelected();
}
});
}
}, SHORT_TIMEOUT);
return this;
}
use of org.fest.swing.edt.GuiQuery 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;
}
use of org.fest.swing.edt.GuiQuery in project intellij-community by JetBrains.
the class SelectSdkDialogFixture method selectPathToSdk.
public SelectSdkDialogFixture selectPathToSdk(@NotNull File pathToSdk) {
final JTextField textField = myRobot.finder().findByType(JTextField.class);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
textField.setText(pathToSdk.getPath());
}
});
final Tree tree = myRobot.finder().findByType(myDialog, Tree.class);
final AbstractTreeBuilder builder = AbstractTreeBuilder.getBuilderFor(tree);
pause(new Condition("Wait until path is updated") {
@Override
public boolean test() {
//noinspection ConstantConditions
return execute(new GuiQuery<Boolean>() {
@Override
protected Boolean executeInEDT() throws Throwable {
return (textField.getText().equals(pathToSdk.getPath()) && !builder.getUi().getUpdater().hasNodesToUpdate());
}
});
}
}, SHORT_TIMEOUT);
return this;
}
Aggregations