Eclipse rcp EclipseRCP:通过SWTBot的id获取默认透视切换器按钮

Eclipse rcp EclipseRCP:通过SWTBot的id获取默认透视切换器按钮,eclipse-rcp,swtbot,Eclipse Rcp,Swtbot,在Eclipse 3.7 RCP应用程序中,我希望通过id获得默认的透视切换器按钮,用于SWTBot/单元测试目的,以绕过以下问题: assertNotNull("PerspectiveBar not visisble", bot.toolbarButtonWithTooltip("Perspektive öffnen")); 如何找到按钮的id以便使用 assertNotNull("PerspectiveBar not visisble", bot.toolbarButtonWithId("

在Eclipse 3.7 RCP应用程序中,我希望通过id获得默认的透视切换器按钮,用于SWTBot/单元测试目的,以绕过以下问题:

assertNotNull("PerspectiveBar not visisble", bot.toolbarButtonWithTooltip("Perspektive öffnen"));
如何找到按钮的id以便使用

assertNotNull("PerspectiveBar not visisble", bot.toolbarButtonWithId("somekey", "someid"));
或者:有没有更好的(独立于国际化的)方法,我可以自己设置这个按钮的键/id吗


Thx.

如果您想通过id查找任何带有SWTBot的小部件, 您必须针对键“org.eclipse.swtbot.widget.key”设置id

现在您可以获得如下所示的小部件

bot.widget(withId("my.widget.id"));
就你的情况而言,它将是

bot.toolbarButtonWithId("someid");
但在此之前,您必须确保针对上述密钥设置id

bot.toolbarButtonWithId("someid");