I have a simple view registered normally in my Eclipse plug-in (4.5.2), and it works when I start an Eclipse instance with the plug-in. It still works in the corresponding test case, which has the following method:
@Before
public void setUp() throws Exception {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
for (IViewReference viewReference : activePage.getViewReferences()) {
activePage.hideView(viewReference);
}
activePage.showView("org.acme.MyView");
}
Yet when I run the same test with Tycho (0.22, 0.24 or 0.25), I get the following exception:
java.lang.NullPointerException: null
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1271)
at org.eclipse.ui.internal.WorkbenchPage$12.run(WorkbenchPage.java:4238)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4234)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4214)
at org.acme.MyViewTest.setUp(MyViewTest.java:39)
The Tycho code is simple:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<providerHint>junit4</providerHint>
<useUIHarness>true</useUIHarness>
</configuration>
</plugin>
I found this bug and a couple more, but I found nothing explaining why it would only fail in Tycho. And I couldn't find anything on how to fix this.
So what did I do wrong? How do I fix it?