• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java GuiTask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.fest.swing.edt.GuiTask的典型用法代码示例。如果您正苦于以下问题:Java GuiTask类的具体用法?Java GuiTask怎么用?Java GuiTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GuiTask类属于org.fest.swing.edt包,在下文中一共展示了GuiTask类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GradleSyncTest.java


示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GradleSyncTest.java


示例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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdeFrameFixture.java


示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProjectViewFixture.java


示例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();
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:MessagesToolWindowFixture.java


示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AvdManagerDialogFixture.java


示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ToolWindowFixture.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:EditorFixture.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:EditorFixture.java


示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ComboBoxActionFixture.java


示例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.");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LayoutPreviewFixture.java


示例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
            }
          }
        });
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GuiTests.java


示例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();
				}
	        }
	    });
		
	}	
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:22,代码来源:BeautiBase.java


示例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();
					}
		        }
		    });
		}
	}			
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:27,代码来源:BeautiBase.java


示例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();
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:18,代码来源:BaseGuiTest.java


示例16: shouldAddNewDataSourceAfterExecutionInvoked

import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test
public void shouldAddNewDataSourceAfterExecutionInvoked() {
    panel.populateWithConfigurations(asList(notDefaultDataSource));
    clickAdd();

    GuiActionRunner.execute(new GuiTask() {
        @Override
        protected void executeInEDT() throws Throwable {
            addDataSourceActionExecutor.execute(XQueryDataSourceType.SAXON);
        }
    });

    JListFixture list = window.list().cellReader(new DataSourceListCellReader());
    list.requireSelection(1);
    assertThat(list.contents()[1], is(XQueryDataSourceType.SAXON.getPresentableName()));
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:17,代码来源:DataSourceListPanelGuiTest.java


示例17: shouldRemoveEntryAfterRemoveButtonClicked

import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test
public void shouldRemoveEntryAfterRemoveButtonClicked() {
    panel.populateWithConfigurations(asList(defaultDataSource));
    final AnActionButton action = getAnActionButton(REMOVE);
    final AnActionEvent event = new TestActionEvent(action);

    execute(new GuiTask() {
        @Override
        protected void executeInEDT() throws Throwable {
            action.actionPerformed(event);
        }
    });

    window.list().requireNoSelection();
    assertThat(window.list().contents().length, is(0));
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:17,代码来源:DataSourceListPanelGuiTest.java


示例18: shouldSwapObjectsInModelAndMarkOthersNotDefaultIfUpdatedWithDefault

import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test
public void shouldSwapObjectsInModelAndMarkOthersNotDefaultIfUpdatedWithDefault() {
    panel.populateWithConfigurations(asList(defaultDataSource, defaultDataSource));
    window.list().selectItem(0);

    execute(new GuiTask() {
        @Override
        protected void executeInEDT() throws Throwable {
            panel.updateCurrentlySelectedItemWithData(defaultDataSource);
        }
    });

    execute(new GuiTask() {
        @Override
        protected void executeInEDT() throws Throwable {
            assertThat(panel.getSelectedDataSource(), is(defaultDataSource));
            assertThat(panel.getSelectedDataSource().DEFAULT, is(true));
            assertThat(panel.getCurrentConfigurations().get(1).DEFAULT, is(false));
        }
    });
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:22,代码来源:DataSourceListPanelGuiTest.java


示例19: testTabbing

import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test
public void testTabbing() throws AWTException {
	final List<Component> tabOrder = Lists.newArrayList();
	tabOrder.add(_button);
	tabOrder.add(_textField);
	execute(new GuiTask() {
		@Override
		public void executeInEDT() {
			_frame.setFocusTraversalPolicy(new OrderedFocusTraversalPolicy(tabOrder));
		}
	});
	Robot robot = new Robot();
	_testUtil.delay();
	assertThat(_button.isFocusOwner()).isTrue();
	robot.keyPress(KeyEvent.VK_TAB);
	_testUtil.delay();
	robot.keyRelease(KeyEvent.VK_TAB);
	_testUtil.delay();
	assertThat(_textField.isFocusOwner()).isTrue();
}
 
开发者ID:FRosner,项目名称:DataGenerator,代码行数:21,代码来源:OrderedFocusTraversalPolicyTest.java


示例20: testTabbing_someElementsDisabled

import org.fest.swing.edt.GuiTask; //导入依赖的package包/类
@Test
public void testTabbing_someElementsDisabled() throws AWTException {
	final List<Component> tabOrder = Lists.newArrayList();
	tabOrder.add(_button);
	tabOrder.add(_textField);
	execute(new GuiTask() {
		@Override
		public void executeInEDT() {
			_textField.setEnabled(false);
			_frame.setFocusTraversalPolicy(new OrderedFocusTraversalPolicy(tabOrder));
		}
	});
	Robot robot = new Robot();
	_testUtil.delay();
	assertThat(_button.isFocusOwner()).isTrue();
	robot.keyPress(KeyEvent.VK_TAB);
	_testUtil.delay();
	robot.keyRelease(KeyEvent.VK_TAB);
	_testUtil.delay();
	assertThat(_button.isFocusOwner()).isTrue();
}
 
开发者ID:FRosner,项目名称:DataGenerator,代码行数:22,代码来源:OrderedFocusTraversalPolicyTest.java



注:本文中的org.fest.swing.edt.GuiTask类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EndCheckpointResponseProto类代码示例发布时间:2022-05-22
下一篇:
Java RemovalNotification类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap