如何使用 RCPTT 检查 window 是否在 Eclipse RCP 中打开

How to check if a window is open in Eclipse RCP, with RCPTT

我有一个用 RCPTT 开发的 ECL 脚本,用于测试 RCP 应用程序。在测试过程中,它会设置一些设置并保存。当测试按下 "OK" 时,会打开一个信息 window 来通知用户此更改需要重建项目。

我的问题是这个 window 不会总是显示。如果在测试运行所在的工作区中,这个window已经打开,并且设置了选项"Remmenber my decision",那么它不会打开。

我想在我的测试中加入一个 if 来处理这两种情况。它应该是这样的:

if [/* what can i put here ?*/] {
    get-window Settings | get-button Yes | click
}

这样的条件怎么写?

我可以做类似 if [get-window Settings | verify-true ]if [ not [get-window Settings | verify-error ] ] 的事情吗?

编辑: 通过使用 "record snippet" 工具,我得到了这样的结果:

with [get-window Settings] {
    get-property "isEnabled()" | equals true | verify-true
    get-property "isVisible()" | equals true | verify-true
}

我用的哪个 属性 好?启用、可见或两者兼而有之?

在这种情况下使用 try-catch:

try {
    get-window Settings | get-button Yes | click
} -catch {
    // Verify that the window was missing (and not some other problem)
    verify-error -command {get-window Settings}
}