本文整理汇总了Java中org.fest.swing.edt.GuiTask类的典型用法代码示例。如果您正苦于以下问题:Java GuiTask类的具体用法?Java GuiTask怎么用?Java GuiTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuiTask类属于org.fest.swing.edt包,在下文中一共展示了GuiTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJavaModelSerialization
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test @IdeGuiTest
public void testJavaModelSerialization() throws IOException {
IdeFrameFixture projectFrame = importProjectAndWaitForProjectSyncToFinish("MultipleModuleTypes");
final File projectPath = projectFrame.getProjectPath();
projectFrame.requestProjectSync()
.waitForGradleProjectSyncToFinish();
projectFrame.closeProject();
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
projectManager.loadAndOpenProject(projectPath.getPath());
}
});
projectFrame = findIdeFrame(projectPath);
LibraryTable libraryTable = ProjectLibraryTable.getInstance(projectFrame.getProject());
// When serialization of Java model fails, libraries are not set up.
// Here we confirm that serialization works, because the Java module has the dependency declared in its build.gradle file.
assertThat(libraryTable.getLibraries()).hasSize(1);
}
示例2: testMismatchingEncodings
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test @IdeGuiTest
public void testMismatchingEncodings() throws IOException {
IdeFrameFixture projectFrame = importSimpleApplication();
final Project project = projectFrame.getProject();
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
EncodingProjectManager encodings = EncodingProjectManager.getInstance(project);
encodings.setDefaultCharsetName("ISO-8859-1");
}
});
projectFrame.requestProjectSync().waitForGradleProjectSyncToFinish();
String expectedMessage = "The project encoding (ISO-8859-1) has been reset to the encoding specified in the Gradle build files (UTF-8).";
ContentFixture syncMessages = projectFrame.getMessagesToolWindow().getGradleSyncContent();
syncMessages.findMessage(INFO, firstLineStartingWith(expectedMessage));
assertEquals("UTF-8", EncodingProjectManager.getInstance(project).getDefaultCharsetName());
}
示例3: closeProject
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
public void closeProject() {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
closeAndDispose(getProject());
RecentProjectsManager.getInstance().updateLastProjectPath();
WelcomeFrame.showIfNoProjectOpened();
}
});
pause(new Condition("Waiting for 'Welcome' page to show up") {
@Override
public boolean test() {
for (Frame frame : Frame.getFrames()) {
if (frame instanceof WelcomeFrame && frame.isShowing()) {
return true;
}
}
return false;
}
});
}
示例4: selectProjectPane
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@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));
}
示例5: click
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
private void click(boolean synchronous) {
if (synchronous) {
execute(new GuiTask() {
@Override
protected void executeInEDT() {
new Runnable() {
@Override
public void run() {
doClick();
}
}.run();
}
});
}
else {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
doClick();
}
});
}
}
示例6: editAvdWithName
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
public AvdEditWizardFixture editAvdWithName(@NotNull String name) {
final TableView tableView = robot().finder().findByType(target(), TableView.class, true);
JTableFixture tableFixture = new JTableFixture(robot(), tableView);
JTableCellFixture cell = tableFixture.cell(name);
final TableCell actionCell = TableCell.row(cell.row()).column(7);
JTableCellFixture actionCellFixture = tableFixture.cell(actionCell);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
tableView.editCellAt(actionCell.row, actionCell.column);
}
});
JPanel actionPanel = (JPanel)actionCellFixture.editor();
HyperlinkLabel editButtonLabel = robot().finder().find(actionPanel, new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) {
@Override
protected boolean isMatching(@NotNull HyperlinkLabel component) {
return "Edit this AVD".equals(component.getToolTipText());
}
});
robot().click(editButtonLabel);
return AvdEditWizardFixture.find(robot());
}
示例7: activate
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
public void activate() {
if (isActive()) {
return;
}
final Callback callback = new Callback();
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
myToolWindow.activate(callback);
}
});
pause(new Condition("Wait for ToolWindow '" + myToolWindowId + "' to be activated") {
@Override
public boolean test() {
return callback.finished;
}
}, SHORT_TIMEOUT);
}
示例8: moveTo
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
/**
* Moves the caret to the given caret offset (0-based).
*
* @param offset the character offset
*/
public EditorFixture moveTo(final int offset) {
assertTrue(offset >= 0);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
// TODO: Do this via mouse clicks!
FileEditorManager manager = FileEditorManager.getInstance(myFrame.getProject());
Editor editor = manager.getSelectedTextEditor();
if (editor != null) {
editor.getCaretModel().moveToOffset(offset);
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
}
}
});
return this;
}
示例9: select
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
/**
* Selects the given range. If the first and second offsets are the same, it simply
* moves the caret to the given position. The caret is always placed at the second offset,
* <b>which is allowed to be smaller than the first offset</b>. Calling {@code select(10, 7)}
* would be the same as dragging the mouse from offset 10 to offset 7 and releasing the mouse
* button; the caret is now at the beginning of the selection.
*
* @param firstOffset the character offset where we start the selection, or -1 to remove the selection
* @param secondOffset the character offset where we end the selection, which can be an earlier
* offset than the firstOffset
*/
public EditorFixture select(final int firstOffset, final int secondOffset) {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
// TODO: Do this via mouse drags!
FileEditorManager manager = FileEditorManager.getInstance(myFrame.getProject());
Editor editor = manager.getSelectedTextEditor();
if (editor != null) {
editor.getCaretModel().getPrimaryCaret().setSelection(firstOffset, secondOffset);
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
}
}
});
return this;
}
示例10: selectItemByText
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
private static void selectItemByText(@NotNull final JList list, @NotNull final String text) {
final Integer appIndex = execute(new GuiQuery<Integer>() {
@Override
protected Integer executeInEDT() throws Throwable {
ListPopupModel popupModel = (ListPopupModel)list.getModel();
for (int i = 0; i < popupModel.getSize(); ++i) {
PopupFactoryImpl.ActionItem actionItem = (PopupFactoryImpl.ActionItem)popupModel.get(i);
assertNotNull(actionItem);
if (text.equals(actionItem.getText())) {
return i;
}
}
return -1;
}
});
//noinspection ConstantConditions
assertTrue(appIndex >= 0);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
list.setSelectedIndex(appIndex);
}
});
assertEquals(text, ((PopupFactoryImpl.ActionItem)list.getSelectedValue()).getText());
}
示例11: switchToPreview
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
public void switchToPreview(@NotNull String displayName) {
final RenderPreviewManager previewManager = getContent().getPreviewManager(false);
assertNotNull(previewManager);
List<RenderPreview> previews = previewManager.getPreviews();
if (previews != null) {
for (final RenderPreview renderPreview : previews) {
if (displayName.equals(renderPreview.getDisplayName())) {
execute(new GuiTask() {
@Override
public void executeInEDT() {
previewManager.switchTo(renderPreview);
}
});
return;
}
}
}
fail("No preview titled " + displayName + " exists.");
}
示例12: deleteFile
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
public static void deleteFile(@Nullable final VirtualFile file) {
// File deletion must happen on UI thread under write lock
if (file != null) {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
try {
file.delete(this);
}
catch (IOException e) {
// ignored
}
}
});
}
});
}
}
示例13: saveFile
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
protected void saveFile(String dir, String file) {
if (!Utils.isMac()) {
beautiFrame.menuItemWithPath("File", "Save As").click();
JFileChooserFixture fileChooser = findFileChooser().using(robot());
fileChooser.setCurrentDirectory(new File(dir));
fileChooser.selectFile(new File(file)).approve();
} else {
_file = new File(dir + "/" + file);
execute(new GuiTask() {
@Override
protected void executeInEDT() {
try {
beauti.doc.save(_file);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
示例14: importAlignment
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
void importAlignment(String dir, File ... files) {
if (!Utils.isMac()) {
beautiFrame.menuItemWithPath("File", "Import Alignment").click();
JFileChooserFixture fileChooser = findFileChooser().using(robot());
fileChooser.setCurrentDirectory(new File(dir));
fileChooser.selectFiles(files).approve();
// close down any popup message
robot().pressKey(KeyEvent.VK_ESCAPE);
} else {
this._dir = dir;
for (File file : files) {
_file = new File(dir + "/" + file.getName());
execute(new GuiTask() {
@Override
protected void executeInEDT() {
try {
beauti.doc.importNexus(_file);
beauti.refreshPanel();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
}
示例15: setUp
import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
super.setUp();
final PanelTestingFrame frame = GuiActionRunner.execute(new GuiQuery<PanelTestingFrame>() {
protected PanelTestingFrame executeInEDT() {
return getPanelTestingFrame();
}
});
GuiActionRunner.execute(new GuiTask() {
protected void executeInEDT() {
disableTooltipAndBlinkRadeForChildrenToSatisfyIdeasUsefulTestCase(frame);
}
});
window = new FrameFixture(frame);
window.show();
}