MessagesToolWindowFixture.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:intellij-ce-playground 作者:
@NotNull
private Pair<JEditorPane, String> getCellEditorAndText() {
  // There is no specific UI component for a hyperlink in the "Messages" window. Instead we have a JEditorPane with HTML. This method
  // finds the anchor tags, and matches the text of each of them against the given text. If a matching hyperlink is found, we fire a
  // HyperlinkEvent, simulating a click on the actual hyperlink.
  assertThat(myTarget).isInstanceOf(EditableNotificationMessageElement.class);

  final JEditorPane editorComponent = execute(new GuiQuery<JEditorPane>() {
    @Override
    protected JEditorPane executeInEDT() throws Throwable {
      EditableNotificationMessageElement message = (EditableNotificationMessageElement)myTarget;
      TreeCellEditor cellEditor = message.getRightSelfEditor();
      return field("editorComponent").ofType(JEditorPane.class).in(cellEditor).get();
    }
  });
  assertNotNull(editorComponent);

  String text = execute(new GuiQuery<String>() {
    @Override
    protected String executeInEDT() throws Throwable {
      return editorComponent.getText();
    }
  });
  assertNotNull(text);

  return Pair.create(editorComponent, text);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号